<?xml version="1.0" encoding="UTF-8"?>



<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">

    <channel>
        <title>perlquestion</title>
        <link>http://prlmnks.org/list/</link>
        <description>RSS feeds from perlmonks.org</description>
        <language>en</language>
        <ttl>5</ttl>

        

<item>
    <title>Non-blocking connect() and gethostbyname()? (Anonymous Monk)</title>
    <link>http://prlmnks.org/html/581062.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/581062.html</guid>

    <description>
        &lt;p&gt;I&#39;m using IO::Socket right now to do some non-blocking network IO for a graphical application. IO::Socket has a blocking() method that purports to toggle blocking mode. It seems to work for reading and writing, but its connect() method--which gets called when you do IO::Socket::INET-&gt;new()--does not. First it calls gethostbyname(), which blocks, then it blocks using IO::Select to timeout the connect call. I don&#39;t want to rewrite the whole thing to use POE. Is there any way to do a non-blocking connect and gethostbyname() using IO::Socket? If not, what would be the least obtrusive alternatives?&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>[OT] When coders don&#39;t see eye to eye (Anonymous Monk)</title>
    <link>http://prlmnks.org/html/581058.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/581058.html</guid>

    <description>
        &lt;p&gt;Dear monks,&lt;/p&gt;&lt;p&gt;I&#39;m currently involved in a web project with a friend. &lt;p&gt;It&#39;s the first time I&#39;m jointly coding a website with another person. We sometimes have quite different approaches to the same problem, and we fail to see eye to eye.&lt;/p&gt;&lt;p&gt;Here&#39;s is one and I hope to seek your advice and opinions.&lt;/p&gt;&lt;p&gt;We are divided over the how to treat the &quot;removal&quot; of a post from a forum. The questionable post will still be somewhere in database, but we need a way to indicate that action was taken against it.&lt;/p&gt;&lt;p&gt;To make things concrete, we&#39;ve two MySQL tables (simplified) as follows:&lt;/p&gt;&lt;b&gt;posts_tbl&lt;/b&gt;&lt;br /&gt;post_id author_id message deleted_flag&lt;br /&gt;&lt;br /&gt;&lt;b&gt;removed_tbl&lt;/b&gt;&lt;br /&gt;post_id message deleted_by_id date&lt;br /&gt;&lt;p&gt;Let&#39;s say we have too approaches A and B.&lt;/p&gt;&lt;p&gt;When a message that is deemed inappropriate is removed via a button click, Approach A goes likes this:&lt;/p&gt;&lt;p&gt;In &lt;b&gt;posts_tbl&lt;/b&gt;, the &quot;message&quot; field is updated with the replacement text &quot;Removed by USERNAME&quot; and the &quot;deleted_flag&quot; column with a value of 1 (the default is 0) (Note: the username is available at the point of update, so it&#39;s updated into the message filed as part of the replacement text).&lt;/p&gt;&lt;p&gt;In &lt;b&gt;removed_tbl&lt;/b&gt;, the original message is inserted into the message field, together with the post_id, the date, the member id of the person carrying out the deletion.&lt;/p&gt;&lt;p&gt;Approach A&#39;s points are:&lt;/p&gt;a) When displaying posts in a web page, all posts can be directly retrieved from &lt;b&gt;posts_tbl&lt;/b&gt;, including messages that contain &quot;Removed by USERNAME&quot;.&lt;br /&gt;b) Saving of processing time because there&#39;s no need for additional code to check whether a message was removed.&lt;br /&gt;c) Greater flexibility because different pieces of data are stored in two different tables.&lt;br /&gt;d) Greater expandability. When a different reason for removing the post is needed, a new column can be added to &lt;b&gt;removed_tbl&lt;/b&gt; to store that reason.&lt;br /&gt;&lt;p&gt;The sql to retrieve messages from &lt;b&gt;posts_tbl&lt;/b&gt; will be straightforward without having to link to &lt;b&gt;removed_tbl&lt;/b&gt; to retrieve the username of the person who deleted the post (assuming the other information in removed_tbl is not needed for display). The code will be simpler too.&lt;/p&gt;&lt;p&gt;Approach B is:&lt;/p&gt;&lt;b&gt;removed_tbl&lt;/b&gt; should be changed to:&lt;br /&gt;post_id deleted_by_id date&lt;br /&gt;&lt;p&gt;When a removal is carried out:&lt;/p&gt;&lt;p&gt;In &lt;b&gt;posts_tbl&lt;/b&gt;, the &quot;message&quot; field remains unchanged while the  &quot;deleted_flag&quot; column is updated with a value of 1.&lt;/p&gt;&lt;p&gt;In &lt;b&gt;removed_tbl&lt;/b&gt;, the necessary information is inserted (post_id, member id of the person deleting the message, date)&lt;/p&gt;&lt;p&gt;Approach&#39;s B points are:&lt;/p&gt;a) The original message should not be touched in posts_tbl.&lt;br /&gt;b) There&#39;s duplication of data if the message field of &lt;b&gt;posts_tbl&lt;/b&gt; is updated with the string &quot;Removed by ...&quot;.&lt;br /&gt;c) There&#39;s also duplication of data because &quot;Removed by ...&quot; and &quot;deleted_flag&quot; both indicate the particular post has been removed.&lt;br /&gt;d) The string &quot;Removed by ...&quot; should be added in the code for outputting to a webpage, so that it doesn&#39;t get stored anywhere. When a different wording is needed e.g. changing &quot;Removed by ...&quot; to &quot;Deleted by ...&quot;, only that the hard-coded string needs to be changed.&lt;br /&gt;e) posts_tbl stores all original posts, so it&#39;s easier for retrieval.&lt;br /&gt;&lt;p&gt;Cons of Approach B:&lt;/p&gt;a) The sql to retrieve messages will require an additional condition to link posts_tbl to removed_tbl to retrieve the username of whoever deleted the post.&lt;br /&gt;b) The code will need to check for whether a post has been removed so it can output the string &quot;Removed by ...&quot;.&lt;br /&gt;&lt;p&gt;There are other ways for sure. But between the two outlined above, which is a better solution?&lt;/p&gt;&lt;p&gt;It&#39;s a bit longish but I need to paint as accurate a picture as possible.&lt;/p&gt;&lt;p&gt;Would appreciate your enlightment :)&lt;/p&gt;Thank you and I look foward to hearing from you :)&lt;br /&gt;
    </description>
</item>

        

<item>
    <title>foreach in HoHoA problems (mdunnbass)</title>
    <link>http://prlmnks.org/html/581054.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/581054.html</guid>

    <description>
        Hi Monks,&lt;p /&gt;I am trying to have a look at the elements of arrays in a dynamically created HoHoA.  When I try something like this:&lt;br /&gt;&lt;pre class=&quot;block_code&quot;&gt; my ($span, %matches) = @_; my ($site, $fastaseq, $fasta, $sitekey) = &#39;&#39;; my ($setscounter,$lowerlimit,$upperlimit,$i,$set,$yes,$low,$hit) = 0; my %sets = (); FASTA: for $fastaseq (keys %matches) {       $sitekey = &#39;&#39;;       SITEKEY: for $sitekey (sort {$a &lt;=&gt; $b } keys %{$matches{$fastaseq}}) {         if (@{$matches{$fastaseq}{$sitekey}}) {          SET: foreach $hit (@{$matches{$fastaseq}{$sitekey}}) {            print &quot;\$matches{$fastaseq}{$sitekey} is: $matches{$fastaseq}{$sitekey}\n&quot;;            print &quot;\$hit is: &quot;,$hit,&quot;\n&quot;;            print &quot;\$hit is: &quot;,$matches{$fastaseq}{$sitekey}[$hit],&quot;\n&quot;;            if ($hit &gt;= $lowerlimit &amp;&amp; $hit &lt;= $upperlimit) { #some code}}}}}&lt;/pre&gt;I get the following output:&lt;br /&gt;&lt;pre class=&quot;block_code&quot;&gt;$matches{&gt;LG_XIV}{0} is: ARRAY(0x182bb14)Use of uninitialized value in print at MyScript line 386.$hit is: $hit is: 6906413Use of uninitialized value in numeric ge (&gt;=) at MyScript line 388.&lt;/pre&gt;BTW - line 386 is the first &lt;tt class=&quot;inline_code&quot;&gt;print $hit&lt;/tt&gt; line, and so on.   I&#39;m using &lt;tt class=&quot;inline_code&quot;&gt;use strict&lt;/tt&gt; and &lt;tt class=&quot;inline_code&quot;&gt;use warnings&lt;/tt&gt;, and I am scratching my head like mad to try to figure out what&#39;s wrong.  I&#39;ve been staring at this so long, I am losing my train of thought anymore.&lt;p /&gt;If I replace the straight &lt;tt class=&quot;inline_code&quot;&gt;$hit&lt;/tt&gt; calls in the greater than comparison with &lt;tt class=&quot;inline_code&quot;&gt;$matches{$fastaseq}{$sitekey}[$hit]&lt;/tt&gt;, I get no change.&lt;p /&gt;Basically, I just want to know what each of the values in the array &lt;code&gt;$matches{$fastaseq}{$sitekey} array is, and then throw it into the comparison on that if (&gt;= &amp;&amp; &lt;=) line.  But, no dice.&lt;p /&gt;Does anyone have any ideas, or can point out what I&#39;m doing wrong?&lt;p  /&gt;Thanks,&lt;br /&gt;Matt
    </description>
</item>

        

<item>
    <title>Howto include Module with Specific Methods with PAR&#39;s pp utility (monkfan)</title>
    <link>http://prlmnks.org/html/581050.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/581050.html</guid>

    <description>
        Hi,&lt;br&gt;Suppose I have a code (mycode.pl) that has include the following modules&lt;pre class=&quot;block_code&quot;&gt;#!/usr/bin/perl -wuse strict;use Algorithm::Loops &#39;NestedLoops&#39;;use List::Compare;use List::Util qw (min max);use somelib;  # (somelib.pm)# rest of the code&lt;/pre&gt;Now I want to &#39;compile&#39; into an &#39;executable&#39; of this code using PAR&#39;s [http://search.cpan.org/~smueller/PAR-0.957/script/pp|pp] utility. I tried the following command:&lt;pre class=&quot;block_code&quot;&gt;#!/usr/bin/bashpp -M Algorithm::Loops qw(NestedLoops) -M List::Compare -M List::Util qw(min max)  -a somelib.pm mycode.out&lt;/pre&gt;But it gives:&lt;pre class=&quot;block_code&quot;&gt;-bash: syntax error near unexpected token `(&#39;&lt;/pre&gt;What&#39;s the way to overcome this?&lt;div class=&quot;pmsig&quot;&gt;&lt;div class=&quot;pmsig-393886&quot;&gt;&lt;br&gt;Regards,&lt;br&gt;Edward&lt;/div&gt;&lt;/div&gt;
    </description>
</item>

        

<item>
    <title>Form letters: eval a string to substutite perl variables (brycen)</title>
    <link>http://prlmnks.org/html/581030.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/581030.html</guid>

    <description>
        Updated: Here&#39;s what I want to do. Given a file:&lt;pre class=&quot;block_code&quot;&gt;&quot;Dear $row-&gt;{name}; thanks for giving us money.&quot;&lt;/pre&gt;I want to slurp it in:&lt;pre class=&quot;block_code&quot;&gt;undef($/);$block = &lt;FILE&gt;;&lt;/pre&gt;Then substitue in a loop:&lt;pre class=&quot;block_code&quot;&gt;$sql = &quot;select email,name from database&quot;;while( $row=getrow($sql) ) {   print &quot;Working on $row-&gt;{name}\n&quot;;   eval{$block);   send_email($row-&gt;{email},$block);  }&lt;/pre&gt;The idea is to use perl syntax and the perl parser for the substitution, rather than a made up syntax (e.g. %NAME% and s/%NAME%/$name/). Is this crazy?
    </description>
</item>

        

<item>
    <title>dbi:csv how to (zli034)</title>
    <link>http://prlmnks.org/html/581029.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/581029.html</guid>

    <description>
        &lt;p&gt;I have many csv file to orgnize. I try to use dbi:csv but not a clue. &lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt; use DBI;    $dbh = DBI-&gt;connect(&quot;DBI:CSV:f_dir=/base/&quot;)        or die &quot;Cannot connect: &quot; . $DBI::errstr;    $sth = $dbh-&gt;prepare(&quot;CREATE TABLE a (id INTEGER, name CHAR(10))&quot;)        or die &quot;Cannot prepare: &quot; . $dbh-&gt;errstr();    $sth-&gt;execute() or die &quot;Cannot execute: &quot; . $sth-&gt;errstr();    $sth-&gt;finish();    $dbh-&gt;disconnect();&lt;/pre&gt;&lt;p&gt;When I use this code, where is the data base locates? Is that a file or something else? Can I use a existing csv file as a data base? I totally dont know how to ge the codes from cpan work for me.&lt;/p&gt;&lt;!-- Generated using PerlMonks editor version 001.000105 --&gt;&lt;p&gt;&lt;small&gt; &lt;b&gt;&lt;a href=&quot;?node_id=17558#codetags&quot;&gt;Code&lt;/a&gt;&lt;/b&gt; tags added by [GrandFather]&lt;/small&gt;&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>Renaming CPAN modules (b10m)</title>
    <link>http://prlmnks.org/html/581019.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/581019.html</guid>

    <description>
        &lt;p&gt;Brethren,&lt;/p&gt;&lt;p&gt;I&#39;ve been mainting a CPAN module called &lt;a href=&quot;/out/module/Business::TPGPost&quot;&gt;Business::TPGPost&lt;/a&gt;, which will calculate the shipping cost based on TPG Post (Dutch postal service) rates for some time. Recently, the company changed it&#39;s name from TPG Post to TNT Post.&lt;/p&gt;&lt;p&gt;Since the rates will most likely be updated per January 1st, I&#39;ll be updating it, like a good CPAN user is supposed ;-) But, should I rename my module to Business::TNTPost, or even Business::TNT::NL, or keep the old name? How do other CPAN authors handle namechanges like this?&lt;/p&gt;&lt;p&gt;I can see where a namechange would be preferred for new users, but would &quot;older users&quot; (if they exist at all) be aware of this name change?&lt;/p&gt;&lt;div class=&quot;pmsig&quot;&gt;&lt;div class=&quot;pmsig-295259&quot;&gt;-- &lt;br /&gt;&lt;a href=&quot;/out/node/b10m&quot;&gt;b10m&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size=&quot;-3&quot;&gt;All code is usually tested, but rarely trusted.&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;
    </description>
</item>

        

<item>
    <title>Mystery of missing functions (throop)</title>
    <link>http://prlmnks.org/html/581014.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/581014.html</guid>

    <description>
        Perl monks,I, a pilgrim, seek deeper insight to things Perl.There are certain operations on arrays for which most programming languages have functions, but for which Perl does not.  There are instructions on how to do these things in the perldoc, but they aren&#39;t core functions:&lt;ul&gt;&lt;li&gt;Getting the maximum or minumum element in an array of numbers;  &lt;li&gt; Getting the union, intersection or difference of two arrays.&lt;/ul&gt;I expect that this is not an oversight, but is rather part of the Perl philosophy.  But I cannot divine why.  Will a brother monk instruct me?&lt;p&gt;throop
    </description>
</item>

        

<item>
    <title>HTML::CalendarMonth or HTML::Calendar::Simple (Anonymous Monk)</title>
    <link>http://prlmnks.org/html/581000.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/581000.html</guid>

    <description>
        Hi everyone.  Looking for a perl module to handle my calendar html to keep track of users posts on my site.  I stumbled between these two and both look like they can get the job done for me.  Not sure how to judge which one is better.  HTML::CalendarMonth is newer.  What I need is a large printed calendar that takes up the whole screen. Can anyone tell me which one I should be using?  Thanks.
    </description>
</item>

        

<item>
    <title>help find this script (Tbob)</title>
    <link>http://prlmnks.org/html/580999.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580999.html</guid>

    <description>
        I saw this simple email form; I would like to put it on my site. It contains 5 spaces: 2 radial buttons and a check  box. I want to us it to send a link to my webpage to friends and relatives or either the full page. Out of the five spaces, there is a space for the persons email address, a space for my name, a space for my email and a text area for my comments. The email form starts with a script &lt;SCRIPT language=JavaScript&gt;, I dont know if I can find a perl script to make it work for me. I seen it work at a website, but I dont know how to make it work for me. This &lt;a href=&quot;/out/node/email form&quot;&gt;email form&lt;/a&gt; can be seen at http://www.htmlgoodies.com at the end of their tutorials.  I am new to that stuff; I would like to learn the basics, enough to make it work.
    </description>
