[24275] in Perl-Users-Digest
Perl-Users Digest, Issue: 6466 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 26 06:05:43 2004
Date: Mon, 26 Apr 2004 03:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 26 Apr 2004 Volume: 10 Number: 6466
Today's topics:
convert graphic file to x,y coordinates (Mike Solomon)
Re: convert graphic file to x,y coordinates <postmaster@castleamber.com>
Difficult regular expression problem! (Fritz Bayer)
Re: Difficult regular expression problem! <thepoet_nospam@arcor.de>
Re: free source blogger (works) <tore@aursand.no>
Re: free source blogger (works) <gnari@simnet.is>
Re: Help! How to find memory leak? <nospam@bigpond.com>
Re: Help! How to find memory leak? (Sam Holden)
Re: Help! How to find memory leak? <nospam@bigpond.com>
Re: Help! How to find memory leak? (Sam Holden)
Re: noob question: Trying to extract part of a string i (Anno Siegel)
Re: noob question: Trying to extract part of a string i <Joe.Smith@inwap.com>
Re: slurp not working? ideas please! <kuujinbo@hotmail.com>
Re: slurp not working? ideas please! <geoffacox@dontspamblueyonder.co.uk>
Re: slurp not working? ideas please! <geoffacox@dontspamblueyonder.co.uk>
Re: slurp not working? ideas please! <geoffacox@dontspamblueyonder.co.uk>
Re: slurp not working? ideas please! <geoffacox@dontspamblueyonder.co.uk>
Re: slurp not working? ideas please! <kuujinbo@hotmail.com>
Re: Tripod wont find my lib files (javatiger)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Apr 2004 02:51:01 -0700
From: mike_solomon@lineone.net (Mike Solomon)
Subject: convert graphic file to x,y coordinates
Message-Id: <56568be5.0404260151.603d47bf@posting.google.com>
I need to take a graphics file and then get the xy coordinates from it
and insert them into a database
so far the best way I have come up with is to use paint to get the
cordinates and manually record them in a spreadsheet
Is there any way I can use perl to read the graphics file and get the
co-ordinates
I am probably being optimistic but doing it manually is driving me mad
:)
------------------------------
Date: Mon, 26 Apr 2004 04:56:33 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: convert graphic file to x,y coordinates
Message-Id: <408cdcd2$0$202$58c7af7e@news.kabelfoon.nl>
Mike Solomon wrote:
> I need to take a graphics file and then get the xy coordinates from it
> and insert them into a database
>
> so far the best way I have come up with is to use paint to get the
> cordinates and manually record them in a spreadsheet
>
> Is there any way I can use perl to read the graphics file and get the
> co-ordinates
>
> I am probably being optimistic but doing it manually is driving me mad
> :)
What kind of graphics file, and how are xy coordinates marked?
--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
------------------------------
Date: 26 Apr 2004 02:26:24 -0700
From: fritz-bayer@web.de (Fritz Bayer)
Subject: Difficult regular expression problem!
Message-Id: <a9c0aa9e.0404260126.7ba87761@posting.google.com>
Hello,
I have the problem that the regular expression (word1|word2|word3)? is
not being recalled when later being referenced using $1.
Here a very simple example:
$context = "This is a very simple sentence. Always, the second up to
the last word of this sentence should be captured!"
$content =~ s/(simple|easy|plain|simplitic)?.*Always(.*)captured!/
print($1 . "\n")/iesg;
Now, I would expect this to be printing out "simple" followed by ",
the second up to the last word of this sentence should be " to the
console.
However, this does not happen. I used $& to look at what gets matched
and it seems nothing at all.
If I take the question mark out - then the expresson matches, but the
problem is, that I also want the the following variation of the above
sentence to match:
"$context = "This is a very STUPID sentence. Always, the second up to
the last word of this sentence should be captured!"
The reason is, that I want to capture any expressoin which matches the
regular expression:
Always(.*)variations!
Now, if this regular expression is precedded by one of the words in
the list, then I would like to know about it and capture/print it out.
Do you know the a regular expression to achieve this?
Thanks,
Fritz
------------------------------
Date: Mon, 26 Apr 2004 11:49:30 +0200
From: Christian Winter <thepoet_nospam@arcor.de>
Subject: Re: Difficult regular expression problem!
Message-Id: <408cdb2a$0$26353$9b4e6d93@newsread4.arcor-online.net>
Fritz Bayer wrote:
> $context = "This is a very simple sentence. Always, the second up to
> the last word of this sentence should be captured!"
>
> $content =~ s/(simple|easy|plain|simplitic)?.*Always(.*)captured!/
> print($1 . "\n")/iesg;
Is it intentionally that one scalar is called $context,
whereas you apply your regex-substitution to $content?
-Christian
------------------------------
Date: Mon, 26 Apr 2004 10:52:46 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: free source blogger (works)
Message-Id: <pan.2004.04.26.08.50.13.889536@aursand.no>
On Mon, 26 Apr 2004 00:29:51 -0800, Robin wrote:
> There is no configuration needed for this script, and I admit it needs work.
No shit, Sherlock!? You still ignores most of what people try to teach
you. To mention a few issues:
* You're using double quotes when there's no need to.
* You're using 'exit' when you shouldn't.
* You're not checking the return code of 'open()'.
* You're setting environment variables from your scripts.
* You're calling variables "constants".
* You're not running your scripts in taint mode.
* You're doing 'if (! ...)' instead of 'unless (...)'
* You're using heaps of 'if' statements instead of using
the Switch module.
So - in the end: Your programming skills generally sucks. You don't seem
to want to learn anything, so in x months from now, your programming
skills still will sucks. Sad, but true.
--
Tore Aursand <tore@aursand.no>
"The road to hell is full of good intentions." (Bruce Dickinson)
------------------------------
Date: Mon, 26 Apr 2004 08:04:24 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: free source blogger (works)
Message-Id: <c6ifne$sfl$1@news.simnet.is>
"Robin" <robin @ infusedlight.net> wrote in message
news:c6ibfr$ond$1@reader2.nmix.net...
> There is no configuration needed for this script, and I admit it needs
work.
> Have fun.
thanks. it WAS fun :-)
you need to improve your input validation.
and your whole authorisation scheme sucks.
better luck next time.
gnari
------------------------------
Date: Mon, 26 Apr 2004 18:18:41 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Help! How to find memory leak?
Message-Id: <1457082.YYbyuOaiYx@GMT-hosting-and-pickle-farming>
Amanda wrote:
>
>
> I am using a Perl program that must process a large number (10**7)
> of items. As the program runs, I've noticed that it becomes less
> and less efficient in its processing, and at the same time, it
> consumes more and more memory. Reading over the program's voluminous
> code (not written by me), I can't find what causes this growth in
> memory consumption. Are there any tools that could help figure
> out where/how this is coming about?
>
> Thanks!
>
> Amanda
>
> --
Why do you assume anything is wrong? "Memory leak" is a MS windows bug;
nothing to do withe Perl.
gtoomey
------------------------------
Date: 26 Apr 2004 08:27:21 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help! How to find memory leak?
Message-Id: <slrnc8phv9.i1b.sholden@flexal.cs.usyd.edu.au>
On Mon, 26 Apr 2004 18:18:41 +1000, Gregory Toomey <nospam@bigpond.com> wrote:
> Amanda wrote:
>
>>
>>
>> I am using a Perl program that must process a large number (10**7)
>> of items. As the program runs, I've noticed that it becomes less
>> and less efficient in its processing, and at the same time, it
>> consumes more and more memory. Reading over the program's voluminous
>> code (not written by me), I can't find what causes this growth in
>> memory consumption. Are there any tools that could help figure
>> out where/how this is coming about?
>>
>> Thanks!
>>
>> Amanda
>>
>> --
>
> Why do you assume anything is wrong? "Memory leak" is a MS windows bug;
> nothing to do withe Perl.
Perl programs can "leak" memory just fine thanks. Circular references are
one way, keeping around data that is no longer required is another.
while (<>) {
push @lines, $_;
print $lines[-1];
}
Will consume more and more memory, under unix even (so it's certainly
nothing to do with MS Windows).
my $something_that_will_one_day_be_false = 1;
while ($something_that_will_one_day_be_false) {
my $f = {};
$f->{f} = $f;
# code that one day makes $something_that_will_one_day_be_false false
}
Leaks memory, under unix even.
--
Sam Holden
------------------------------
Date: Mon, 26 Apr 2004 18:36:19 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Help! How to find memory leak?
Message-Id: <2122806.n2ZVnWhIHQ@GMT-hosting-and-pickle-farming>
Sam Holden wrote:
> On Mon, 26 Apr 2004 18:18:41 +1000, Gregory Toomey <nospam@bigpond.com>
> wrote:
>> Amanda wrote:
>>
>>>
>>>
>>> I am using a Perl program that must process a large number (10**7)
>>> of items. As the program runs, I've noticed that it becomes less
>>> and less efficient in its processing, and at the same time, it
>>> consumes more and more memory. Reading over the program's voluminous
>>> code (not written by me), I can't find what causes this growth in
>>> memory consumption. Are there any tools that could help figure
>>> out where/how this is coming about?
>>>
>>> Thanks!
>>>
>>> Amanda
>>>
>>> --
>>
>> Why do you assume anything is wrong? "Memory leak" is a MS windows bug;
>> nothing to do withe Perl.
>
> Perl programs can "leak" memory just fine thanks. Circular references are
> one way, keeping around data that is no longer required is another.
A MS WIndows "memory leak" occurs when memory is allocated my malloc or
similar, does not relase it, and loses track of it.
Perl knows about what memory it has allocated just fine, but chooses not to
do garbage collection on occasion for performance reasons.
gtoomey
------------------------------
Date: 26 Apr 2004 08:46:07 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help! How to find memory leak?
Message-Id: <slrnc8pj2f.i9g.sholden@flexal.cs.usyd.edu.au>
On Mon, 26 Apr 2004 18:36:19 +1000, Gregory Toomey <nospam@bigpond.com> wrote:
> Sam Holden wrote:
>
>> Perl programs can "leak" memory just fine thanks. Circular references are
>> one way, keeping around data that is no longer required is another.
>
> A MS WIndows "memory leak" occurs when memory is allocated my malloc or
> similar, does not relase it, and loses track of it.
That's one (restrictive) definition of memory leak. However, the OP didn't
use the word "leak" anyway, so I can't see how it matters.
Both of my examples show programs whose memory usage grows over time,
which is what the OP talked about. If you want to introduce restrictive
terms which are irrelevant to the post that's fine, but don't expect
everyone to keep their discussion to your terms.
--
Sam Holden
------------------------------
Date: 26 Apr 2004 09:13:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: noob question: Trying to extract part of a string in a variable to another variable
Message-Id: <c6ijsj$bhh$1@mamenchi.zrz.TU-Berlin.DE>
Jürgen Exner <jurgenex@hotmail.com> wrote in comp.lang.perl.misc:
> cayenne wrote:
[...]
> > I've looked in books at the substr() function, but, I don't know how
> > to use regular expressions to find the offset point, etc.
>
> You don't.
Ah, but you do, though not in this case. The @- and @+ arrays are
there to support it.
Anno
------------------------------
Date: Mon, 26 Apr 2004 08:18:43 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: noob question: Trying to extract part of a string in a variable to another variable
Message-Id: <DB3jc.34657$GR.4663667@attbi_s01>
Sherm Pendley wrote:
> If your pattern has subexpressions, then on a match the
> offset of each subexpression appears in the @- array. That is, the offset
> of $1 is in $-[0], $2 is in $-[1], and so forth.
Incorrect. The offset of $& is in $-[0], the offset of $1 is in $-[1], etc.
-Joe
------------------------------
Date: Mon, 26 Apr 2004 16:55:42 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: slurp not working? ideas please!
Message-Id: <c6ifa0$c16pg$1@ID-227975.news.uni-berlin.de>
Geoff Cox wrote:
> On Sun, 25 Apr 2004 22:12:50 +0200, "Tassilo v. Parseval"
> <tassilo.parseval@rwth-aachen.de> wrote:
>
>>That is somewhat unfortunate as the problem in question does not occur
>>when I run your code. It's a bit tricky to address a bug that is not
>>reproducible.
>
> Tassilo,
>
> Have you seen the post from Keith? He also got the same wrong order as
> me! I have got part of his code working. You can see from my reply to
> him that I cannot see yet how the $text is sent to the results.htm
> file.
>
> Cheers
>
> Geoff
I think you misread my reply - or maybe it wasn't clear. The results I
get from your previous code are the *same* for both the 'test.htm' and
the 'results.htm' file, in other words like Tassilo I *can't* reproduce
your problem.
keith
------------------------------
Date: Mon, 26 Apr 2004 08:02:19 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: slurp not working? ideas please!
Message-Id: <pcgp801da7eiub2sp8cv8p4jg91srpnkh0@4ax.com>
On Mon, 26 Apr 2004 16:55:42 +0900, ko <kuujinbo@hotmail.com> wrote:
>I think you misread my reply - or maybe it wasn't clear. The results I
>get from your previous code are the *same* for both the 'test.htm' and
>the 'results.htm' file, in other words like Tassilo I *can't* reproduce
>your problem.
Keith,
sorry my mistake! hope you can have a look at my efforts with your own
code.
Cheers
Geoff
>
>keith
------------------------------
Date: Mon, 26 Apr 2004 08:03:53 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: slurp not working? ideas please!
Message-Id: <afgp80t3feg4dg7n0cs4o52kf1263c93vo@4ax.com>
On Mon, 26 Apr 2004 08:23:25 +0200, "Tassilo v. Parseval"
<tassilo.parseval@rwth-aachen.de> wrote:
> > I say that because I ran the code you supplied and the output file
> > *was* in the same order as your test.htm. Maybe the problem is
> > elsewhere?
>
>So I didn't make that up. The code you supplied was ok and should work.
>The fact that it doesn't means that the problem is indeed somewhere
>else. I suspected it could be buffering, but apparently it's not.
Tassilo,
sorry - my mistake. not sure where to go on that!
Cheers
Geoff
>
>Tassilo
------------------------------
Date: Mon, 26 Apr 2004 08:06:26 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: slurp not working? ideas please!
Message-Id: <5lgp80912v35s3001pf4m3taef23e0jcvg@4ax.com>
On Mon, 26 Apr 2004 08:40:13 +0200, "Tassilo v. Parseval"
<tassilo.parseval@rwth-aachen.de> wrote:
Tassilo,
thanks for the comments - below - will take note.
Cheers
Geoff
>The main difference to your previous subclassing approach is that you no
>longer need two namespaces (main and MyParser). It all runs in main.
>Furthermore, no file-handle needs to be passed around any longer. OUT is
>implicitly global.
>
>> use strict;
>> use warnings;
>> use HTML::Parser;
>>
>> my $data;
>> open (IN, "test.htm");
>> { local $/; $data = <IN> }
>>
>> my @to_print = qw[h2 p];
>> my @get_attr = qw[option];
>> my $current_tag = '';
>>
>> sub start_tag {
>> my ($tag, $attr, $text) = @_;
>> $current_tag = $tag;
>> ( grep { $current_tag eq $_ } @to_print )
>> ? print $text
>> # ? main::printtext($text)
>> # : print $attr->{value};
>> : main::choice( $attr->{value});
>
>Bah. That's a weird use of the ?: operator. Use a proper if:
>
> if (grep { $current_tag eq $_ } @to_print) {
> print OUT $text;
> } else {
> choice($attr->{value});
> }
>
>Note that you no longer need to package qualify choice(). It's all
>defined in package main already.
>
>> }
>>
>> sub default {
>> print shift if grep { $current_tag eq $_ } @to_print;
>
> print OUT shift if grep { $current_tag eq $_ } @to_print;
>
>> }
>>
>>
>> package main;
>
>This is no longer needed either.
>
>> open( OUT, ">>results.htm" )
>> || die "results.htm: $!"; #
>> print OUT ("<table width='100%' border='1'><tr> \n");
>>
>> my $parser = HTML::Parser->new
>> (
>> report_tags => [ @to_print, @get_attr ],
>> default_h => [ \&default, 'text' ],
>> start_h => [ \&start_tag, 'tagname, attr, text' ],
>> )->parse( $data ) or die $!;
>>
>>
>> sub printtext {
>> my $text = @_ ;
>> print OUT ("<p> $text </p> \n");
>> }
>>
>> sub choice {
>> my ($path) = @_;
>>
>> if ( $path =~ /docs\/gcse\/student-activities\/finance/ ) {
>> intro($path);
>> gcsestudentactivitiesfinance($path);
>
>All those functions (intro() etc.) may also use OUT as output
>file-handle. I can't say it often enough: It's all in the main package
>now.
>
>> } elsif ( $path =~ /docs\/gcse\/student-activities\/marketing/ ) {
>> intro($path);
>> gcsestudentactivitiesmarketing($path);
>> }
>>
>> }
>
>As you see, just printing to OUT is fine. All you have to ensure is that
>
> open OUT, ...
>
>happens before you use the file-handle. As far as I see, this is the
>case in your program.
>
>Tassilo
------------------------------
Date: Mon, 26 Apr 2004 08:28:44 GMT
From: Geoff Cox <geoffacox@dontspamblueyonder.co.uk>
Subject: Re: slurp not working? ideas please!
Message-Id: <9php80tj1jbbjnfe5vg0bqek1estqor1qr@4ax.com>
On Mon, 26 Apr 2004 08:40:13 +0200, "Tassilo v. Parseval"
<tassilo.parseval@rwth-aachen.de> wrote:
Tassilo and Keith,
When I use the line below- It produces the same *wrong* order, ie
<h2>first
<related text>
<h2>second
<related text>
then
first option data
second option data
rather than
<h2>first
<related text>
<related option data>
<h2>second
<related text>
<related option data>
So as you say Tassilo, it looks as if the problem is elsewhere...
Geoff
>rint OUT shift if grep { $current_tag eq $_ } @to_print;
------------------------------
Date: Mon, 26 Apr 2004 18:50:14 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: slurp not working? ideas please!
Message-Id: <c6im0p$c7pr5$1@ID-227975.news.uni-berlin.de>
Geoff Cox wrote:
> On Sun, 25 Apr 2004 00:03:12 +0900, ko <kuujinbo@hotmail.com> wrote:
>
> Keith,
>
> I am trying to implement your ideas but part is OK and part not ...
>
> I am able to use
>
> : main::choice( $attr->{value});
>
> to pass the option data to the sub choice, but not clear how to get
> the $text printed to OUT etc (ie into the results.htm file).
Tassilo explained this part quite well already, so I won't go over it again.
> Also, not clear how to stop the data being printed to the screen? This
> will tell you that I am not at all clear re how your code works!! eg
> have I structured the code correctly? Would really appreciate it if
> you could give brief explanation.
Before the explanation, if you're *really* going to understand either
this approach or Tassilo's, you need to go over the documentation again
- and again and again if necessary. And believe me, I understand that it
may be hard hard for you and can relate. First attempt at using
HTML::Parser was very frustrating (pretty much a novice, only have been
serious about *learning* Perl for about nine months, no other
programming experience) and I pretty much gave up in favor of using
HTML::Treebuilder, which has an interface that made more sense to me at
the time. Until you get a basic understanding of the documentation, you
will have problems with *either* approach.
> Cheers
>
> Geoff
[snip/rearranged]
> my $parser = HTML::Parser->new
> (
> report_tags => [ @to_print, @get_attr ],
> default_h => [ \&default, 'text' ],
> start_h => [ \&start_tag, 'tagname, attr, text' ],
> )->parse( $data ) or die $!;
>
To start, you pass the parser expicit options in the new() constructor.
The report_tags option/method basically skips processing any tag *not*
listed, so the *only* tags and related events processed are those specified.
The next two options, 'default_h' and 'start_h' are event handlers. Put
simply, the parser goes through the HTML and is able differentiate
between tags/text. You need to explicitly tell the parser what to do for
each event you are interested in by assigning a subroutine reference
(\&default and \&start_tag). The string after the code ref is an
'Argspec'. Its the information you are interested in, which will be
passed to the coderef - you can pass any number as long as they are valid.
[snip/rearranged]
> sub start_tag {
> my ($tag, $attr, $text) = @_;
> $current_tag = $tag;
> ( grep { $current_tag eq $_ } @to_print )
> ? print $text
> # ? main::printtext($text)
> # : print $attr->{value};
> : main::choice( $attr->{value});
> }
This handler will be invoked when any *start* tag is recognized. Again,
the only start tags which will be processed are 'h2', 'p', and 'option',
since you told the parser so with 'report_tags' in the constructor. The
Argspec is 'tagname, attr, text', which is what's passed to the sub.
So for instance, with the following markup:
<h2 id='id' align='center'>Level Two Heading</h2>
the variables are assigned:
$tag = 'h2';
$attr = { id => 'id', align => 'center' };
$text = "<h2 id='id' align='center'>";
Then you have to figure out what to do with the variables. You only want
to test for two conditions: (a) if $tag is 'h2' or 'p' print, else (b)
do something with the 'option' tag *if* it has a 'value' attribute. I
saw Tassilo's remark on my use of the ternary operator, which I like -
maybe I should have been more exlicit. Anyway, note that since you
already have everything in $text you don't have to bother hard-coding
the tag in like in your printtext sub.
> sub default {
> print shift if grep { $current_tag eq $_ } @to_print;
> }
This is the default handler, it will process everything *except* for
start tags, which has an explicit handler. Again, since we specified a
list of tags to process, we're only dealing with 'h2', 'p', and
'option'. Specifically, the sub processes (a) text *inside* of the
listed tags (text event), and (b) end tags (end event). Argspec was
specified as 'text', so with the same markup as above:
<h2 id='id' align='center'>Level Two Heading</h2>
The sub will print:
1. 'Level Two Heading' - text event
2. '</h2>' - end event
[snip]
Hope it makes sense, but I cannot stress how important it is for you to
go over the documentation - even if it doesn't make sense now it will
eventually. One suggestion is to go over the 'Argspec' section and if
nothing else play around with some code that prints out the values to
see what kind of information is available to you.
keith
------------------------------
Date: 26 Apr 2004 02:39:47 -0700
From: tigermott@yahoo.com (javatiger)
Subject: Re: Tripod wont find my lib files
Message-Id: <962e2a34.0404260139.38d7d137@posting.google.com>
What's "tripod"?
Its a free webhosting site with cgi, http://www.tripod.lycos.com/
This is the script that I have loaded into the cgi bin
-------------------------------------------------------------------
#!/usr/bin/perl
require "formparser.lib"; &parseform;
$txt = $formdata{'msg'};
$name = $formdata{'from'};
open( TXT, ">>messages.txt" );
print TXT "Message: $txt - From $name \n";
close(TXT);
open( DATA, "<messages.txt" );
@data = < DATA >;
close( DATA );
print "Content-type:text/html\n\n";
foreach $item(@data){ print "<li>$item"; }
------------------------------------------------------------------------
and ive uploaded the formparser lib
-------------------------------------------------------------------------
sub parseform
{
if( $ENV{'REQUEST_METHOD'} eq 'GET' )
{ @pairs = split( /&/, $ENV{'QUERY_STRING'} ); }
elsif( $ENV{'REQUEST_METHOD'} eq 'POST' )
{
read( STDIN, $buffer, $ENV{'CONTENT_LENGTH'} );
@pairs = split( /&/, $buffer );
if( $ENV{'QUERY_STRING'} )
{ @getpairs = split( /&/, $ENV{'QUERY_STRING'} );
push( @pairs, @getpairs ); }
}
else
{
print "Content-type:text/html\n\n";
print "Unrecognized Method - Use GET or POST.";
}
foreach $pair( @pairs )
{
( $key, $value ) = split( /=/, $pair );
$key =~ tr/+/ /;
$value =~ tr/+/ /;
$key =~ s/%(..)/pack("c", hex($1))/eg;
$value =~ s/%(..)/pack("c", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g; # ignore SSI
if( $formdata{$key} ){$formdata{$key} .= ", $value";}
else{ $formdata{$key} = $value; }
} }
1;
---------------------------------------------------------------------
But it throws the error.
Could you edit what need to be changed please.
---------------------------------------------------------------------
Bob Walton <invalid-email@rochester.rr.com> wrote in message news:<408C4F17.6030702@rochester.rr.com>...
> javatiger wrote:
>
> > Every time I upload a library file into my cgi bin, tripod refuses to
>
> -------------------------------------^^^^^^^^^^^^^^^
>
> What's "tripod"?
>
>
> > find it and comes up with an error.
> >
> > It looks like there was an error:
> >
> > Your script produced this error:
> > Can't locate File/Glob.pm in @INC (@INC contains: . / /lib /site_perl)
>
> ----------------------------------------------------^^^^^^^^^^^^^^^^^^^
>
> Is your "cgi bin" one of the above directories? (hint: your web server
> may not start your CGI routines with the current directory being the
> directory in which the CGI routines reside). If not, loading a "library
> file" there will do no good, as Perl is only searching the directories
> in @INC for library routines. Maybe you should instead load the
> "library file" into one of those directories. Or put a "use lib ..."
> statement into your program which tells Perl to search the place where
> you put the files.
>
>
> > at msg.pl line 8.
> > BEGIN failed--compilation aborted at msg.pl line 8.
> >
> ...
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6466
***************************************