</item>

        

<item>
    <title>Cant run CGIs: Empty @INC with Apache (Andre_br)</title>
    <link>http://prlmnks.org/html/580997.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580997.html</guid>

    <description>
        Hello Folks&lt;p&gt;I am getting desperate here, please see if you can give me a hand, my friends.&lt;p&gt;All was fine, I had Perl running, Apache, mod_perl, but then ny WesternDigital HD decided to make me see who owns who. So I had to buy another HD and start reinstalling it all.&lt;p&gt;But now I just can&#39;t make my Perl-Apache installation to run. Despite I had installed them all, through PPM3, the error log keeps complaining that no module is found.&lt;p&gt;&lt;pre class=&quot;block_code&quot;&gt;[Fri Oct 27 15:48:19 2006] [error] [client 127.0.0.1] Premature end of script headers: c:/andre/estantevirtual/site/cgi-bin/ajuda.cgi[Fri Oct 27 15:48:19 2006] [error] [client 127.0.0.1] Can&#39;t locate CGI.pm in @INC (@INC contains:) at c:\\andre\\ESTANT~1\\site\\cgi-bin\\ajuda.cgi line 11.\n[Fri Oct 27 15:48:19 2006] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at c:\\andre\\ESTANT~1\\site\\cgi-bin\\ajuda.cgi line 11.\n[Fri Oct 27 15:53:21 2006] [error] [client 127.0.0.1] Premature end of script headers: c:/andre/estantevirtual/site/cgi-bin/ajuda.cgi[Fri Oct 27 15:53:21 2006] [error] [client 127.0.0.1] Can&#39;t locate lib.pm in @INC (@INC contains:) at c:\\andre\\ESTANT~1\\site\\cgi-bin\\ajuda.cgi line 9.\n[Fri Oct 27 15:53:21 2006] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at c:\\andre\\ESTANT~1\\site\\cgi-bin\\ajuda.cgi line 9.\n[Fri Oct 27 15:53:22 2006] [error] [client 127.0.0.1] Premature end of script headers: c:/andre/estantevirtual/site/cgi-bin/ajuda.cgi[Fri Oct 27 15:53:22 2006] [error] [client 127.0.0.1] Can&#39;t locate lib.pm in @INC (@INC contains:) at c:\\andre\\ESTANT~1\\site\\cgi-bin\\ajuda.cgi line 9.\n[Fri Oct 27 15:53:22 2006] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at c:\\andre\\ESTANT~1\\site\\cgi-bin\\ajuda.cgi line 9.\n[Fri Oct 27 15:53:24 2006] [error] [client 127.0.0.1] Premature end of script headers: c:/andre/estantevirtual/site/cgi-bin/ajuda.cgi[Fri Oct 27 15:53:24 2006] [error] [client 127.0.0.1] Can&#39;t locate lib.pm in @INC (@INC contains:) at c:\\andre\\ESTANT~1\\site\\cgi-bin\\ajuda.cgi line 9.\n[Fri Oct 27 15:53:24 2006] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at c:\\andre\\ESTANT~1\\site\\cgi-bin\\ajuda.cgi line 9.\n[Fri Oct 27 15:57:35 2006] [error] [client 127.0.0.1] Premature end of script headers: c:/andre/estantevirtual/site/cgi-bin/apresentacao.cgi[Fri Oct 27 15:57:35 2006] [error] [client 127.0.0.1] Can&#39;t locate CGI.pm in @INC (@INC contains:) at c:\\andre\\ESTANT~1\\site\\cgi-bin\\APRESE~1.CGI line 11.\n[Fri Oct 27 15:57:35 2006] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at c:\\andre\\ESTANT~1\\site\\cgi-bin\\APRESE~1.CGI line 11.\n&lt;/pre&gt;&lt;p&gt;If I run the scripts through the command line, they go just fine. The problem is when I try to execute them through CGI, I mean, through the browser.I&#39;m on a Win2000 machine, and running ActivePerl 5.8.7 and Apache 1.3.34.I have this httpd.conf wich worked just fine before the disaster:&lt;pre class=&quot;block_code&quot;&gt;## Based upon the NCSA server configuration files originally by Rob McCool.## This is the main Apache server configuration file.  It contains the# configuration directives that give the server its instructions.# See &lt;URL:http://httpd.apache.org/docs/&gt; for detailed information about# the directives.## Do NOT simply read the instructions in here without understanding# what they do.  They&#39;re here only as hints or reminders.  If you are unsure# consult the online docs. You have been warned.  ## After this file is processed, the server will look for and process# C:/Arquivos de programas/Apache/conf/srm.conf and then C:/Arquivos de programas/Apache/conf/access.conf# unless you have overridden these with ResourceConfig and/or# AccessConfig directives here.## The configuration directives are grouped into three basic sections:#  1. Directives that control the operation of the Apache server process as a#     whole (the &#39;global environment&#39;).#  2. Directives that define the parameters of the &#39;main&#39; or &#39;default&#39; server,#     which responds to requests that aren&#39;t handled by a virtual host.#     These directives also provide default values for the settings#     of all virtual hosts.#  3. Settings for virtual hosts, which allow Web requests to be sent to#     different IP addresses or hostnames and have them handled by the#     same Apache server process.## Configuration and logfile names: If the filenames you specify for many# of the server&#39;s control files begin with &quot;/&quot; (or &quot;drive:/&quot; for Win32), the# server will use that explicit path.  If the filenames do *not* begin# with &quot;/&quot;, the value of ServerRoot is prepended -- so &quot;logs/foo.log&quot;# with ServerRoot set to &quot;/usr/local/apache&quot; will be interpreted by the# server as &quot;/usr/local/apache/logs/foo.log&quot;.## NOTE: Where filenames are specified, you must use forward slashes# instead of backslashes (e.g., &quot;c:/apache&quot; instead of &quot;c:\apache&quot;).# If a drive letter is omitted, the drive on which Apache.exe is located# will be used by default.  It is recommended that you always supply# an explicit drive letter in absolute paths, however, to avoid# confusion.#### Section 1: Global Environment## The directives in this section affect the overall operation of Apache,# such as the number of concurrent requests it can handle or where it# can find its configuration files.### ServerType is either inetd, or standalone.  Inetd mode is only supported on# Unix platforms.#ServerType standalone## ServerRoot: The top of the directory tree under which the server&#39;s# configuration, error, and log files are kept.#ServerRoot &quot;C:/Arquivos de programas/Apache&quot;## PidFile: The file in which the server should record its process# identification number when it starts.#PidFile logs/httpd.pid## ScoreBoardFile: File used to store internal server process information.# Not all architectures require this.  But if yours does (you&#39;ll know because# this file will be  created when you run Apache) then you *must* ensure that# no two invocations of Apache share the same scoreboard file.#ScoreBoardFile logs/apache_runtime_status## In the standard configuration, the server will process httpd.conf (this # file, specified by the -f command line option), srm.conf, and access.conf # in that order.  The latter two files are now distributed empty, as it is # recommended that all directives be kept in a single file for simplicity.  # The commented-out values below are the built-in defaults.  You can have the # server ignore these files altogether by using &quot;/dev/null&quot; (for Unix) or# &quot;nul&quot; (for Win32) for the arguments to the directives.##ResourceConfig conf/srm.conf#AccessConfig conf/access.conf## Timeout: The number of seconds before receives and sends time out.#Timeout 300## KeepAlive: Whether or not to allow persistent connections (more than# one request per connection). Set to &quot;Off&quot; to deactivate.#KeepAlive On## MaxKeepAliveRequests: The maximum number of requests to allow# during a persistent connection. Set to 0 to allow an unlimited amount.# We recommend you leave this number high, for maximum performance.#MaxKeepAliveRequests 100## KeepAliveTimeout: Number of seconds to wait for the next request from the# same client on the same connection.#KeepAliveTimeout 15## Apache on Win32 always creates one child process to handle requests.  If it# dies, another child process is created automatically.  Within the child# process multiple threads handle incoming requests.  The next two# directives control the behaviour of the threads and processes.### MaxRequestsPerChild: the number of requests each child process is# allowed to process before the child dies.  The child will exit so# as to avoid problems after prolonged use when Apache (and maybe the# libraries it uses) leak memory or other resources.  On most systems, this# isn&#39;t really needed, but a few (such as Solaris) do have notable leaks# in the libraries.  For Win32, set this value to zero (unlimited)# unless advised otherwise.## NOTE: This value does not include keepalive requests after the initial#       request per connection. For example, if a child process handles#       an initial request and 10 subsequent &quot;keptalive&quot; requests, it#       would only count as 1 request towards this limit.#MaxRequestsPerChild 0## Number of concurrent threads (i.e., requests) the server will allow.# Set this value according to the responsiveness of the server (more# requests active at once means they&#39;re all handled more slowly) and# the amount of system resources you&#39;ll allow the server to consume.#ThreadsPerChild 50## Listen: Allows you to bind Apache to specific IP addresses and/or# ports, instead of the default. See also the &lt;VirtualHost&gt;# directive.##Listen 3000#Listen 12.34.56.78:80## BindAddress: You can support virtual hosts with this option. This directive# is used to tell the server which IP address to listen to. It can either# contain &quot;*&quot;, an IP address, or a fully qualified Internet domain name.# See also the &lt;VirtualHost&gt; and Listen directives.##BindAddress *## Dynamic Shared Object (DSO) Support## To be able to use the functionality of a module which was built as a DSO you# have to place corresponding `LoadModule&#39; lines at this location so the# directives contained in it are actually available _before_ they are used.# Please read the file README.DSO in the Apache 1.3 distribution for more# details about the DSO mechanism and run `apache -l&#39; for the list of already# built-in (statically linked and thus always available) modules in your Apache# binary.## Note: The order in which modules are loaded is important.  Don&#39;t change# the order below without expert advice.## Example:# LoadModule foo_module modules/mod_foo.so##LoadModule vhost_alias_module modules/mod_vhost_alias.so#LoadModule mime_magic_module modules/mod_mime_magic.so#LoadModule status_module modules/mod_status.so#LoadModule info_module modules/mod_info.so#LoadModule speling_module modules/mod_speling.so#LoadModule rewrite_module modules/mod_rewrite.so#LoadModule anon_auth_module modules/mod_auth_anon.so#LoadModule dbm_auth_module modules/mod_auth_dbm.so#LoadModule digest_auth_module modules/mod_auth_digest.so#LoadModule digest_module modules/mod_digest.so#LoadModule proxy_module modules/mod_proxy.so#LoadModule cern_meta_module modules/mod_cern_meta.so#LoadModule expires_module modules/mod_expires.so#LoadModule headers_module modules/mod_headers.so#LoadModule usertrack_module modules/mod_usertrack.so#LoadModule unique_id_module modules/mod_unique_id.so##  Reconstruction of the complete module list from all available modules#  (static and shared ones) to achieve correct module execution order.## The modules listed below, without a corresponding LoadModule directive,# are static bound into the standard Apache binary distribution for Windows.## Note: The order in which modules are loaded is important.  Don&#39;t change# the order below without expert advice.## [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE, UPDATE THIS TOO!]ClearModuleList#AddModule mod_vhost_alias.cAddModule mod_env.cAddModule mod_log_config.c#AddModule mod_mime_magic.cAddModule mod_mime.cAddModule mod_negotiation.c#AddModule mod_status.c#AddModule mod_info.cAddModule mod_include.cAddModule mod_autoindex.cAddModule mod_dir.cAddModule mod_isapi.cAddModule mod_cgi.cAddModule mod_asis.cAddModule mod_imap.cAddModule mod_actions.c#AddModule mod_speling.cAddModule mod_userdir.cAddModule mod_alias.c#AddModule mod_rewrite.cAddModule mod_access.cAddModule mod_auth.c#AddModule mod_auth_anon.c#AddModule mod_auth_dbm.c#AddModule mod_auth_digest.c#AddModule mod_digest.c#AddModule mod_proxy.c#AddModule mod_cern_meta.c#AddModule mod_expires.c#AddModule mod_headers.c#AddModule mod_usertrack.c#AddModule mod_unique_id.cAddModule mod_so.cAddModule mod_setenvif.c## ExtendedStatus controls whether Apache will generate &quot;full&quot; status# information (ExtendedStatus On) or just basic information (ExtendedStatus# Off) when the &quot;server-status&quot; handler is called. The default is Off.##ExtendedStatus On### Section 2: &#39;Main&#39; server configuration## The directives in this section set up the values used by the &#39;main&#39;# server, which responds to any requests that aren&#39;t handled by a# &lt;VirtualHost&gt; definition.  These values also provide defaults for# any &lt;VirtualHost&gt; containers you may define later in the file.## All of these directives may appear inside &lt;VirtualHost&gt; containers,# in which case these default settings will be overridden for the# virtual host being defined.### Port: The port to which the standalone server listens.  Certain firewall# products must be configured before Apache can listen to a specific port.# Other running httpd servers will also interfere with this port.  Disable# all firewall, security, and other services if you encounter problems.# To help diagnose problems use the Windows NT command NETSTAT -a#Port 80## ServerAdmin: Your address, where problems with the server should be# e-mailed.  This address appears on some server-generated pages, such# as error documents.#ServerAdmin me@here.com## ServerName allows you to set a host name which is sent back to clients for# your server if it&#39;s different than the one the program would get (i.e., use# &quot;www&quot; instead of the host&#39;s real name).## Note: You cannot just invent host names and hope they work. The name you # define here must be a valid DNS name for your host. If you don&#39;t understand# this, ask your network administrator.# If your host doesn&#39;t have a registered DNS name, enter its IP address here.# You will have to access it by its address (e.g., http://123.45.67.89/)# anyway, and this will make redirections work in a sensible way.## 127.0.0.1 is the TCP/IP local loop-back address, often named localhost. Your # machine always knows itself by this address. If you use Apache strictly for # local testing and development, you may use 127.0.0.1 as the server name.# -&gt; alterei esteServerName 127.0.0.1## DocumentRoot: The directory out of which you will serve your# documents. By default, all requests are taken from this directory, but# symbolic links and aliases may be used to point to other locations.#DocumentRoot &quot;C:/Andre/ShopVirtual/Site&quot;## Each directory to which Apache has access, can be configured with respect# to which services and features are allowed and/or disabled in that# directory (and its subdirectories). ## First, we configure the &quot;default&quot; to be a very restrictive set of # permissions.  #&lt;Directory /&gt;    Options FollowSymLinks    AllowOverride None&lt;/Directory&gt;## Note that from this point forward you must specifically allow# particular features to be enabled - so if something&#39;s not working as# you might expect, make sure that you have specifically enabled it# below.### This should be changed to whatever you set DocumentRoot to.#&lt;Directory &quot;C:/Andre/ShopVirtual/Site&quot;&gt;## This may also be &quot;None&quot;, &quot;All&quot;, or any combination of &quot;Indexes&quot;,# &quot;Includes&quot;, &quot;FollowSymLinks&quot;, &quot;ExecCGI&quot;, or &quot;MultiViews&quot;.## Note that &quot;MultiViews&quot; must be named *explicitly* --- &quot;Options All&quot;# doesn&#39;t give it to you.#    Options Indexes FollowSymLinks MultiViews## This controls which options the .htaccess files in directories can# override. Can also be &quot;All&quot;, or any combination of &quot;Options&quot;, &quot;FileInfo&quot;, # &quot;AuthConfig&quot;, and &quot;Limit&quot;#    AllowOverride None## Controls who can get stuff from this server.#    Order allow,deny    Allow from all&lt;/Directory&gt;## UserDir: The name of the directory which is appended onto a user&#39;s home# directory if a ~user request is received.## Under Win32, we do not currently try to determine the home directory of# a Windows login, so a format such as that below needs to be used.  See# the UserDir documentation for details.#&lt;IfModule mod_userdir.c&gt;    UserDir &quot;C:/Arquivos de programas/Apache/users/&quot;&lt;/IfModule&gt;## Control access to UserDir directories.  The following is an example# for a site where these directories are restricted to read-only.##&lt;Directory &quot;C:/Arquivos de programas/Apache/users&quot;&gt;#    AllowOverride FileInfo AuthConfig Limit#    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec#    &lt;Limit GET POST OPTIONS PROPFIND&gt;#        Order allow,deny#        Allow from all#    &lt;/Limit&gt;#    &lt;LimitExcept GET POST OPTIONS PROPFIND&gt;#        Order deny,allow#        Deny from all#    &lt;/LimitExcept&gt;#&lt;/Directory&gt;## DirectoryIndex: Name of the file or files to use as a pre-written HTML# directory index.  Separate multiple entries with spaces.#&lt;IfModule mod_dir.c&gt;    DirectoryIndex index.html&lt;/IfModule&gt;## AccessFileName: The name of the file to look for in each directory# for access control information.#AccessFileName .htaccess## The following lines prevent .htaccess files from being viewed by# Web clients.  Since .htaccess files often contain authorization# information, access is disallowed for security reasons.  Comment# these lines out if you want Web visitors to see the contents of# .htaccess files.  If you change the AccessFileName directive above,# be sure to make the corresponding changes here.## Also, folks tend to use names such as .htpasswd for password# files, so this will protect those as well.#&lt;Files ~ &quot;^\.ht&quot;&gt;    Order allow,deny    Deny from all    Satisfy All&lt;/Files&gt;## CacheNegotiatedDocs: By default, Apache sends &quot;Pragma: no-cache&quot; with each# document that was negotiated on the basis of content. This asks proxy# servers not to cache the document. Uncommenting the following line disables# this behavior, and proxies will be allowed to cache the documents.##CacheNegotiatedDocs## UseCanonicalName:  (new for 1.3)  With this setting turned on, whenever# Apache needs to construct a self-referencing URL (a URL that refers back# to the server the response is coming from) it will use ServerName and# Port to form a &quot;canonical&quot; name.  With this setting off, Apache will# use the hostname:port that the client supplied, when possible.  This# also affects SERVER_NAME and SERVER_PORT in CGI scripts.#UseCanonicalName On## TypesConfig describes where the mime.types file (or equivalent) is# to be found.#&lt;IfModule mod_mime.c&gt;    TypesConfig conf/mime.types&lt;/IfModule&gt;## DefaultType is the default MIME type the server will use for a document# if it cannot otherwise determine one, such as from filename extensions.# If your server contains mostly text or HTML documents, &quot;text/plain&quot; is# a good value.  If most of your content is binary, such as applications# or images, you may want to use &quot;application/octet-stream&quot; instead to# keep browsers from trying to display binary files as though they are# text.#DefaultType text/plain## The mod_mime_magic module allows the server to use various hints from the# contents of the file itself to determine its type.  The MIMEMagicFile# directive tells the module where the hint definitions are located.# mod_mime_magic is not part of the default server (you have to add# it yourself with a LoadModule [see the DSO paragraph in the &#39;Global# Environment&#39; section], or recompile the server and include mod_mime_magic# as part of the configuration), so it&#39;s enclosed in an &lt;IfModule&gt; container.# This means that the MIMEMagicFile directive will only be processed if the# module is part of the server.#&lt;IfModule mod_mime_magic.c&gt;    MIMEMagicFile conf/magic&lt;/IfModule&gt;## HostnameLookups: Log the names of clients or just their IP addresses# e.g., www.apache.org (on) or 204.62.129.132 (off).# The default is off because it&#39;d be overall better for the net if people# had to knowingly turn this feature on, since enabling it means that# each client request will result in AT LEAST one lookup request to the# nameserver.#HostnameLookups Off## ErrorLog: The location of the error log file.# If you do not specify an ErrorLog directive within a &lt;VirtualHost&gt;# container, error messages relating to that virtual host will be# logged here.  If you *do* define an error logfile for a &lt;VirtualHost&gt;# container, that host&#39;s errors will be logged there and not here.#ErrorLog logs/error.log## LogLevel: Control the number of messages logged to the error.log.# Possible values include: debug, info, notice, warn, error, crit,# alert, emerg.#LogLevel warn## The following directives define some format nicknames for use with# a CustomLog directive (see below).#LogFormat &quot;%h %l %u %t \&quot;%r\&quot; %&gt;s %b \&quot;%{Referer}i\&quot; \&quot;%{User-Agent}i\&quot;&quot; combinedLogFormat &quot;%h %l %u %t \&quot;%r\&quot; %&gt;s %b&quot; commonLogFormat &quot;%{Referer}i -&gt; %U&quot; refererLogFormat &quot;%{User-agent}i&quot; agent## The location and format of the access logfile (Common Logfile Format).# If you do not define any access logfiles within a &lt;VirtualHost&gt;# container, they will be logged here.  Contrariwise, if you *do*# define per-&lt;VirtualHost&gt; access logfiles, transactions will be# logged therein and *not* in this file.#CustomLog logs/access.log common## If you would like to have agent and referer logfiles, uncomment the# following directives.##CustomLog logs/referer.log referer#CustomLog logs/agent.log agent## If you prefer a single logfile with access, agent, and referer information# (Combined Logfile Format) you can use the following directive.##CustomLog logs/access.log combined## Optionally add a line containing the server version and virtual host# name to server-generated pages (error documents, FTP directory listings,# mod_status and mod_info output etc., but not CGI generated documents).# Set to &quot;EMail&quot; to also include a mailto: link to the ServerAdmin.# Set to one of:  On | Off | EMail#ServerSignature On# # Apache parses all CGI scripts for the shebang line by default.# This comment line, the first line of the script, consists of the symbols# pound (#) and exclamation (!) followed by the path of the program that # can execute this specific script.  For a perl script, with perl.exe in# the C:\Program Files\Perl directory, the shebang line should be:   #!c:/program files/perl/perl# Note you _must_not_ indent the actual shebang line, and it must be the# first line of the file.  Of course, CGI processing must be enabled by # the appropriate ScriptAlias or Options ExecCGI directives for the files # or directory in question.## However, Apache on Windows allows either the Unix behavior above, or can# use the Registry to match files by extention.  The command to execute # a file of this type is retrieved from the registry by the same method as # the Windows Explorer would use to handle double-clicking on a file.# These script actions can be configured from the Windows Explorer View menu, # &#39;Folder Options&#39;, and reviewing the &#39;File Types&#39; tab.  Clicking the Edit# button allows you to modify the Actions, of which Apache 1.3 attempts to# perform the &#39;Open&#39; Action, and failing that it will try the shebang line.# This behavior is subject to change in Apache release 2.0.## Each mechanism has it&#39;s own specific security weaknesses, from the means# to run a program you didn&#39;t intend the website owner to invoke, and the# best method is a matter of great debate.## To enable the this Windows specific behavior (and therefore -disable- the# equivilant Unix behavior), uncomment the following directive:##ScriptInterpreterSource registry## The directive above can be placed in individual &lt;Directory&gt; blocks or the# .htaccess file, with either the &#39;registry&#39; (Windows behavior) or &#39;script&#39; # (Unix behavior) option, and will override this server default option.### Aliases: Add here as many aliases as you need (with no limit). The format is # Alias fakename realname#&lt;IfModule mod_alias.c&gt;    #    # Note that if you include a trailing / on fakename then the server will    # require it to be present in the URL.  So &quot;/icons&quot; isn&#39;t aliased in this    # example, only &quot;/icons/&quot;.  If the fakename is slash-terminated, then the     # realname must also be slash terminated, and if the fakename omits the     # trailing slash, the realname must also omit it.    #    Alias /icons/ &quot;C:/Arquivos de programas/Apache/icons/&quot;    &lt;Directory &quot;C:/Arquivos de programas/Apache/icons&quot;&gt;        Options Indexes MultiViews        AllowOverride None        Order allow,deny        Allow from all    &lt;/Directory&gt;    # This Alias will project the on-line documentation tree under /manual/    # even if you change the DocumentRoot. Comment it if you don&#39;t want to     # provide access to the on-line documentation.    #    Alias /manual/ &quot;C:/Arquivos de programas/Apache/htdocs/manual/&quot;    &lt;Directory &quot;C:/Arquivos de programas/Apache/htdocs/manual&quot;&gt;        Options Indexes FollowSymlinks MultiViews        AllowOverride None        Order allow,deny        Allow from all    &lt;/Directory&gt;    #    # ScriptAlias: This controls which directories contain server scripts.    # ScriptAliases are essentially the same as Aliases, except that    # documents in the realname directory are treated as applications and    # run by the server when requested rather than as documents sent to the client.    # The same rules about trailing &quot;/&quot; apply to ScriptAlias directives as to    # Alias.    # -&gt; alterei esta!    ScriptAlias /cgi-bin/ &quot;C:/Andre/ShopVirtual/Site/cgi-bin/&quot;    #    # &quot;C:/Arquivos de programas/Apache/cgi-bin&quot; should be changed to whatever your ScriptAliased    # CGI directory exists, if you have that configured.    #    &lt;Directory &quot;C:/Andre/ShopVirtual/Site/cgi-bin&quot;&gt;        AllowOverride None        Options None        Order allow,deny        Allow from all    &lt;/Directory&gt;&lt;/IfModule&gt;# End of aliases.## Redirect allows you to tell clients about documents which used to exist in# your server&#39;s namespace, but do not anymore. This allows you to tell the# clients where to look for the relocated document.# Format: Redirect old-URI new-URL### Directives controlling the display of server-generated directory listings.#&lt;IfModule mod_autoindex.c&gt;    #    # FancyIndexing is whether you want fancy directory indexing or standard    #    # Note, add the option TrackModified to the IndexOptions default list only    # if all indexed directories reside on NTFS volumes.  The TrackModified flag    # will report the Last-Modified date to assist caches and proxies to properly    # track directory changes, but it does _not_ work on FAT volumes.    #    IndexOptions FancyIndexing    #    # AddIcon* directives tell the server which icon to show for different    # files or filename extensions.  These are only displayed for    # FancyIndexed directories.    #    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip    AddIconByType (TXT,/icons/text.gif) text/*    AddIconByType (IMG,/icons/image2.gif) image/*    AddIconByType (SND,/icons/sound2.gif) audio/*    AddIconByType (VID,/icons/movie.gif) video/*    AddIcon /icons/binary.gif .bin .exe    AddIcon /icons/binhex.gif .hqx    AddIcon /icons/tar.gif .tar    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip    AddIcon /icons/a.gif .ps .ai .eps    AddIcon /icons/layout.gif .html .shtml .htm .pdf    AddIcon /icons/text.gif .txt    AddIcon /icons/c.gif .c    AddIcon /icons/p.gif .pl .py    AddIcon /icons/f.gif .for    AddIcon /icons/dvi.gif .dvi    AddIcon /icons/uuencoded.gif .uu    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl    AddIcon /icons/tex.gif .tex    AddIcon /icons/bomb.gif core    AddIcon /icons/back.gif ..    AddIcon /icons/hand.right.gif README    AddIcon /icons/folder.gif ^^DIRECTORY^^    AddIcon /icons/blank.gif ^^BLANKICON^^    #    # DefaultIcon is which icon to show for files which do not have an icon    # explicitly set.    #    DefaultIcon /icons/unknown.gif    #    # AddDescription allows you to place a short description after a file in    # server-generated indexes.  These are only displayed for FancyIndexed    # directories.    # Format: AddDescription &quot;description&quot; filename    #    #AddDescription &quot;GZIP compressed document&quot; .gz    #AddDescription &quot;tar archive&quot; .tar    #AddDescription &quot;GZIP compressed tar archive&quot; .tgz    #    # ReadmeName is the name of the README file the server will look for by    # default, and append to directory listings.    #    # HeaderName is the name of a file which should be prepended to    # directory indexes.     #    ReadmeName README.html    HeaderName HEADER.html    #    # IndexIgnore is a set of filenames which directory indexing should ignore    # and not include in the listing.  Shell-style wildcarding is permitted.    #    IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t&lt;/IfModule&gt;# End of indexing directives.## Document types.#&lt;IfModule mod_mime.c&gt;    #    # AddType allows you to tweak mime.types without actually editing it, or to    # make certain files to be certain types.    #    AddType application/x-tar .tgz    #    # AddEncoding allows you to have certain browsers uncompress    # information on the fly. Note: Not all browsers support this.    # Despite the name similarity, the following Add* directives have nothing    # to do with the FancyIndexing customization directives above.    #    AddEncoding x-compress .Z    AddEncoding x-gzip .gz .tgz    #    # If the AddEncoding directives above are commented-out, then you    # probably should define those extensions to indicate media types:    #    #AddType application/x-compress .Z    #AddType application/x-gzip .gz .tgz    #    # AddLanguage allows you to specify the language of a document. You can    # then use content negotiation to give a browser a file in a language    # it can understand.    #    # Note 1: The suffix does not have to be the same as the language    # keyword --- those with documents in Polish (whose net-standard    # language code is pl) may wish to use &quot;AddLanguage pl .po&quot; to    # avoid the ambiguity with the common suffix for perl scripts.    #    # Note 2: The example entries below illustrate that in quite    # some cases the two character &#39;Language&#39; abbreviation is not    # identical to the two character &#39;Country&#39; code for its country,    # E.g. &#39;Danmark/dk&#39; versus &#39;Danish/da&#39;.    #    # Note 3: In the case of &#39;ltz&#39; we violate the RFC by using a three char    # specifier. But there is &#39;work in progress&#39; to fix this and get    # the reference data for rfc1766 cleaned up.    #    # Danish (da) - Dutch (nl) - English (en) - Estonian (ee)    # French (fr) - German (de) - Greek-Modern (el)    # Italian (it) - Korean (kr) - Norwegian (no) - Norwegian Nynorsk (nn)    # Portugese (pt) - Luxembourgeois* (ltz)    # Spanish (es) - Swedish (sv) - Catalan (ca) - Czech(cs)    # Polish (pl) - Brazilian Portuguese (pt-br) - Japanese (ja)    # Russian (ru)    #    AddLanguage da .dk    AddLanguage nl .nl    AddLanguage en .en    AddLanguage et .ee    AddLanguage fr .fr    AddLanguage de .de    AddLanguage el .el    AddLanguage he .he    AddCharset ISO-8859-8 .iso8859-8    AddLanguage it .it    AddLanguage ja .ja    AddCharset ISO-2022-JP .jis    AddLanguage kr .kr    AddCharset ISO-2022-KR .iso-kr    AddLanguage nn .nn    AddLanguage no .no    AddLanguage pl .po    AddCharset ISO-8859-2 .iso-pl    AddLanguage pt .pt    AddLanguage pt-br .pt-br    AddLanguage ltz .lu    AddLanguage ca .ca    AddLanguage es .es    AddLanguage sv .sv    AddLanguage cs .cz .cs    AddLanguage ru .ru    AddLanguage zh-TW .zh-tw    AddCharset Big5         .Big5    .big5    AddCharset WINDOWS-1251 .cp-1251    AddCharset CP866        .cp866    AddCharset ISO-8859-5   .iso-ru    AddCharset KOI8-R       .koi8-r    AddCharset UCS-2        .ucs2    AddCharset UCS-4        .ucs4    AddCharset UTF-8        .utf8    # LanguagePriority allows you to give precedence to some languages    # in case of a tie during content negotiation.    #    # Just list the languages in decreasing order of preference. We have    # more or less alphabetized them here. You probably want to change this.    #    &lt;IfModule mod_negotiation.c&gt;        LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw    &lt;/IfModule&gt;    #    # AddHandler allows you to map certain file extensions to &quot;handlers&quot;,    # actions unrelated to filetype. These can be either built into the server    # or added with the Action command (see below)    #    # If you want to use server side includes, or CGI outside    # ScriptAliased directories, uncomment the following lines.    #    # To use CGI scripts:    # -&gt; descomentei esta!    AddHandler cgi-script .cgi    #    # To use server-parsed HTML files    #    #AddType text/html .shtml    #AddHandler server-parsed .shtml    #    # Uncomment the following line to enable Apache&#39;s send-asis HTTP file    # feature    #    #AddHandler send-as-is asis    #    # If you wish to use server-parsed imagemap files, use    #    #AddHandler imap-file map    #    # To enable type maps, you might want to use    #    #AddHandler type-map var&lt;/IfModule&gt;# End of document types.## Action lets you define media types that will execute a script whenever# a matching file is called. This eliminates the need for repeated URL# pathnames for oft-used CGI file processors.# Format: Action media/type /cgi-script/location# Format: Action handler-name /cgi-script/location### MetaDir: specifies the name of the directory in which Apache can find# meta information files. These files contain additional HTTP headers# to include when sending the document##MetaDir .web## MetaSuffix: specifies the file name suffix for the file containing the# meta information.##MetaSuffix .meta## Customizable error response (Apache style)#  these come in three flavors##    1) plain text#ErrorDocument 500 &quot;The server made a boo boo.#  n.b.  the single leading (&quot;) marks it as text, it does not get output##    2) local redirects#ErrorDocument 404 /missing.html#  to redirect to local URL /missing.html#ErrorDocument 404 /cgi-bin/missing_handler.pl#  N.B.: You can redirect to a script or a document using server-side-includes.##    3) external redirects#ErrorDocument 402 http://www.example.com/subscription_info.html#  N.B.: Many of the environment variables associated with the original#  request will *not* be available to such a script.## Customize behaviour based on the browser#&lt;IfModule mod_setenvif.c&gt;    #    # The following directives modify normal HTTP response behavior.    # The first directive disables keepalive for Netscape 2.x and browsers that    # spoof it. There are known problems with these browser implementations.    # The second directive is for Microsoft Internet Explorer 4.0b2    # which has a broken HTTP/1.1 implementation and does not properly    # support keepalive when it is used on 301 or 302 (redirect) responses.    #    BrowserMatch &quot;Mozilla/2&quot; nokeepalive    BrowserMatch &quot;MSIE 4\.0b2;&quot; nokeepalive downgrade-1.0 force-response-1.0    #    # The following directive disables HTTP/1.1 responses to browsers which    # are in violation of the HTTP/1.0 spec by not being able to grok a    # basic 1.1 response.    #    BrowserMatch &quot;RealPlayer 4\.0&quot; force-response-1.0    BrowserMatch &quot;Java/1\.0&quot; force-response-1.0    BrowserMatch &quot;JDK/1\.0&quot; force-response-1.0&lt;/IfModule&gt;# End of browser customization directives## Allow server status reports, with the URL of http://servername/server-status# Change the &quot;122.0.0.1&quot; to match your domain to enable.##&lt;Location /server-status&gt;#    SetHandler server-status#    Order deny,allow#    Deny from all#    Allow from 122.0.0.1#&lt;/Location&gt;## Allow remote server configuration reports, with the URL of# http://servername/server-info (requires that mod_info.c be loaded).# Change the &quot;122.0.0.1&quot; to match your domain to enable.##&lt;Location /server-info&gt;#    SetHandler server-info#    Order deny,allow#    Deny from all#    Allow from 122.0.0.1#&lt;/Location&gt;## There have been reports of people trying to abuse an old bug from pre-1.1# days.  This bug involved a CGI script distributed as a part of Apache.# By uncommenting these lines you can redirect these attacks to a logging # script on phf.apache.org.  Or, you can record them yourself, using the script# support/phf_abuse_log.cgi.##&lt;Location /cgi-bin/phf*&gt;#    Deny from all#    ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi#&lt;/Location&gt;### Section 3: Virtual Hosts## VirtualHost: If you want to maintain multiple domains/hostnames on your# machine you can setup VirtualHost containers for them. Most configurations# use only name-based virtual hosts so the server doesn&#39;t need to worry about# IP addresses. This is indicated by the asterisks in the directives below.## Please see the documentation at &lt;URL:http://www.apache.org/docs/vhosts/&gt;# for further details before you try to setup virtual hosts.## You may use the command line option &#39;-S&#39; to verify your virtual host# configuration.## Use name-based virtual hosting.##NameVirtualHost *:80## VirtualHost example:# Almost any Apache directive may go into a VirtualHost container.# The first VirtualHost section is used for requests without a known# server name.##&lt;VirtualHost *:80&gt;#    ServerAdmin webmaster@dummy-host.example.com#    DocumentRoot /www/docs/dummy-host.example.com#    ServerName dummy-host.example.com#    ErrorLog logs/dummy-host.example.com-error_log#    CustomLog logs/dummy-host.example.com-access_log common#&lt;/VirtualHost&gt;&lt;/pre&gt;&lt;p&gt;Please help, I am really in trouble here.&lt;p&gt;Thanks a lot&lt;p&gt;Andre&lt;p&gt;&lt;small&gt;&lt;b&gt;[href://?node_id=17558#readmore|Readmore]&lt;/b&gt; tags added by [GrandFather]&lt;/small&gt;&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>regex help please (sitnalta)</title>
    <link>http://prlmnks.org/html/580985.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580985.html</guid>

    <description>
        Hello all, I was banging my head on trying to get this one regular expresion to delete the following two examples completely.  &lt;p&gt;Here are two examples of the text I want to complete remove.  They all start with rcvtime and they all end with &lt;0a&gt;, but it MUST be the first &lt;0a&gt; and not the second.  Any ideas?&lt;p&gt;Example text:&lt;p&gt;rcvtime=2006102600322813316-sndtime=2006102600323042116-msgtext=FRM\3aMatd&lt;0a&gt;&lt;p&gt;rcvtime=2006102611373625516-sndtime=2006102611373640716-msgtext=FRM\3aRoxy&lt;0a&gt;&lt;p&gt;Thanks in advance i appreciate and tips and tricks.
    </description>
</item>

        

<item>
    <title>Multiline regex (mhearse)</title>
    <link>http://prlmnks.org/html/580983.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580983.html</guid>

    <description>
        I&#39;m trying to match multiple lines of text using a regular expression.  i.e.&lt;pre class=&quot;block_code&quot;&gt;body:Here is an example of amulti-line section of textthat I&#39;m trying to grab.attachment:&lt;/pre&gt;My code doesn&#39;t work:&lt;pre class=&quot;block_code&quot;&gt;if ($line =~ /^body: (.*)^attachment:/mi) { $vars{body} = $1; }&lt;/pre&gt;Can someone offer a solution?
    </description>
</item>

        

<item>
    <title>Returning a string from executable (Luken8r)</title>
    <link>http://prlmnks.org/html/580981.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580981.html</guid>

    <description>
        &lt;p&gt;Im sure this is an easy question, but since im a perl n00b, here it goes&lt;/p&gt;&lt;p&gt;I need to run an executable to my Ubuntu Linux box, get the status of something then use that status to fill out and if/else statement&lt;/p&gt;&lt;p&gt;This is what I have right now&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;my $enable_poe = `poe ds`; if ($enable_poe eq &#39;POE device missing or unpowered&#39;){print $enable_poe, &quot;\n&quot;, &quot;Your Poe IS NOT enabled, dummy\n&quot;;}elsif($enable_poe eq &#39;Device ID 2, Rev. 0&#39;){print $enable_poe, &quot;\n&quot;, &quot;Your PoE IS enabled, dummy\n&quot;;}else{print &quot;\nnothing happened\n&quot;;}&lt;/pre&gt;&lt;p&gt;when I run poe ds on the terminal it will either return&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;user@device:/tmp$ poe dsDevice ID 2, Rev. 0&lt;/pre&gt;&lt;p&gt;if the port is active or&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;POE device missing or unpowered&lt;/pre&gt;&lt;p&gt;if the device is missing&lt;/p&gt;&lt;p&gt;Whats happening is the print statement to return the value of $enable_poe is working, but the if/else conditions are not&lt;/p&gt;&lt;p&gt;In this case, if the poe ds command recognizes the unit and returns&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;Device ID 2, Rev. 0&lt;/pre&gt;&lt;p&gt;But the output of the script reads&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;Device ID 2, Rev. 0Your Poe IS NOT enabled, dummy&lt;/pre&gt;&lt;p&gt;so its returning the first print statement and not reading the&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;if ($enable_poe == &#39;POE device missing or unpowered&#39;)&lt;/pre&gt;&lt;p&gt;line&lt;/p&gt;&lt;p&gt;What am I doing incorrect here? I want the poe ds command to be read, then use what it returns in that if/else statement&lt;/p&gt;&lt;!-- Generated using PerlMonks editor version 001.000105 --&gt;&lt;p&gt;&lt;small&gt; &lt;b&gt;&lt;a href=&quot;?node_id=17558#codetags&quot;&gt;Code&lt;/a&gt;&lt;/b&gt; tags added by [GrandFather]&lt;/small&gt;&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>Using the alarm function in ActiveState Perl 5.8 for FileWatch (mantra2006)</title>
    <link>http://prlmnks.org/html/580972.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580972.html</guid>

    <description>
        Hello Monks&lt;p&gt;I got a perl script which looks for file in a directory for specified time and in between if file comes then the program &lt;br/&gt;quits saying file has come and if not comes out with a message after the specified time file hasn&#39;t come...this script was written in 1996 in perl using alarm function...but the latest versions of perl Active State 5.8 doesn&#39;t seem to implement alarm function...what will be the approach to this problem because our systems are upgraded with latest perl version and this script no longer works..&lt;p&gt;Appreciate any help in this regard&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;alarm($endsecs);local $SIG{&#39;ALRM&#39;}=&quot;TimeOut&quot;;print STDOUT &quot;*** FileWatch is waiting...\n&quot;;&lt;/pre&gt;&lt;!-- Node text goes above. Div tags should contain sig only --&gt;&lt;div class=&quot;pmsig&quot;&gt;&lt;div class=&quot;pmsig-562697&quot;&gt;Thanks &amp; Regards&lt;br/&gt;Sridhar&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;small&gt;2006-10-28 Retitled by [GrandFather], as per Monastery [id://341118|guidelines] &lt;br /&gt;Original title: &#39;FileWatch&#39;&lt;/small&gt;&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>Modifying a regex (seni)</title>
    <link>http://prlmnks.org/html/580965.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580965.html</guid>

    <description>
        Hello Everyone,I am pretty new to Perl, but have been doing some independent learning.  I am working on a project in which I am trying to parse through some data. But, I have gotten stuck on what seems to be an easy problem to fix, except I don&#39;t know how! :) I am trying to use the following code, but now my user IDs actually have NA in the front of them (ie. NA12324).  How can I either: do a step before this to remove the NA, OR get this code to accept this sort of ID?  I hope this makes sense...thanks in advance!&lt;pre class=&quot;block_code&quot;&gt;#!/usr/bin/perluse strict;my $inFile = &#39;fanca.txt&#39;;open (IN, $inFile) or die &quot;open $inFile: $!&quot;;my %user;while (my $line = &lt;IN&gt;) {next unless $line =~ m{^(\S+) (\d+) (.*)};my ($site, $userID, $data, $data2) = ($1, $2, $3, $4);$user{$userID}{$site} = $data, $data2;}close(IN) or die &quot;close $inFile: $!&quot;;my $outfile = &quot;parsingoutput_for_fanca.txt&quot;;open(REPORT, &quot;&gt;$outfile&quot;) or die &quot;open &gt;$outfile: $!&quot;;foreach my $userID (sort {$a &lt;=&gt; $b} keys %user) {my %sites = %{$user{$userID}};my $line1 =  &#39;SITES&#39;;my $line2 = &quot;$userID&quot;;while (my ($site, $data, $data2) = each %sites) {$line1 .= &#39; &#39; x (length($line2)-length($line1));$line2 .= &#39; &#39; x (length($line1)-length($line2));#add on next site$line1 .= &#39; &#39;. &#39; &#39; . $site;$line2 .= &#39; &#39;. &#39; &#39;. $data . &#39; &#39; . &#39; &#39;. $data2;}print REPORT $line1 . &quot;\n&quot;;print REPORT $line2 . &quot;\n&quot;;print REPORT &quot;\n&quot;;}close (REPORT) or die &quot;close $outfile: $!&quot;;&lt;/pre&gt;&lt;p&gt;&lt;small&gt;2006-10-28 Retitled by [GrandFather], as per Monastery [id://341118|guidelines] &lt;br /&gt;Original title: &#39;Should be easy....&#39;&lt;/small&gt;&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>Perl/Tk and threads on Win32 (jdtoronto)</title>
    <link>http://prlmnks.org/html/580963.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580963.html</guid>

    <description>
        Esteemed monks,&lt;p&gt;It seems to have been repeated often here and elsewhere that the current Tk implementation is not thread safe and that the threads implementation is not really friendly with Tk, at least on Win32. Yet in &lt;a href=&quot;/out/node/470827&quot;&gt;470827&lt;/a&gt; which is referred to this morning in &lt;a href=&quot;/out/node/580915&quot;&gt;580915&lt;/a&gt; we have a suggestion to use &lt;tt class=&quot;inline_code&quot;&gt;threads&lt;/tt&gt; in Win32 with Tk.&lt;p&gt;&lt;ul&gt;&lt;li&gt;Just how safe is this?&lt;/li&gt;&lt;li&gt;Are there any simple tricks that facilitate the use of threads with Tk in Win32?&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;a href=&quot;/out/node/jdtoronto&quot;&gt;jdtoronto&lt;/a&gt;
    </description>
</item>

        

<item>
    <title>Perl on a bootable USB key (carcassonne)</title>
    <link>http://prlmnks.org/html/580961.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580961.html</guid>

    <description>
        Folks,&lt;p&gt;I&#39;d like to install perl on a bootable USB key (512 MB).  Thedirectory where it&#39;ll reside will be, once the USB key has bootedand is mounted, /usr/lib/perl5/.  The files will be on the USBkey, not inside the initrd.  The initrd will mount the USB keyand /usr/lib/perl5/ will be linked to the files on the key.&lt;p&gt;What&#39;s the best way to do that ?  I thought of copying that perl5directory off SuSE 10.0 to the USB key, and then using the sameSuSE 10.0 kernel.&lt;p&gt;Any suggestions/ideas appreciated.&lt;p&gt;Thanks.
    </description>
</item>

        

<item>
    <title>Converting odt to html (Outaspace)</title>
    <link>http://prlmnks.org/html/580959.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580959.html</guid>

    <description>
        Hello fellow Monks,&lt;br&gt;&lt;br&gt;I have wondered if anyone has expirience with the OpenOffice Modul. I want to transform all my odt Files in a Directory to html Files. Does anyone know how this can be done?&lt;br&gt;So far I have:&lt;pre class=&quot;block_code&quot;&gt;foreach my $szFile (@szFiles) {print &quot;Converting $szFile\n&quot;;my $hOOFile = OpenOffice::OODoc::File-&gt;new($szFile);$szFile =~ s/\.odt$/.html/;# MISSING odt -&gt; html conversion$hOOFile-&gt;save($szSearchInFile);}&lt;/pre&gt;&lt;br&gt;Andre
    </description>
</item>

        

<item>
    <title>Misbehaving typeglob (Ovid)</title>
    <link>http://prlmnks.org/html/580949.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580949.html</guid>

    <description>
        &lt;p&gt;Can anyone tell me why the following prints out both &lt;tt&gt;SCALAR&lt;/tt&gt; and &lt;tt&gt;CODE&lt;/tt&gt;?  What am I missing?&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;#!/usr/bin/perl -luse strict;use warnings;{    package Foo;    sub bar {};}foreach my $type ( qw&lt;SCALAR ARRAY HASH CODE IO FORMAT&gt; ) {    print $type if defined *Foo::bar{$type};}&lt;/pre&gt;&lt;p&gt;I only want that to print &lt;tt&gt;CODE&lt;/tt&gt;.  How do I fix it?&lt;/p&gt;&lt;!-- Node text goes above. Div tags should contain sig only --&gt;&lt;div class=&quot;pmsig&quot;&gt;&lt;div class=&quot;pmsig-17000&quot;&gt;&lt;p&gt;Cheers,&lt;br /&gt;&lt;a href=&quot;/index.pl?node=Ovid&amp;lastnode_id=1072&quot;&gt;Ovid&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;small&gt;New address of &lt;a href=&quot;http://users.easystreet.com/ovid/cgi_course/&quot;&gt;my CGI Course&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
    </description>
</item>

        

<item>
    <title>404 to Apache (artist)</title>
    <link>http://prlmnks.org/html/580948.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580948.html</guid>

    <description>
        Using CGI.pm, I can redirect to a &#39;filenotfound.htm&#39; file for 404 message, along with status &quot;404 Not found&quot;. Now, instead of specifiying the file name from Perl program, I like to use whichever &#39;404 file&#39; specified in Apache Server&#39;s httpd.conf.How do I accomplish this?  I am not using any &#39;Apache::&#39; modules.  &lt;p&gt;Thanks,&lt;div class=&quot;pmsig&quot;&gt;&lt;div class=&quot;pmsig-72806&quot;&gt;--Artist&lt;/div&gt;&lt;/div&gt;
    </description>
</item>

        

<item>
    <title>which module support to connect SQLServer (shanthiann)</title>
    <link>http://prlmnks.org/html/580939.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580939.html</guid>

    <description>
        hi perl monks,I tried to connect SQL server through DBI.pm .&lt;br&gt;But iam unable to connect ,which module support to connect to Sql Server&lt;BR&gt;Regards,&lt;BR&gt;Shanthi
    </description>
</item>

        

<item>
    <title>Profiling a large program (keymon)</title>
    <link>http://prlmnks.org/html/580931.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580931.html</guid>

    <description>
        Dear Monks,&lt;br&gt;&lt;p&gt;I come here seeking some tips on how to profile a rather large piece of Perl code, with 100s of classes, etc. which runs under Apache using modperl. This is an internal application that has grown over the years, and now threatens to eat everyone alive (ok, not really :) ). It is slow, and there are severe memory leaks. I would like to figure out what are the most time-consuming methods, and where&#39;s the memory being leaked. &lt;P&gt;If it were standalone, I could use DProf and slog my way through that. But are there any better ways? &lt;P&gt;Consider for example the memory leaks. Is there a way to dump out the allocated objects periodically, and see which ones are not being freed? &lt;P&gt;As for runtime: is there a way to add instrumentation at the very low level (instead of modifying each method in each class, one by one) to get a list of the top resource hogs?&lt;P&gt;Your help, advice and perls(!) of wisdom would be greatly appreciated. 
    </description>
</item>

        

<item>
    <title>Using the result from XML::XQL::solve (adrianxw)</title>
    <link>http://prlmnks.org/html/580916.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580916.html</guid>

    <description>
        Hi,&lt;p&gt;I want to publish a small subset of data held in a large compressed XML file residing on a remote Linux server, in a CGI script. The CGI stuff is trvial once I have the data in a standard form.&lt;p&gt;I have written enough to get the file from the server, and expand it so that I have the full XML in a memory buffer. In principle, I can now extract the necessary with stuff I know.&lt;p&gt;Having browsed W3C, it seemed like XQL may be a good way to go however. So I&#39;ve loaded the buffer into a DOM, (I am sure this has worked as when I do a test $dom-&gt;printToFile with a gash filename, it produces a file with the correct contents).&lt;p&gt;I have past a simple test XQL statement to XML::XQL::solve. I don&#39;t know if this has worked however. I get no error, but neither do I know what to do with the result. The docs say it returns a @list, but not what of! I&#39;ve googled about, browsed various sites which all seem to be mirroring the same stuff, even the pod that is inside the package doesn&#39;t help.&lt;p&gt;Ultimately, what I&#39;d like to do is extract the very few XML items I am interested in into a smaller DOM, then use some more XQL to extract and load these items and a few of their child items into a simple tab seperated $string to pass to an existing sub-system for processing prior to use in the CGI.&lt;p&gt;Yes, I could do it the old way, but I&#39;m intruiged to get this XQL interface working. What is that @list, and how can I progress this? Input gladly accepted.Thanks.&lt;p&gt;&lt;small&gt;2006-10-28 Retitled by &lt;a href=&quot;/out/node/GrandFather&quot;&gt;GrandFather&lt;/a&gt;, as per Monastery &lt;a href=&quot;/out/id/341118&quot;&gt;guidelines&lt;/a&gt; &lt;br /&gt;Original title: &#39;XML::XQL::solve&#39;&lt;/small&gt;&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>Tk GUI and Listen? (Anonymous Monk)</title>
    <link>http://prlmnks.org/html/580915.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580915.html</guid>

    <description>
        I&#39;m having a performance issue updating my Tk app.  I&#39;ve simplified the code examples for my scenario, but basically I have a windows Tk app the launches an external program and this program continually writes all of it&#39;s output to a text file until it completes. (To emulate this you can run the first block of code, write.pl).  &lt;p&gt;After the Tk app has launched this program it sits idle listening for new ouput and updates the GUI accordingly (To emulate this you can run the second block of code, capture.pl and push the &quot;Listen&quot; button).  I have two issues really, the first is that using the nowait flag in File::Tail causes the CPU to be hammered, but I need the method to be non-blobking so the user can still interact with the GUI.  My second issue is that after the method is called, it takes several (maybe 5) seconds for the method to start tailing the file.  I hope I&#39;ve simplified this enough for it to make sense so you can see my issue.  Maybe using File::Tail isn&#39;t the best way to go...any help would be greatly appreiciated.&lt;p&gt;# write.pl&lt;pre class=&quot;block_code&quot;&gt;use strict;use warnings;use IO::Handle;open(WRITE, &quot;&gt;&gt;C:\\File\\test.dat&quot;);WRITE-&gt;autoflush(1);my $num = 1;while(1) {    print &quot;$num\n&quot;;    print WRITE &quot;Some new text $num\n&quot;;    # using sleep to try and emulate the speed of the actual program    sleep 1;    $num ++;}    close WRITE;&lt;/pre&gt;&lt;p&gt;# capture&lt;pre class=&quot;block_code&quot;&gt;use strict;use warnings;use Tk;use File::Tail;my $mw;my $name = &#39;C:\File\test.dat&#39;;my $message; init_ui();MainLoop;sub init_ui {    $mw = MainWindow-&gt;new( -title =&gt; &#39;Test&#39; );    $mw-&gt;resizable( 0, 0 );    my $top = $mw-&gt;Frame(    )-&gt;pack( -side =&gt; &#39;top&#39;, -expand =&gt; &#39;1&#39;, -fill =&gt; &#39;both&#39; );   my $button1 = $top-&gt;Button( -text =&gt; &quot;Listen&quot;, -width =&gt; &#39;10&#39;,    -command =&gt; sub { file_listen(); }   )-&gt;pack( -side =&gt; &#39;left&#39;);   my $button2 = $top-&gt;Button( -text =&gt; &quot;Button2&quot;, -width =&gt; &#39;10&#39;   )-&gt;pack( -side =&gt; &#39;left&#39;);    my $bottom = $mw-&gt;Frame(    )-&gt;pack( -side =&gt; &#39;top&#39;, -expand =&gt; &#39;1&#39;, -fill =&gt; &#39;both&#39; );    my $status = $bottom-&gt;Label( -textvariable =&gt; \$message,)-&gt;pack( -side =&gt; &#39;left&#39; );}sub file_listen {    $message = &#39;Listening ... &#39;;    $mw-&gt;update;    my $file=File::Tail-&gt;new(name=&gt;$name, nowait=&gt;1);    while (defined(my $line=$file-&gt;read)) {if ($line =~ /\d+/) {    chomp($line);    $message = $line;}$mw-&gt;update;    }}&lt;/pre&gt;
    </description>
</item>

        

<item>
    <title>extract jpg from binary file (wertert)</title>
    <link>http://prlmnks.org/html/580914.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580914.html</guid>

    <description>
        Hi all&lt;p&gt;I&#39;ve been asked to write something to pull jpg/jfif files out of a binary file.  I&#39;ve had some limited success with my hex editor and I want to try it in perl.  From my reading the picture stream starts withs 0xFFD8 and ends with 0xFFD9.  The idea is that if I can pull everything out from between these markers we should have a valid jpeg image.  I also suspect there are multiple jpegs within the binary file and they also each contain a thumbnail.&lt;p&gt;So my first question is can anyone point me in the right direction for extracting a block out of a binary file between 2 markers ?  Once I get this working I think it should be quite straight forward.&lt;p&gt;Thanks in advance&lt;p&gt;wert
    </description>
</item>

        

<item>
    <title>sharing a socket between two threads (win32) (danmcb)</title>
    <link>http://prlmnks.org/html/580907.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580907.html</guid>

    <description>
        &lt;p&gt;Hi&lt;/p&gt;&lt;p&gt;My problem is to write a server script which processes incoming queries and responds to them in the usual way ... but also runs a periodic &quot;report&quot; function where it talks back at the client of its own accord. The report code is therefore a seperate thread.&lt;/p&gt;&lt;p&gt;The problem is that I don&#39;t find a way to allow the main and reporting threads to both talk back at the client. What seems to happen is that when I hasve the &quot;write to socket&quot; happening in both threads, they block each other in odd ways. (The report lines seem to appear after the first char of a client line is entered.) &lt;/p&gt;&lt;p&gt;This may be only a win32 problem, haven&#39;t tried on linux yet.&lt;/p&gt;&lt;p&gt;Here&#39;s my first attempt:&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;use strict;use warnings;use threads;use IO::Socket qw(:DEFAULT :crlf);use Time::HiRes qw( usleep );my $sock = new IO::Socket::INET (LocalAddr =&gt; &quot;localhost&quot;,                                 LocalPort =&gt; 1000,                                 Proto =&gt; &#39;tcp&#39;,                                 Listen =&gt; 1,                                 Reuse =&gt; 1);my $SOCK;sub sockout{    my $r = shift;    print $SOCK &quot;$r\r\n&quot;;}sub chatter{    while (1){        usleep(1000 * 1000);        sockout &quot;talkin to myself ...&quot;;    }}$SOCK = $sock-&gt;accept();my $thread = threads-&gt;create(\&amp;chatter);sockout(&quot;CONNECTED!&quot;);while (my $line = &lt;$SOCK&gt;){    sockout(&quot;You said &quot;.$line);}&lt;/pre&gt;&lt;p&gt;One suggestion that has been made is to use a queue. I tried, same problem. Here it is:&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;use strict;use warnings;use threads;use Thread::Queue;use IO::Socket qw(:DEFAULT :crlf);use Time::HiRes qw( usleep );my $sock = new IO::Socket::INET (LocalAddr =&gt; &quot;localhost&quot;,                                 LocalPort =&gt; 1000,                                 Proto =&gt; &#39;tcp&#39;,                                 Listen =&gt; 1,                                 Reuse =&gt; 1);my $SOCK;my $rq;sub sockout{    my $r = shift;    print $SOCK &quot;$r\r\n&quot;;}sub chatter{    while (1){        usleep(1000 * 1000);        sockout &quot;talkin to myself ...&quot;;    }}sub reply_thread{    while (1){        while ($rq-&gt;pending){            print &quot;rt pr\n&quot;;            print $SOCK $rq-&gt;dequeue;        };        usleep(1000 * 100);    }}$SOCK = $sock-&gt;accept();$rq = new Thread::Queue;my $reply_thread = threads-&gt;create(\&amp;reply_thread);my $chatter_thread = threads-&gt;create(\&amp;chatter);sockout(&quot;CONNECTED!&quot;);while (my $line = &lt;$SOCK&gt;){    sockout(&quot;You said &quot;.$line);}&lt;/pre&gt;&lt;p&gt;Any ideas?&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>Replacing new lines and tab spaces using a regular expression (sanku)</title>
    <link>http://prlmnks.org/html/580901.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580901.html</guid>

    <description>
        hi,how to replace new lines and tab spaces in a paragraph of text,to make it  a single line.thanks in advance,&lt;p&gt;&lt;small&gt;2006-10-28 Retitled by &lt;a href=&quot;/out/node/GrandFather&quot;&gt;GrandFather&lt;/a&gt;, as per Monastery &lt;a href=&quot;/out/id/341118&quot;&gt;guidelines&lt;/a&gt; &lt;br /&gt;Original title: &#39;doubt in Regular Expression&#39;&lt;/small&gt;&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>Coverage queries (jbert)</title>
    <link>http://prlmnks.org/html/580889.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580889.html</guid>

    <description>
        Hi there. I&#39;m using the (excellent) Devel::Cover module to see how much of an existing codebase I am exercising with some testing.&lt;p&gt;I&#39;m actually interested in exercising all calls to a particular subroutine. This information might already be present in Devel::Cover somewhere (since it can provide a line-by-line breakdown), but what I really want is a tool which reads a Devel::Cover database and tells me how many of the call sites of sub X have been covered and is able to list the ones which have not.&lt;p&gt;Has anyone seen anything which can do this? Does anyone know enough about the internals of Devel::Cover already to give me an impression about whether it would be possible/reasonable for me to dig in and add the functionality?&lt;p&gt;Or am I missing a big piece of what I need, namely the ability to go from perl file&amp;line (source code info) to parsed syntax tree (all callers of sub X)?&lt;p&gt;(One way it seems would work is to statically analyse the codebase to get file&amp;line of all call sites and then somehow parse the Devel::Cover reports to see if those are covered, but that involves trying to recover information from the human-readable reporting format - surely there is a better way?)
    </description>
</item>

        

<item>
    <title>How to call a perl prg with options from within another ? (Bucchi)</title>
    <link>http://prlmnks.org/html/580884.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580884.html</guid>

    <description>
        Hi All,     I tried calling a perl prg with options from within another like:   &lt;pre class=&quot;block_code&quot;&gt;    eval { require &quot;run_gql.pl -h -p &quot;};           if ($? == -1) {        print &quot;Failed to execute: $!\n&quot;;      }    elsif ($? &amp; 127) {printf &quot;\nChild died with signal %d, %s coredump\n&quot;,    ($? &amp; 127),  ($? &amp; 128) ? &#39;with&#39; : &#39;without&#39;;    }    else {printf &quot;\nChild exited with value %d\n&quot;, $? &gt;&gt; 8;    }  &lt;/pre&gt;     Here -h and -p are my prg options. Now is this correct?? Please help....Thanks for your help.
    </description>
</item>

        

<item>
    <title>Faster than soap ? (jeteve)</title>
    <link>http://prlmnks.org/html/580882.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580882.html</guid>

    <description>
        Wise monks,&lt;p&gt; I&#39;m currently using SOAP::Lite to make calls between different component of my application.&lt;/p&gt;&lt;p&gt;I use SOAP::Lite under mod_perl/apache&lt;/p&gt;&lt;p&gt;My usefull server side function call take something like 10ms to execute. But the SOAP communication layer introduce an overhead of something like 300ms ..&lt;/p&gt;&lt;p&gt;SOAP is definitely great to easily expose an API to the world. But internally, I&#39;m wondering if something as simple and more performant could exist.&lt;/p&gt;&lt;p&gt;My Ideal module (which I may write if it doesn&#39;t exist ..) would have those features:&lt;/p&gt;&lt;ul&gt; &lt;li&gt;Be as easy to use as SOAP::Lite&lt;/li&gt; &lt;li&gt;Be only dedicated to perl &lt;-&gt; perl communication&lt;/li&gt; &lt;li&gt;Be a lot faster than soap, using something like Data::Dumper / eval for data marshalling/unmarshalling&lt;/ul&gt;&lt;p&gt; Any idea ?&lt;/p&gt;&lt;p&gt; Thanks for your emlightments.&lt;/p&gt;&lt;!-- Node text goes above. Div tags should contain sig only --&gt;&lt;div class=&quot;pmsig&quot;&gt;&lt;div class=&quot;pmsig-358002&quot;&gt;&lt;p&gt;-- &lt;em&gt;Nice photos of naked perl sources &lt;a href=&quot;http://www.eteve.net/&quot;&gt;here&lt;/a&gt; !&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;
    </description>
</item>

        

<item>
    <title>DBIx::Class issues : -&gt;load_classes()? (dhoss)</title>
    <link>http://prlmnks.org/html/580869.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580869.html</guid>

    <description>
        &lt;p&gt;Hallowed monks,&lt;/p&gt;&lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt;As per &lt;a href=&quot;/out/node/CountZero&quot;&gt;CountZero&lt;/a&gt;&#39;s advice, I moved &lt;tt class=&quot;inline_code&quot;&gt;use Notes::DBI&lt;/tt&gt; into &lt;tt class=&quot;inline_code&quot;&gt;cgiapp_init&lt;/tt&gt;, wrapped it in an &lt;tt class=&quot;inline_code&quot;&gt;eval&lt;/tt&gt; and used &lt;tt class=&quot;inline_code&quot;&gt;require&lt;/tt&gt; and returned &lt;tt class=&quot;inline_code&quot;&gt;$@&lt;/tt&gt;  What I got was this:&lt;pre class=&quot;block_code&quot;&gt;Error executing class callback in init stage: DBIx::Class::Schema::load_classes(): DBIx::Class::Relationship::BelongsTo::belongs_to(): Can&#39;t locate Notes/DBI/User.pm in @INC (@INC contains: /usr/lib/perl5/5.8.7/i686-linux /usr/lib/perl5/5.8.7 /usr/lib/perl5/site_perl/5.8.7/i686-linux /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .) at (eval 53) line 3.&lt;/pre&gt;. Long story short, &lt;tt class=&quot;inline_code&quot;&gt;Notes::DBI::User.pm&lt;/tt&gt; was named &lt;tt class=&quot;inline_code&quot;&gt;Notes::DBI::Users.pm&lt;/tt&gt;, thus throwing &lt;a href=&quot;/out/cpan/DBIx::Class&quot;&gt;DBIx::Class&lt;/a&gt; into a tizzy and causing all sorts of trouble.  /me thinks it would be nice to have some method (aside from wrapping it in eval, as that would be used when expecting a possible error in this case)to make this return an error in such a way that CGI scripts don&#39;t completely &lt;tt class=&quot;inline_code&quot;&gt;die&lt;/tt&gt; when this type of error is thrown...&lt;/p&gt;&lt;p&gt;I&#39;m at my wits end.  I&#39;m using &lt;a href=&quot;/out/cpan/DBIx::Class&quot;&gt;DBIx::Class&lt;/a&gt; and it seems to be hanging up at &lt;tt class=&quot;inline_code&quot;&gt;__PACKAGE__-&gt;load_classes()&lt;/tt&gt;. I think.  When I take &lt;tt class=&quot;inline_code&quot;&gt;use Notes::DBI&lt;/tt&gt; (my main schema class) out of my code, my code runs fine.  As far as I can tell, I&#39;ve narrowed it down to &lt;tt class=&quot;inline_code&quot;&gt;__PACKAGE__-&gt;load_classes()&lt;/tt&gt;, the only error i get is a &quot;premature end of script headers&quot; error (using [cpan://CGI::Application], along with an assortment of config modules, etc.) &lt;/p&gt;&lt;p&gt;This near exact same code works fine for another web app i&#39;m working on, so i&#39;m stumped.&lt;/p&gt;&lt;p&gt;Here&#39;s the code:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;p&gt;Notes.pm:&lt;/p&gt;&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;package Notes;&lt;/pre&gt;&lt;pre class=&quot;block_code&quot;&gt;use strict;use base &#39;CGI::Application&#39;;use Notes::DBI;use CGI::Session;use CGI::Application::Plugin::TT; # for template toolkit supportuse Config::Simple;#use CGI::Application::Plugin::Config::Simple; # for Config::Simple support;#use CGI::Session;use CGI::Carp qw[fatalsToBrowser]; #DEBUG ONLY&lt;/pre&gt;&lt;pre class=&quot;block_code&quot;&gt;...&lt;/pre&gt;&lt;pre class=&quot;block_code&quot;&gt;sub main {my $self = shift;my $config = Config::Simple-&gt;new(&quot;conf/notes.conf&quot;);my $session = CGI::Session-&gt;load(&quot;driver:File&quot;, $self-&gt;query, { Directory =&gt; $config-&gt;param(&#39;session_directory&#39;) } )          or CGI::Session-&gt;new(&quot;driver:File&quot;, $self-&gt;query, { Directory =&gt; $config-&gt;param(&#39;session_directory&#39;) } )         or die CGI::Session-&gt;errstr;### get a db connectionmy $schema = Note::DBI-&gt;connect($config-&gt;param(&#39;db_data_source&#39;),                                     $config-&gt;param(&#39;db_username&#39;),                                     $config-&gt;param(&#39;db_password&#39;),                                     { RaiseError =&gt; 1, AutoCommit =&gt; 1 });my @all_notes = $schema-&gt;resultset(&#39;Notes&#39;)-&gt;all; ### create a query for @usernotes, does not actually### execute querymy $user_notes = $schema-&gt;resultset(&#39;User&#39;)-&gt;search(      { username =&gt; $session-&gt;param(&#39;username&#39;) }    );# Get all the user&#39;s notes    my @all_user_notes = $user_notes-&gt;search_related(&#39;notes&#39;)-&gt;all;return $self-&gt;tt_process(&#39;main.tt&#39;, { c        =&gt; $self-&gt;query, s        =&gt; $session, #a_notes  =&gt; \@all_notes,  #u_notes  =&gt; \@all_user_notes, title    =&gt; &#39;Notes Home&#39; });}&lt;/pre&gt;&lt;p&gt;Notes::DBI (main schema class):&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;package Notes::DBI;use strict;use base qw/DBIx::Class::Schema/;&lt;/pre&gt;&lt;pre class=&quot;block_code&quot;&gt;__PACKAGE__-&gt;load_classes();  ## hopefully won&#39;t slow things down&lt;/pre&gt;&lt;pre class=&quot;block_code&quot;&gt;1;&lt;/pre&gt;&lt;p&gt;Notes::DBI::User (user table class)&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;package Notes::DBI::Users;use base qw/DBIx::Class/;__PACKAGE__-&gt;load_components(qw/ PK::Auto Core /);&lt;/pre&gt;&lt;pre class=&quot;block_code&quot;&gt;__PACKAGE__-&gt;table(&#39;users&#39;);__PACKAGE__-&gt;add_columns(qw/ userid username password create_date last_here emailnotes_are_private/);__PACKAGE__-&gt;set_primary_key(&#39;userid&#39;);__PACKAGE__-&gt;has_many( notes =&gt; &#39;Notes::DBI::Notes&#39;);1;&lt;/pre&gt;&lt;p&gt;Notes::DBI::Notes (notes table class):&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;package Notes::DBI::Notes;use base qw/DBIx::Class/;&lt;/pre&gt;&lt;pre class=&quot;block_code&quot;&gt;__PACKAGE__-&gt;load_components(qw/ PK::Auto Core /);__PACKAGE__-&gt;table(&#39;notes&#39;);__PACKAGE__-&gt;add_columns(qw/ noteid datenumbercontentuser privateclass/);__PACKAGE__-&gt;set_primary_key(&#39;noteid&#39;);__PACKAGE__-&gt;belongs_to( user =&gt; &#39;Notes::DBI::User&#39;);&lt;/pre&gt;&lt;pre class=&quot;block_code&quot;&gt;1;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;I&#39;m spent. Tell me if this is completely idiotic and I&#39;m missing something right in front of my face, or if it&#39;s an actual issue. &lt;/p&gt;&lt;!-- Generated using PerlMonks editor version 001.000105 --&gt;&lt;!-- Node text goes above. Div tags should contain sig only --&gt;&lt;div class=&quot;pmsig&quot;&gt;&lt;div class=&quot;pmsig-203787&quot;&gt;&lt;i&gt;meh.&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;
    </description>
</item>

        

<item>
    <title>calling CGI script from outside server (yelekeri)</title>
    <link>http://prlmnks.org/html/580859.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580859.html</guid>

    <description>
        All,  does anyboady have info about how to call a CGI script (for that matter, any weblink) from a perl program. From the perl script, lets say I need to call a hyperlink and get read the display output of that hyperlink. How exactly it can be done, which modules I could use for this purpose. Appreciate your replies. -yelekeri
    </description>
</item>

        

<item>
    <title>Subversion: last change author (water)</title>
    <link>http://prlmnks.org/html/580854.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580854.html</guid>

    <description>
        Hi -- &lt;p&gt;I am looking for a way from w/in a perl program to determine, for a given file in a subversion repository, the last person who committed a change to that file.Any suggestions or module recommendations much appreciated.&lt;p&gt;Thanks!&lt;p&gt;&lt;a href=&quot;/out/node/water&quot;&gt;water&lt;/a&gt;
    </description>
</item>

        

<item>
    <title>regex issues with /gc in log analysis... (EvanK)</title>
    <link>http://prlmnks.org/html/580852.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580852.html</guid>

    <description>
        i&#39;m writing a log parser, and am trying to optimize the way i match valid entries in the logfile.  its a logfile for a multiplayer fps (&lt;a href=&quot;http://www.whatisfear.com/&quot;&gt;F.E.A.R.&lt;/a&gt;), and its not as simple as most logs ive worked with, because the data i want (info for a given player after each round) spans multiple lines.  this is a sample log for a single game:&lt;pre class=&quot;block_code&quot;&gt;[Thu Sep 21 17:48:38 2006] [Thu Sep 21 17:48:38 2006] ------------------------------------------[Thu Sep 21 17:48:38 2006] Server started.[Thu Sep 21 18:37:22 2006] Client connected: Alpha[Thu Sep 21 18:37:31 2006] Client connected: Bravo[Thu Sep 21 18:38:20 2006] Client connected: Charlie[Thu Sep 21 18:39:18 2006] Client connected: Delta[Thu Sep 21 18:53:36 2006] [Thu Sep 21 18:53:36 2006] *** Results for Map: Worlds\ReleaseMultiplayer\Bypass[Thu Sep 21 18:53:36 2006] [Thu Sep 21 18:53:36 2006] Team: Team 1[Thu Sep 21 18:53:36 2006] Score: 93[Thu Sep 21 18:53:36 2006] [Thu Sep 21 18:53:36 2006] Player: Alpha (uid: ad7023b7f46271acd31e1bd287613b6d)[Thu Sep 21 18:53:36 2006] Score: 55[Thu Sep 21 18:53:36 2006] Kills: 14[Thu Sep 21 18:53:36 2006] Deaths: 15[Thu Sep 21 18:53:36 2006] Team Kills: 0[Thu Sep 21 18:53:36 2006] Suicides: 0[Thu Sep 21 18:53:36 2006] Objective: 0[Thu Sep 21 18:53:36 2006] [Thu Sep 21 18:53:36 2006] Player: Bravo (uid: 5fdcc95043dc4dac9d7b4afb8469eb4f)[Thu Sep 21 18:53:36 2006] Score: 38[Thu Sep 21 18:53:36 2006] Kills: 11[Thu Sep 21 18:53:36 2006] Deaths: 17[Thu Sep 21 18:53:36 2006] Team Kills: 0[Thu Sep 21 18:53:36 2006] Suicides: 0[Thu Sep 21 18:53:36 2006] Objective: 0[Thu Sep 21 18:53:36 2006] [Thu Sep 21 18:53:36 2006] Team: Team 2[Thu Sep 21 18:53:36 2006] Score: 135[Thu Sep 21 18:53:36 2006] [Thu Sep 21 18:53:36 2006] Player: Charlie (uid: e94839cae76debf1418ab9dfaa4c01e8)[Thu Sep 21 18:53:36 2006] Score: 61[Thu Sep 21 18:53:36 2006] Kills: 15[Thu Sep 21 18:53:36 2006] Deaths: 14[Thu Sep 21 18:53:36 2006] Team Kills: 0[Thu Sep 21 18:53:36 2006] Suicides: 0[Thu Sep 21 18:53:36 2006] Objective: 0[Thu Sep 21 18:53:36 2006] [Thu Sep 21 18:53:36 2006] Player: Delta (uid: b2ea959c1b3fa5c35ef6a6e576cdf2af)[Thu Sep 21 18:53:36 2006] Score: 46[Thu Sep 21 18:53:36 2006] Kills: 10[Thu Sep 21 18:53:36 2006] Deaths: 4[Thu Sep 21 18:53:36 2006] Team Kills: 0[Thu Sep 21 18:53:36 2006] Suicides: 0[Thu Sep 21 18:53:36 2006] Objective: 0[Thu Sep 21 18:53:36 2006] [Thu Sep 21 18:53:36 2006] [Thu Sep 21 18:57:47 2006] Client disconnected: Delta[Thu Sep 21 18:58:01 2006] Client disconnected: Alpha[Thu Sep 21 18:58:17 2006] Client disconnected: Bravo[Thu Sep 21 18:59:03 2006] Client disconnected: Charlie&lt;/pre&gt;big and unwieldy, i know, and this is just one round.  i have a real logfile that spans about a month, its huuuuuge.  now, i have a working parser for it, using a search &amp; replace regex that &#39;nibbles&#39; away at the log:&lt;p&gt;&lt;b&gt;note:&lt;/b&gt; since the server may be windows or linux, i&#39;m explicitly matching both LF and CRLF newlines, hence the &lt;tt class=&quot;inline_code&quot;&gt;\x0D?\x0A&lt;/tt&gt; at the end of the line&lt;pre class=&quot;block_code&quot;&gt;# loop through, &#39;nibbling&#39; at logfile with every# successful match &amp; replacementwhile(  $log =~ s{  \[ ([^\]]+?) \] \s+ Player\: \s+ ([^\x20]+?) \s+ \( uid: \s+ (\w+) \)  \x0D?\x0A  \[ [^\]]+? \] \s+ Score: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Kills: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Deaths: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Team \s+ Kills: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Suicides: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Objective: \s+ (\d+)  \x0D?\x0A  }{}ixms) {  # grab values from regex backreferences  $timestamp = $1;  $player    = $2;  $uid       = $3;  $score     = $4;  $kills     = $5;  $deaths    = $6;  $teamkills = $7;  $suicides  = $8;  $objective = $9;    # ...process log entry...}&lt;/pre&gt;this works, its just slow and rather inefficient, not to mention it will likely be a beast to maintain.&lt;p&gt;i was trying to change to using a regular match with a &lt;tt class=&quot;inline_code&quot;&gt;/gc&lt;/tt&gt; flag because it would be much more efficient, and it would also allow me to bypass the backreferences altogether:&lt;pre class=&quot;block_code&quot;&gt;# loop through, grabbing values for every# successful match with the /gc flagwhile(  ($timestamp,$player,$uid,$score,$kills,$deaths,$teamkills,$suicides,$objective) =   $log =~ m{ \G .+  \[ ([^\]]+?) \] \s+ Player\: \s+ ([^\x20]+?) \s+ \( uid: \s+ (\w+) \)  \x0D?\x0A  \[ [^\]]+? \] \s+ Score: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Kills: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Deaths: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Team \s+ Kills: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Suicides: \s+ (\d+)  \x0D?\x0A  \[ [^\]]+? \] \s+ Objective: \s+ (\d+)  \x0D?\x0A  }ixmsgc) {    # ...process log entry...}&lt;/pre&gt;per my understanding, it should match &lt;tt class=&quot;inline_code&quot;&gt;\G&lt;/tt&gt; as the beginning of the string on the first time through, then match it as the end of the &lt;i&gt;previous&lt;/i&gt; match from then on...however, it only ever matches one time.&lt;p&gt;am i missing something blatantly obvious?  or is there even a cleaner approach that i havent thought of?&lt;!-- Node text goes above. Div tags should contain sig only --&gt;&lt;div class=&quot;pmsig&quot;&gt;&lt;div class=&quot;pmsig-42880&quot;&gt;&lt;p&gt;&lt;font color=&#39;#000080&#39;&gt;__________&lt;br&gt;&lt;i&gt;Build a man a fire, and he&#39;ll be warm for a day. Set a man on fire, and he&#39;ll be warm for the rest of his life.&lt;/i&gt;&lt;br&gt;- Terry Pratchett &lt;/font&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
    </description>
</item>

        

<item>
    <title>Win32::API::Struct problem (ldln)</title>
    <link>http://prlmnks.org/html/580846.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580846.html</guid>

    <description>
        Prob some stupid mistake, but why does sizeof give 8 and not 5. One &quot;char&quot; (1byte) + One &quot;long&quot; (4bytes) = 5?&lt;p&gt;&lt;pre class=&quot;block_code&quot;&gt;    use Win32::API;    use Win32::API::Struct;    use strict;    use warnings;        #0.41                #print Win32::API-&gt;VERSION;    Win32::API::Struct-&gt;typedef(&#39;test&#39;, qw(       char i;      long l;    ));        my $Bl = Win32::API::Struct-&gt;new(&#39;test&#39;);        #8. Why not 5?    print &quot;\nSize:&quot;, $Bl-&gt;sizeof();&lt;/pre&gt;
    </description>
</item>

        

<item>
    <title>Wrapping the open() built-in (almut)</title>
    <link>http://prlmnks.org/html/580833.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580833.html</guid>

    <description>
        &lt;p&gt; Hi All, &lt;/p&gt;&lt;p&gt; I need to replace Perl&#39;s built-in open() function. The reason I want todo this is described in detail in another [id://580313|recent post] of mine.In a nutshell, I have to do encoding conversions on filename arguments(unicode -&gt; CP932). &lt;/p&gt;&lt;p&gt; Actually, it&#39;s not only open() I need to wrap, but open() appearsto be the most flexible beast of those, and I&#39;d very much appreciate ifsome of you wise monks could take a look at what I currently have, andlet me know if I&#39;ve overlooked something... &lt;/p&gt;&lt;p&gt; _____ I18N/Japanese.pm (the &#39;compatibility&#39; module) _____ &lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;package I18N::Japanese;use Encode &#39;encode&#39;;use Symbol &#39;qualify_to_ref&#39;;# eventually, determine this dynamicallymy $encoding = &quot;cp932&quot;;# this is meant to take effect for whoever uses usrequire encoding; encoding-&gt;import($encoding);# override/wrap Perl built-ins that take or return filenames# (... snippage of all but open()-wrapper)*CORE::GLOBAL::open = sub (*@) {    my $fhref = \$_[0];    my $autov = !defined $_[0];    my $fh = qualify_to_ref(shift, scalar caller);    # pass filehandle up to caller when &quot;open my $f, ...&quot;    $$fhref = $fh if $autov;    my ($arg2, $arg3, @args) = convert_encoding(@_);    # need to handle the different prototypes seperately    if (@_ &gt;= 3) {        CORE::open $fh, $arg2, $arg3, @args;    } elsif (@_ == 2) {        if (defined $arg3) {            CORE::open $fh, $arg2, $arg3;        } else {            # must be undef _syntactically_            CORE::open $fh, $arg2, undef;        }    } elsif (@_ == 1) {        CORE::open $fh, $arg2;    } else {        CORE::open $fh;    }};sub convert_encoding {    return ( map ref(\$_) eq &#39;SCALAR&#39; ? encode($encoding, $_) : $_, @_ );}1;&lt;/pre&gt;&lt;p&gt; _____ using the replaced open() _____ &lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;use I18N::Japanese;open F, &quot;&gt;&quot;, &quot;myfile&quot;  and print F &quot;foo\n&quot;;open my $f, &quot;&gt;&quot;, &quot;myfile&quot; or die $!;print $f &quot;foo\n&quot;;# ...&lt;/pre&gt;&lt;p&gt; I believe this code is able to handle all various usages of open() ...but please don&#39;t hesitate to prove me wrong ;)  Otherwise, well, I&#39;d beglad to share this snippet with whoever in need might google this up inthe future. &lt;/p&gt;&lt;p&gt; (Note: the encoding conversion aspect is not what I&#39;m worried aboutat the moment, but rather whether the replaced open() is still behavinglike the built-in one, interface-wise) &lt;/p&gt;&lt;p&gt; Thanks,&lt;br /&gt;Almut&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>Problem pushing hashref results (rashley)</title>
    <link>http://prlmnks.org/html/580796.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580796.html</guid>

    <description>
        I&#39;m trying to get the results of a verified SQL query returned by this function:&lt;pre class=&quot;block_code&quot;&gt;sub selectAttributesForReport{    my ($self, $viewName) = @_;    my $result;        my $attrHash;    ### SQL TO GET THE DATA ###    my $dbm      = $self-&gt;getDBManager();    my $sqlText  = $dbm-&gt;getSQL(&#39;selectAttributesForReport&#39;);     my $dbh = $dbm-&gt;getDBH();    my $sth = $dbh-&gt;prepare($sqlText);    $self-&gt;logger_sql-&gt;info(&quot;Executing SQL: $sqlText&quot;);    $sth-&gt;execute($viewName);        #push the data onto our results    while ( my $resultRowRef = $sth-&gt;fetchrow_hashref() )     {            $attrHash-&gt;{OBJECT} = $resultRowRef-&gt;{&#39;ATTRNAME&#39;};$attrHash-&gt;{OBJECTATTRIB} = $resultRowRef-&gt;{&#39;ATTRNAME2&#39;};push (@$result, $attrHash);     }    ##There were no results.    if(not $result)      {        $self-&gt;logger-&gt;error(&quot;There was no information available for the view: [$viewName]&quot;);      }    return $result;}&lt;/pre&gt;I&#39;ve verified via print statements that $attrHash-&gt;{OBJECT} is getting the correct values on each iteration through the loop, but when I look at the result returned, there are the correct number of them, but they all contain the value of the last row retrieved by the SQL.&lt;p&gt;I&#39;m sure I&#39;m doing something dumb on the push, but I can&#39;t put my finger on it.
    </description>
</item>

        

<item>
    <title>Perl Read-Ahead I/O Buffering (jeffthewookiee)</title>
    <link>http://prlmnks.org/html/580786.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580786.html</guid>

    <description>
        I&#39;m currently writing scripts to read pipe-separated values from a very large text file (160+ GB). It&#39;s necessary to process every line, but this approach:@lines = &lt;BIGGUNFILE&gt; is unfeasible due to memory requirements. Currently the scripts use standard line by line behavior:while(my $line = &lt;BIGGUNFILE&gt;)I assume that this is pretty inefficient since it should cause a lot of very small reads instead of reading the data in large chunks. I&#39;ve also experimented with Tie::File, which reports that it will buffer data, but this too seems to be line by line. I only need to process each line once, so buffering this way doesn&#39;t help me much.Is there another approach in Perl wherein I can read in larger chunks of data at a time, but yet not slurp in the whole file? In other words, I&#39;d like to read-ahead and buffer a set of X lines so that the IO would be faster... 
    </description>
</item>

        

<item>
    <title>logfile parsing (phoneguy)</title>
    <link>http://prlmnks.org/html/580784.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580784.html</guid>

    <description>
        I have a logfile that is somewhat unique in the fact that, well, it&#39;s a jumbled up mess.  For example:&lt;br&gt;&lt;blockquote&gt;&lt;pre class=&quot;block_code&quot;&gt;2006-10-25 18:20:20,751 DEBUG [stuff][][] End Query: [Id: 1] [duration: 96]2006-10-25 18:20:20,762 DEBUG [stuff][][] Start Query: [Id: 2] [Description: ] [debug sql] &lt;SQL Here&gt;   &lt;more SQL&gt;   &lt;more SQL&gt;2006-10-25 18:20:20,763 DEBUG [stuff][][] End Query: [Id: 2] [duration: 1]2006-10-25 18:20:20,764 DEBUG [stuff][][] Checking status of UserService2006-10-25 18:20:20,764 DEBUG [stuff][][] Starting IntegrationService2006-10-25 18:20:20,764 DEBUG [stuff][][] Service Started: IntegrationService2006-10-25 18:20:20,776 DEBUG [stuff][][] Start Query: [Id: 3] [Description: ] [debug sql] SELECT&lt;/pre&gt;&lt;/blockquote&gt;I&#39;d like to be able to write a logfile parser that will tell me which ID&#39;s haven&#39;t finished in a log file (when the server crashes), and what SQL statements are taking the longest time.What&#39;s the easiest way to do this?  
    </description>
</item>

        

<item>
    <title>Error using Net::SFTP (kprasanna_79)</title>
    <link>http://prlmnks.org/html/580780.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580780.html</guid>

    <description>
        Revered Monks,&lt;br&gt;&lt;p&gt;I am trying to use the module Net::SFTP and i am getting the following error.&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;Error using Net::SFTP, Reading configuration data d://.ssh/configReading configuration data /etc/ssh_configConnecting to stage.com, port 22.Remote version string: SSH-1.99-OpenSSH_3.9p1Remote protocol version 1.99, remote software version OpenSSH_3.9p1Net::SSH::Perl Version 1.30, protocol version 1.5.No compat match: OpenSSH_3.9p1.Can&#39;t set socket non-blocking: Bad file descriptor at D:/apps/site/lib/Net/SSH/Perl.pm line 216.&lt;/pre&gt;&lt;p&gt;Also when i try to use the Net::SFTP::Foreign i am getting the following error&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;sftp: Sending SSH2_FXP_INITreading from ssh pipe failed () at test1.pl line 14&lt;/pre&gt;&lt;p&gt;If any body throws light on this issue will be appreciated&lt;/p&gt;&lt;br&gt;&lt;p&gt;Update:- This error i am getting when used in windows and perl version 5.8.8&lt;/p&gt;-Prasanna.K
    </description>
</item>

        

<item>
    <title>Loading a module into many packages (arkturuz)</title>
    <link>http://prlmnks.org/html/580774.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580774.html</guid>

    <description>
        Hello all!&lt;p&gt;I loaded one module into my package like this:&lt;pre class=&quot;block_code&quot;&gt;In MyClass.pm:{package MyClass;use mymodule;# call some function from mymodule}&lt;/pre&gt;and afterwards I load the same module into &lt;tt class=&quot;inline_code&quot;&gt;main&lt;/tt&gt;package:&lt;pre class=&quot;block_code&quot;&gt;In myapp.pl:use mymodule;# call some function from mymodule&lt;/pre&gt;The problem is that I can normally call functions from &lt;tt class=&quot;inline_code&quot;&gt;mymodule&lt;/tt&gt; within &lt;tt class=&quot;inline_code&quot;&gt;MyClass&lt;/tt&gt; but calling the same functions within &lt;tt class=&quot;inline_code&quot;&gt;main&lt;/tt&gt; throws an error about functions not being defined.I don&#39;t have any package declarations in &lt;tt class=&quot;inline_code&quot;&gt;mymodule.pm&lt;/tt&gt;; it&#39;s just a file with a lot of functions.&lt;p&gt;I resolved this by putting &lt;tt class=&quot;inline_code&quot;&gt;use mymodule&lt;/tt&gt; in &lt;tt class=&quot;inline_code&quot;&gt;MyClass&lt;/tt&gt; outside of package definition and brackets and now everything works fine, but I still don&#39;t know why the previous code failed to work.&lt;p&gt;Can it be because of &lt;tt class=&quot;inline_code&quot;&gt;Class::Contract&lt;/tt&gt;? I use it to construct a class in &lt;tt class=&quot;inline_code&quot;&gt;MyClass&lt;/tt&gt;. Does it somehow obscure loaded functions in MyClass so that no other packages can use it? (I know it sounds funny and probably is wrong, but that&#39;s the only reason I can think of.)&lt;p&gt;Any suggestions/descriptions/pointers to docs/slaps are appreciated.&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; sample test code similar to the original and it doesn&#39;t work:&lt;p&gt;&lt;b&gt;test_loading.pl:&lt;/b&gt;&lt;pre class=&quot;block_code&quot;&gt;#!/usr/bin/perl -wuse strict;use warnings;{    package MyClass;    use Class::Contract;    use test_func;    contract {        attr &#39;test&#39;;        ctor &#39;new&#39;;        impl {            ${self-&gt;test} = test_me(&#39;within class&#39;);        };    };};package main;use test_func;test_me(&#39;in main&#39;);&lt;/pre&gt;&lt;p&gt;&lt;b&gt;test_func.pm&lt;/b&gt;&lt;pre class=&quot;block_code&quot;&gt;sub test_me {    my $txt = shift;    print &quot;Exec of test_me with: $txt\n&quot;;    return $txt;}1;&lt;/pre&gt;&lt;p&gt;It throws an error:&lt;pre class=&quot;block_code&quot;&gt;Undefined subroutine &amp;main::test_me called at test_loading.pl line 25&lt;/pre&gt;&lt;p&gt;It works fine when I remove &lt;tt class=&quot;inline_code&quot;&gt;use test_func&lt;/tt&gt; from MyClass and call &lt;tt class=&quot;inline_code&quot;&gt;test_me()&lt;/tt&gt; like &lt;tt class=&quot;inline_code&quot;&gt;main::test_me()&lt;/tt&gt; in class ctor.
    </description>
</item>

        

<item>
    <title>Using pipe and reading from the stdin (mellin)</title>
    <link>http://prlmnks.org/html/580761.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580761.html</guid>

    <description>
        &lt;p&gt;I have a question, just for curiosity reasons, is there any drawbacks of monitoring server and a text file (e.g Apache log file) using tail and pipe to output the lines to perl script? I want to do it like this so i can control the formatting with the Perl script as i want it to be.&lt;/p&gt;&lt;tt class=&quot;inline_code&quot;&gt;tail -f -n 0 /etc/httpd/logs/access_log | ./readStdin.pl&lt;/tt&gt;&lt;p&gt;So the above command is what i run from my Linux www server, the tail command stays real-time in reading the access_log and since that readStdin.pl script is taking input using while (&lt;STDIN&gt;), it waits &quot;indefinitely&quot; for new lines to be formatted and displayed.&lt;/p&gt;&lt;p&gt;I&#39;m just curious if there is some major problem with this kind of monitoring that i haven&#39;t even thought about.&lt;/p&gt;&lt;p&gt;Please, comment freely.&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>HTTP/S Discovery (Zate)</title>
    <link>http://prlmnks.org/html/580760.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580760.html</guid>

    <description>
        Hello,I am trying to write a simple bit of code to take the output from NMAP::Parser on what ports are open on a host, and then determine if a HTTP or HTTPS server runs on that port, if it is then get me the Type of Server (via the HTTP HEAD command).&lt;br&gt;&lt;br&gt;I am using IO::Socket::INET for the HTTP and IO::Socket::SSL for the HTTPS portion.  The problem I have is that the program tends to get &quot;stuck&quot; sometimes on non HTTP or HTTPS ports.&lt;br&gt;&lt;br&gt;Is there a way, at a very low level to quickly see if something speaks HTTP ? (or HTTPS) before doing the HEAD request?  I am using NMAP to get what ports are open on a box, I am thinking i need something to tell what of those speaks HTTP before asking it what kind of server its running.&lt;br&gt;&lt;br&gt;I tried using alarm() to &quot;die&quot; if it got hung but wasnt sure how to make the sub exit and return instead of dieing.&lt;br&gt;&lt;br&gt;Thank you for your time.
    </description>
</item>

        

<item>
    <title>What magic is this? (Jonathan)</title>
    <link>http://prlmnks.org/html/580738.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580738.html</guid>

    <description>
        I have two scripts that use XML::Simple to parse a small file. The XML::Simple code is identical for both, ie&lt;pre class=&quot;block_code&quot;&gt;  # Create XML reader object  my $xs = new XML::Simple();  # Parse XML string  my $ref = $xs-&gt;XMLin($file_str);&lt;/pre&gt;With an identical XML string the first script runs without complaint. The second also runs but I have a message in my log file&lt;pre class=&quot;block_code&quot;&gt;Thu Oct 26 12:47:37 2006 [PID 23309] [critical] Can&#39;t use string (&quot;&lt;sa:model xmlns:sa=&quot;urn:basel-rb&quot;) as a symbol ref while &quot;strict refs&quot; in use at /usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris/XML/Parser/Expat.pm line 451.&lt;/pre&gt;The only difference between the two routines is that in the one that reports the problem I&#39;ve added my own error reporting overrides&lt;pre class=&quot;block_code&quot;&gt;    $SIG{__WARN__} = \&amp;log_warn;    $SIG{__DIE__}  = \&amp;log_die;&lt;/pre&gt;Can anyone offer me some enlightenment on whats going on?
    </description>
</item>

        

<item>
    <title>ASCII chart that displays jobs that are running and jobs that are queued for a day (wishartz)</title>
    <link>http://prlmnks.org/html/580735.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580735.html</guid>

    <description>
        Hi perlmonks, I&#39;m relativley new to perl and I have a problem which I cannot seem to get my head around.  I need to create an ASCII chart, which displays  jobs that are running, or a list of jobs that were queuing at a particular time.  The perl program will read a file which contains the following information:&lt;pre class=&quot;block_code&quot;&gt;Queue  Queued     Start      Endqueuea 1161611468 1161612964 1161657611queueb 1161612303 1161648292 1161674374queuec 1161620067 1161620070 1161651772queued 1161622109 1161622114 1161662607queueb 1161626408 1161626414 1161650011queueb 1161628081 1161628085 1161658563queued 1161629319 1161651912 1161652722queuea 1161629632 1161630900 1161649776queuea 1161630141 1161646804 1161656606queuec 1161632731 1161632986 1161670456queuec 1161633898 1161633929 1161656900queuea 1161635242 1161635247 1161703541queueb 1161635268 1161635275 1161653284queueb 1161635472 1161635479 1161657667queueb 1161636392 1161636399 1161652133queueb 1161636691 1161636698 1161652313queueb 1161636780 1161636785 1161654656queueb 1161638253 1161638258 1161652124queued 1161638845 1161638851 1161652164queueb 1161639646 1161639656 1161656089queuea 1161639811 1161672455 1161672927queued 1161639955 1161639958 1161650644queued 1161640162 1161640165 1161651353queued 1161640340 1161640343 1161650555queued 1161640545 1161640547 1161652089queued 1161641176 1161641181 1161651069queued 1161641484 1161641488 1161652164queued 1161643078 1161643083 1161653237&lt;/pre&gt;I&#39;ve cut the above file down, it would be a lot longer for a whole day.as you can see the times are all in epoch time.  I will need to display a chart, that has the time going down vertically on the chart and the name of the queue at the top.  The problem is I need to be able to set the time unit, for example if I wanted to see how many jobs were queued each hour for a day, I would set the time variable to 60 and it would list every hour of the day down the Y axis with how many jobs were queued and how many jobs were running at that time, as well as the queue the job belonged to.The chart would look like this:&lt;pre class=&quot;block_code&quot;&gt;Date: 26/10/06Time                     Queue      Queued   Running-----------------------------------------------------0:00                     queuea     2        1                         queueb     3        0                         queuec     4        4                         queued     0        6-----------------------------------------------------  1:00                     queuea     0        1                         queueb     0        10                         queuec     5        2                         queued     3        5-----------------------------------------------------&lt;/pre&gt;and so on for the rest of the hours of the day.              I just need to know how to build a program in perl to obtain those results.  I know basic perl, for example I know how to read the file in and pass parameters with use getopt, but im not sure how to go about getting the results. I hope I explained this clearly enough.  Can anybody help please?
    </description>
</item>

        

<item>
    <title>Oracle to MSSQL translation (Tabari)</title>
    <link>http://prlmnks.org/html/580729.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580729.html</guid>

    <description>
        I have a series of Oracle PL/SQL code creating procedures and functions which I need to migrate to MSSQL. Apart from that , some DDL statements such as table/column/index creation need to be translated too.Is there some CPAN module or some other starting point for this exercise? The translation need not necessarily be complete in all details, I&#39;d be very glad if the tedious task of doing it all is a bit alleviated 
    </description>
</item>

        

<item>
    <title>help needed badly parsing ASN.1 data (Anonymous Monk)</title>
    <link>http://prlmnks.org/html/580714.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580714.html</guid>

    <description>
        &lt;p&gt; Hi all,&lt;/p&gt;&lt;p&gt; I am a student working on a project using Perl.&lt;/p&gt;&lt;p&gt; My work is...&lt;/p&gt;&lt;p&gt; I have few hex bytes as inputs for my program. Its a series of hex bytes. for eg: 01 0a ab 2a 1c etc...&lt;/p&gt;&lt;p&gt; Here each byte stands for some representation. I also have a data file in which all the representations are stored. For eg:&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;01 =&gt; &quot;abcd&quot;02 =&gt; &quot;ertg&quot;1c =&gt; &quot;srfrf&quot;etc... &lt;/pre&gt;&lt;p&gt; I have to parse the input hex bytes using this data file and the output should show the parsed input series.&lt;/p&gt;&lt;p&gt; The problem i face in linear search id, there are few hex bytes in which the digits are same but the representations are different. For eg: 01 stands for &lt;tt class=&quot;inline_code&quot;&gt;&quot;abcd&quot;&lt;/tt&gt; and also in some other place it stands for &lt;tt class=&quot;inline_code&quot;&gt;&quot;cdfv&quot;&lt;/tt&gt; also.  &lt;/p&gt;&lt;p&gt; My program follows ASN.1 format. I mean The bytes come in a fashion like TYPE and then LENGTH and then VALUE..&lt;/p&gt;&lt;p&gt; So i have to parse in teh above mentioned manner.  &lt;/p&gt;&lt;p&gt; I am unable to come up with an algorithm for the same as i am very new to Perl programming.  &lt;/p&gt;&lt;p&gt; Also, the data files are very huge and input also is very huge file in which there are several hex bytes.  &lt;/p&gt;&lt;p&gt; So plz can anyone help me in this? &lt;/p&gt;&lt;p&gt;   The raw files(Given as input) looks like the following:&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;  0d a1 0b 02 01 02 02 01 0e 30 03 04 01 93 7f 01 00 8b 2a 1c 0d a2 0b 02 01 03 30 06 02 01 0e 80 01 04 &lt;/pre&gt;&lt;p&gt; The data files in which all possible hex combinations stored look like this&lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt; .......  02 OpCode Tag01 OpCode Length26 Foron0A Reg10B Era10C Act10D De10E Int111 Reg412 Get513 Pro63B Pro73C Uns73D Uns10 Not8 ......&lt;/pre&gt;&lt;p&gt; The above is just a small block of the data file... Here The byte 02 stand for a TYPE&lt;/p&gt;&lt;p&gt; the byte 01 stands for its LENGTH&lt;/p&gt;&lt;p&gt; the the following bytes after that stands for the possible occurences of the VALUES.&lt;/p&gt;&lt;p&gt; But in the input string, according to the LENGTH, the value part occurs. For eg: if LENGTH is 01, only one possible VALUE follows it... else if LENGTH is 02, then 2 VALUES etc...  &lt;/p&gt;&lt;p&gt; The output according to the input shown here shud look like the following:  &lt;/p&gt;&lt;pre class=&quot;block_code&quot;&gt;  0d -&gt; De1a1 -&gt; Comp10b -&gt; Era102 -&gt; Opcode tag01 -&gt; Opcode length*02 -&gt; cdff etc.....   &lt;/pre&gt;&lt;p&gt;    here since the length is 01(where it is starred), one of the possible values only can occur once... i mean each time...&lt;/p&gt;&lt;p&gt; So like this there are many TYPE LENGTH VALUES in the data files... so  hex value in one TLV can have one description and the same hex value in another can have another description..&lt;/p&gt;&lt;p&gt; If i get some logic to search in each TLVs also, its good...&lt;/p&gt;&lt;p&gt; I hope this will explain you better....&lt;/p&gt;&lt;p&gt;&lt;small&gt;20061026 Janitored by [id://5348]: Added formatting, code tags, as per [id://17558]&lt;/small&gt;&lt;/p&gt;&lt;p&gt;&lt;small&gt;2006-10-27 Retitled by [Corion], as per Monastery [id://341118|guidelines] &lt;br /&gt;Original title: &#39;Please help needed badly.....&#39;&lt;/small&gt;&lt;/p&gt;
    </description>
</item>

        

<item>
    <title>Writing to a file handle not attached to a file? (Anonymous Monk)</title>
    <link>http://prlmnks.org/html/580704.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580704.html</guid>

    <description>
        I&#39;m dealing with an API that takes a file hanlde to write output to as an argument. The problem is, I need the output right after, and I&#39;d rather not go through the trouble of creating a file just to have to read from it and then delete it afterwards. Is there anyway to redirect a file handle to a scalar, so that when it&#39;s written to (e.g., &quot;print $handle $ouptut&quot;), the output ends up in a scalar?
    </description>
</item>

        

<item>
    <title>sftp Windows (cdlvj)</title>
    <link>http://prlmnks.org/html/580649.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580649.html</guid>

    <description>
        Topic for discussion:Has anyone gotten sftp module working in the windows environment?
    </description>
</item>

        

<item>
    <title>How To Pass To Another Server and Spawn Another Script (o2bwise)</title>
    <link>http://prlmnks.org/html/580646.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580646.html</guid>

    <description>
        Hi,&lt;br&gt;&lt;br&gt;Perhaps this is not an appropriate question, I am really not sure.  But, especially with the many mods out there, my guess is, it is.&lt;br&gt;&lt;br&gt;Anyway, I wrote an html form and perl cgi script.  The next phase of the application needs for another server to have some text, based in part on the form entry, passed to it and to have another script executed (script on the other server side, the side where the text needs to be passed).  This is something I have never done before and I am wondering if there is an approach and (if so) what it is, including mods to want to use.&lt;br&gt;&lt;br&gt;Not sure if it matters, but they are unix servers.&lt;br&gt;&lt;br&gt;Thanks in advance!&lt;br&gt;&lt;br&gt;Tony
    </description>
</item>

        

<item>
    <title>calling scalar from scalar. symlinks (opensourcer)</title>
    <link>http://prlmnks.org/html/580631.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580631.html</guid>

    <description>
        this is a package&lt;pre class=&quot;block_code&quot;&gt;package Utils::Agent;sub SetDestination{my $self = shift; my $class = shift;my $construct = &quot;\$&quot;.$class;        # i have lot of destination in different packages        # so i can&#39;t say every time $pkg::destination$Destination = $construct::destination;return $Destination;}&lt;/pre&gt;-----------&lt;/br&gt;&lt;pre class=&quot;block_code&quot;&gt;use Utils::Agent;use Data::Config;use Web::Config;my $config = new Data::Config;my $webConfig = new Web::Config;my $utils = new Utils::Agent;$utils-&gt;SetDestination(ref($config));&lt;/pre&gt;and when i try this i get nothing
    </description>
</item>

        

<item>
    <title>Variable Name Mistery. Who calls? (porta)</title>
    <link>http://prlmnks.org/html/580619.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580619.html</guid>

    <description>
        Hi to all. I&#39;m a perl rookie and I started to struggle creating my own modules.I&#39;m having a question that I cannot answer by myself and I ask for your Wisdom to trow some light on my dilemma.&lt;br/&gt;Lets say that I create a module Foo.pm, which has &quot;new&quot; sub.&lt;pre class=&quot;block_code&quot;&gt;package Foo;sub new {    my ($class) = @_;    my $self = {};    bless $self, $class;}&lt;/pre&gt;And, I have my script test.pl which has:&lt;pre class=&quot;block_code&quot;&gt;use Foo;my $one = Foo-&gt;new;my $second = Foo-&gt;new;&lt;/pre&gt;And my question is: Is there a way that I can, inside Foo.pm, &lt;i&gt;know&lt;/i&gt; the name of the variable that I&#39;m using on test.pl?&lt;br/&gt;Lets say I want to create a sub on Foo.pm that just returns the name of $one or $second.&lt;br/&gt;Note that I need this to be able to catch and display my own custom warnings on Foo.pm and I want to give the name of the variable that caused the warning when printing on screen the warning message.&lt;br/&gt;I hope my question is clear enough. I&#39;m not a good english speaker so please excuse any error on the writing.Thanks in advance for any help or comment about this.
    </description>
</item>

        

<item>
    <title>Can you use setsockopt with the strict pragma? (ronniec)</title>
    <link>http://prlmnks.org/html/580605.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580605.html</guid>

    <description>
        I&#39;ve re-written a script that tries to waken PC&#39;s on our network (I had to as the Getopt::Std module didn&#39;t work on my office PC!) and it works perfectly well. Unfortunately I like to use the strict pragma in all my scripts and this re-write will not work with this. If I supply AF_INET and STOCK_DGRAM as the level and optname parameters to setsockopt it fails with the old bareword not allowed error. I thought that if I put these values in variables and passed these to my script this would satisfy the strict pragma. Nope I get the following error :-&lt;br&gt;&lt;pre class=&quot;block_code&quot;&gt;Argument &quot;SOCK_DGRAM&quot; isn&#39;t numeric in socket at RC_Bad_wakeonlan.pl line 59, &lt;INF&gt; line 1.Argument &quot;AF_INET&quot; isn&#39;t numeric in socket at RC_Bad_wakeonlan.pl line 59, &lt;INF&gt; line 1.socket :  at RC_Bad_wakeonlan.pl line 59, &lt;INF&gt; line 1.&lt;/pre&gt;The actual code in my script is :- &lt;br&gt;&lt;pre class=&quot;block_code&quot;&gt;my $Domain        = &quot;AF_INET&quot; ;my $Type          = &quot;SOCK_DGRAM&quot; ;my $Level         = &#39;SOL_SOCKET&#39; ;my $Optname       = &#39;SO_BROADCAST&#39; ;## Alocate socket and send packet   $raddr = gethostbyname($ipaddr);   $them = pack_sockaddr_in($port, $raddr);   $proto = getprotobyname(&#39;udp&#39;);   socket(S, $Domain, $Type, $proto) or die &quot;socket : $!&quot;;   setsockopt(S, $Level,$Optname, 1) or die &quot;setsockopt : $!&quot;;   print &quot;Sending magic packet to $ipaddr:$port with $hwaddr\n&quot;;&lt;/pre&gt;&lt;br&gt;I can obviously get this to work without using the strict pragma with this code :-&lt;br&gt;&lt;pre class=&quot;block_code&quot;&gt;socket(S, AF_INET, SOCK_DGRAM, $proto) or die &quot;socket : $!&quot;;setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1) or die &quot;setsockopt : $!&quot;;&lt;/pre&gt;Is my understanding of this wanting? As I say I can get round it but I&#39;m intrigued. I was also looking for the manual entry for setsockopt(2) (as alluded to on page 785 of the &quot;Programming Perl&quot; book but am unable to locate it on any of our servers (the powers that be probably thought these man pages took up too much room) is this documentation available on the net?
    </description>
</item>

        

<item>
    <title>Read Only fields from Tk, neither Text or ROText seem to work. (SkipHuffman)</title>
    <link>http://prlmnks.org/html/580590.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580590.html</guid>

    <description>
        &lt;p&gt;I am really confused by this.  I need an interface with some fields read only (labels) and some editable (data).  I cannot seem to prevent editablity.  I have tried two things that I think should work, this:&lt;pre class=&quot;block_code&quot;&gt; $Cell[1] = {                CellType        =&gt; &quot;ROText&quot;,                Row             =&gt; 0,                Col             =&gt; 0,                Contents        =&gt; &quot;Bank\\Branch\\Dept:&quot;                };$Cell[2] = {                CellType        =&gt; &quot;ROText&quot;,                Row             =&gt; 1,                Col             =&gt; 0,                Contents        =&gt; &quot;Requestor:&quot;                };foreach (1 .. $#Cell) {        if (${$Cell[$_]}{&#39;CellType&#39;} == &quot;Text&quot;) {                $cell = $grid-&gt;Text(                                -width          =&gt; 17,                                -height         =&gt; 1,                                )-&gt;grid(                                -row =&gt; ${$Cell[$_]}{&#39;Row&#39;},                                -sticky =&gt; &quot;nsew&quot;,                                -column =&gt; ${$Cell[$_]}{&#39;Col&#39;},                                );        } elsif (${$Cell[$_]}{&#39;CellType&#39;} == &quot;ROText&quot;) {        $cell = $grid-&gt;ROText(                        -width          =&gt; 17,                        -height         =&gt; 1,                        )-&gt;grid(                        -row =&gt; ${$Cell[$_]}{&#39;Row&#39;},                        -sticky =&gt; &quot;nsew&quot;,                        -column =&gt; ${$Cell[$_]}{&#39;Col&#39;},                        );                };        $cell-&gt;Contents(&quot;${$Cell[$_]}{&#39;Contents&#39;}&quot;);};&lt;/pre&gt;&lt;p&gt;And this:&lt;pre class=&quot;block_code&quot;&gt;foreach (1 .. $#Cell) {        if (${$Cell[$_]}{&#39;CellType&#39;} == &quot;Text&quot;) {                $cell = $grid-&gt;Text(                                -width          =&gt; 17,                                -height         =&gt; 1,                                -state          =&gt;&#39;normal&#39;,                                )-&gt;grid(                                -row =&gt; ${$Cell[$_]}{&#39;Row&#39;},                                -column =&gt; ${$Cell[$_]}{&#39;Col&#39;},                                );        } elsif (${$Cell[$_]}{&#39;CellType&#39;} == &quot;ROText&quot;) {                $cell = $grid-&gt;Text(                                -width          =&gt; 17,                                -height         =&gt; 1,                                -state          =&gt;&#39;disabled&#39;,                                )-&gt;grid(                                -row =&gt; ${$Cell[$_]}{&#39;Row&#39;},                                -column =&gt; ${$Cell[$_]}{&#39;Col&#39;},                                );                };        $cell-&gt;Contents(&quot;${$Cell[$_]}{&#39;Contents&#39;}&quot;);};&lt;/pre&gt;&lt;p&gt;Both of these result in fields that can be clicked on and edited. &lt;p&gt;What am I doing wrong?&lt;div class=&quot;pmsig&quot;&gt;&lt;div class=&quot;pmsig-334836&quot;&gt;Skip&lt;/div&gt;&lt;/div&gt;
    </description>
</item>

        

<item>
    <title>printing array ref of hash refs (Anonymous Monk)</title>
    <link>http://prlmnks.org/html/580586.html</link>
    <guid isPermaLink="true">http://prlmnks.org/html/580586.html</guid>

    <description>
        Using Data::Dumper, I have an array refs of hash refs data structure.  Whats the best way to iterate over it and print only the &quot;State&quot; key?  Using Dump I get the following:&lt;pre class=&quot;block_code&quot;&gt;$VAR1 = [          {            &#39;State&#39; =&gt; &#39;Maine&#39;,            &#39;Town&#39; =&gt; &#39;Portland&#39;          },          {            &#39;State&#39; =&gt; &#39;New Hampshire&#39;,            &#39;Town&#39; =&gt; &#39;Concord&#39;          }        ];$VAR1 = [          {            &#39;State&#39; =&gt; &#39;Florida&#39;,            &#39;Town&#39; =&gt; &#39;Jacksonville&#39;          },          {            &#39;State&#39; =&gt; &#39;North Carolina&#39;,            &#39;Town&#39; =&gt; &#39;Waynesville&#39;          }        ];&lt;/pre&gt;Thanks
    </description>
</item>

        

<item>
    <title>regex and string functions help needed. (valavanp)</title>
    <link>http://prlmnks.org/html/580554.html</link>
   