[22455] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4676 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 6 18:06:10 2003

Date: Thu, 6 Mar 2003 15:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 6 Mar 2003     Volume: 10 Number: 4676

Today's topics:
    Re: CGI query string help <flavell@mail.cern.ch>
    Re: cookie-lib.pl won't delete cookies <me@privacy.net>
        dynamically define constants (Nan)
    Re: dynamically define constants <uri@stemsystems.com>
    Re: glob() function - limited number of parameters ? <nobull@mail.com>
    Re: Greedy regexps <asby@kinderen4kinderen.org>
    Re: Help with Inline::CPP.... (Anno Siegel)
    Re: Help with Inline::CPP.... <mgjv@tradingpost.com.au>
    Re: How can I write this regex? <goldbb2@earthlink.net>
    Re: How can I write this regex? (Sara)
    Re: How can I write this regex? (Anno Siegel)
    Re: How can I write this regex? (Sara)
        How do you match a \1? <mdudley@execonn.com>
    Re: How do you match a \1? <asby@kinderen4kinderen.org>
    Re: How do you match a \1? (Anno Siegel)
    Re: How do you match a \1? <nobull@mail.com>
    Re: How do you match a \1? <REMOVEsdnCAPS@comcast.net>
    Re: I  want to know the line n umber of the error ! <ericosman-nospam@rcn.com>
    Re: I  want to know the line n umber of the error ! <noreply@gunnar.cc>
    Re: I  want to know the line n umber of the error ! <ericosman-nospam@rcn.com>
    Re: I  want to know the line n umber of the error ! <tony_curtis32@yahoo.com>
    Re: I  want to know the line n umber of the error ! <ericosman-nospam@rcn.com>
    Re: I  want to know the line n umber of the error ! <REMOVEsdnCAPS@comcast.net>
    Re: I  want to know the line n umber of the error ! <me@privacy.net>
    Re: Lightweight CGI module? <bkennedy@hmsonline.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 6 Mar 2003 20:33:07 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI query string help
Message-Id: <Pine.LNX.4.53.0303062021240.21419@lxplus090.cern.ch>

On Thu, Mar 6, trwww inscribed on the eternal scroll:

> The only time you need to use url_param() is when you are mixing GET
> and POST.

To be pedantic: either the request is made with GET or with POST. They
cannot be literally "mixed".  What you really meant is clear from what
follows, of course:

> For instance, if your html form's method is set to POST and
> it's action attribute is set to:

news:alt.possessive.its.has.no.apostrophe

> http://server/prog.cgi?sessionID=0987654321&expires=1087654321

i.e you meant "a query string is supplied on the action URL" - in
which case your action should be either:

http://server/prog.cgi?sessionID=0987654321&amp;expires=1087654321

(note the &amp; separator) or:

http://server/prog.cgi?sessionID=0987654321;expires=1087654321

since your "&expires" would trigger an HTML syntax error.

(Even worse if it doesn't trigger a syntax error, e.g &copy !)

> But if the above parameters sessionID and expires are in hidden html
> input fields and the form's method is set to GET, you can just use the
> param() function to get your data.

Yes, "Mothra" did say:

| The params are in the url not the posted form

without, as far as I could see, any basis in the earlier thread for
making that assumption.

cheers


------------------------------

Date: Fri, 7 Mar 2003 08:04:22 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: cookie-lib.pl won't delete cookies
Message-Id: <b48d4n$1nipb5$1@ID-172104.news.dfncis.de>


"Marshall Dudley" <mdudley@execonn.com> wrote in message
news:3E667509.16CBC8E5@execonn.com...
> I am not sure if this is an IE problem, or a cookie-lib.pl problem.  But
> when I use the delete cookie subroutine of this library, it works fine
> with Netscape, but is ignored by IE.
>
> I have trapped the command cookie-lib.pl is sending and this is what is
> being sent when I am trying to delete the cookie:
>
> Set-Cookie: user-id=; expires=Thu, 01-Jan-1970 00:00:00 GMT; path=/
> Set-Cookie: password=; expires=Thu, 01-Jan-1970 00:00:00 GMT; path=/
>
> In these cases, the user-id and password still return the earlier
> cookie, which was written by the same library.
>
> Anyone have any ideas what the problem might be and how to get around
> it?

Never heard of cookie-lib.pl

Why aren't you using one of the more common Cookie modules?




------------------------------

Date: 6 Mar 2003 13:58:03 -0800
From: nandagopalj@hotmail.com (Nan)
Subject: dynamically define constants
Message-Id: <8193246.0303061358.18a08abc@posting.google.com>

All-

I need to read a data file containing "event numbers and event names
and build a list of constants dynamically in my perl program.

This following does not work (no surprise):
use constant "$constant_var_name" = 1000;


I tried eval() to execute a code block like below:
This does not work either..

>> -----
#!perl

$eventName = "FILE_READ_ERR";
$code = <<EOF;
    use constant $eventName => 1000;
EOF
eval ( $code );

$var = FILE_READ_ERR;

print $var;
>> -----

>> output:
FILE_READ_ERR


Is there any other way I can get this to work ?

Thanks
Nan.


------------------------------

Date: Thu, 06 Mar 2003 22:03:13 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: dynamically define constants
Message-Id: <x7of4oup9c.fsf@mail.sysarch.com>

>>>>> "N" == Nan  <nandagopalj@hotmail.com> writes:

  N> I need to read a data file containing "event numbers and event names
  N> and build a list of constants dynamically in my perl program.

if they are dynamic, then they are not constants. pick one or the other/

if you use the constants in the program, then you must know their names
in advance. 

  N> This following does not work (no surprise):
  N> use constant "$constant_var_name" = 1000;

regardless of the wrongness of the above there is no need for the quotes.

  N> I tried eval() to execute a code block like below:
  N> This does not work either..

  N> $eventName = "FILE_READ_ERR";
  N> $code = <<EOF;
  N>     use constant $eventName => 1000;
  N> EOF
  N> eval ( $code );

that is happening at run time. constants have to be defined at compile
time. wrap that code in a BEGIN block and it should work. i still have
doubts about your needing dynamic constants.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class


------------------------------

Date: 06 Mar 2003 19:04:25 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: glob() function - limited number of parameters ?
Message-Id: <u9d6l471vq.fsf@wcl-l.bham.ac.uk>

romuald_favre@hotmail.com (Romuald Favre) writes:

> I just made the experience that when there are more than about 300
> files in the directory, the function cannot be performed and the perl
> program just stop without giving any news...
> My deduction is that the glob function accept a limited number of
> parameters... Is that right ?

> Yes, In old versions (before v5.6.0).

> If yes, what is the alternative or the
> best workaround if i have to read simultaneously thousands of files a
> a directory ?

Use opendir/readdir or get a recent Perl.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Thu, 6 Mar 2003 21:04:44 +0100
From: "Asby" <asby@kinderen4kinderen.org>
Subject: Re: Greedy regexps
Message-Id: <3e67a9de$0$49114$e4fe514c@news.xs4all.nl>

"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnb6csul.4u0.tadmc@magna.augustmail.com...
> It is the easiest way to match *some* HTML.
>
> It won't match this for instance:
>
>    <td class="head1"> Income < Expenses </td>

True, and that's why people should use a html parser and not try to do the
parsing themself.


--
ttfn,

Asby
$_="qdjb3H kqdP qdgsnmA srtJ";y/a-y3/b-za/;print scalar reverse




------------------------------

Date: 6 Mar 2003 20:07:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Help with Inline::CPP....
Message-Id: <b489pn$gj4$2@mamenchi.zrz.TU-Berlin.DE>

Brian Snyder <bsnyder030174@yahoo.com> wrote in comp.lang.perl.misc:
> (First off, let me say this is a duplicate of a post I made to
> perl.inline newsgroup -- but that seems to be a dead group, so I
> thougth I'd try here)
> 
> Hi all,
> 
> I have successfully installed the latest, Inline, Inline::C, and
> Parse::RecDescent from CPAN and gone through the C Cookbook --
> everything is working fine.
> 
> Then I tried to install the Inline::CPP module from CPAN, and I
> thought the install worked fine -- at least the make process showed no
> errors. I have perl 5.6 on linux RH8.

[snip]

> -------------------------------------------------------------------
> Error. You have specified 'CPP' as an Inline programming language.
> 
> I currently only know about the following languages:
>     C, Foo, foo
> 
> If you have installed a support module for this language, try deleting
> the
> config file from the following Inline DIRECTORY, and run again:
> 
>     /home/bsnyder/inline/_Inline
> 
>  at ./gcp.pl line 0
> INIT failed--call queue aborted.
> ---------------------------------------------------------------------

That looks like a pretty clear description of what to do in this case.
Did you not try it?

Anno


------------------------------

Date: Thu, 06 Mar 2003 22:32:19 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Help with Inline::CPP....
Message-Id: <slrnb6fj3j.1s6.mgjv@verbruggen.comdyn.com.au>

On 6 Mar 2003 10:04:59 -0800,
	Brian Snyder <bsnyder030174@yahoo.com> wrote:

> Then I tried to install the Inline::CPP module from CPAN, and I
> thought the install worked fine -- at least the make process showed no
> errors. I have perl 5.6 on linux RH8.

[snip, part of error message now is:]

> If you have installed a support module for this language, try deleting the
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> config file from the following Inline DIRECTORY, and run again:
> 
>     /home/bsnyder/inline/_Inline

Did you delete the config file from that directory, as the rather
verbose and quite instructive error message tells you to do after you
installed support for a enw language?

Martien
-- 
                        | 
Martien Verbruggen      | Make it idiot proof and someone will make a
Trading Post Australia  | better idiot.
                        | 


------------------------------

Date: Thu, 06 Mar 2003 14:29:26 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How can I write this regex?
Message-Id: <3E67A196.46E1A0B@earthlink.net>

Janek Schleicher wrote:
> 
> Benjamin Goldberg wrote at Thu, 06 Mar 2003 00:40:18 -0500:
> 
> > Sara wrote:
> >>
> >> Occasionally I need to change patterns which are NOT preceeded (or
> >> followed, same difference) by certain other patterns. For example:
> >>
> >>   replace "dog" with "canine" if dog is not preceeded by "cat " or
> >> "mouse ".
> >
> >   s/(?!<cat )(?!<mouse )dog/canine/g;
>        ^^^      ^^^
> Didn't you mean
> ?<!
> instead for a negate look behind assertion ?!

Umm, yes.  That was a typo.

> > For "not followed by", the syntax is (?=stuff here).
>                                         ^^
> That's the syntax for "followed by".
> The syntax for "not folled by" is
> (?!stuff here)

ENOCAFFEINE

-- 
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print


------------------------------

Date: 6 Mar 2003 13:03:44 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: How can I write this regex?
Message-Id: <776e0325.0303061303.74d159f@posting.google.com>

Benjamin Goldberg <goldbb2@earthlink.net> wrote in message news:<3E66DF42.E3A1B29C@earthlink.net>...
> Sara wrote:
> > 
> > Occasionally I need to change patterns which are NOT preceeded (or
> > followed, same difference) by certain other patterns. For example:
> > 
> >   replace "dog" with "canine" if dog is not preceeded by "cat " or
> > "mouse ".
> 
>   s/(?!<cat )(?!<mouse )dog/canine/g;
> 
> 
> For "not followed by", the syntax is (?=stuff here).

Hmm I'm having some trouble getting this to work- it doesn't seem to
substitute at all?

-Gx


------------------------------

Date: 6 Mar 2003 22:11:24 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How can I write this regex?
Message-Id: <b48h2c$l7g$1@mamenchi.zrz.TU-Berlin.DE>

Sara <genericax@hotmail.com> wrote in comp.lang.perl.misc:
> Benjamin Goldberg <goldbb2@earthlink.net> wrote in message
> news:<3E66DF42.E3A1B29C@earthlink.net>...
> > Sara wrote:
> > > 
> > > Occasionally I need to change patterns which are NOT preceeded (or
> > > followed, same difference) by certain other patterns. For example:
> > > 
> > >   replace "dog" with "canine" if dog is not preceeded by "cat " or
> > > "mouse ".
> > 
> >   s/(?!<cat )(?!<mouse )dog/canine/g;
> > 
> > 
> > For "not followed by", the syntax is (?=stuff here).
> 
> Hmm I'm having some trouble getting this to work- it doesn't seem to
> substitute at all?

That's because, like everyone else, even Benjamin doesn't get lookaround
assertions right the first time.  This works:

    $_ = "ain't nothin' but a mouse dog, bird dog, cat dog, any dog\n";
    s/(?<!cat )(?<!mouse )dog/canine/g;

Anno


------------------------------

Date: 6 Mar 2003 14:28:09 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: How can I write this regex?
Message-Id: <776e0325.0303061428.38be4ebc@posting.google.com>

Bart Lateur <bart.lateur@pandora.be> wrote in message news:<juge6v0ie5oo5k6fiokqu7ka9i7nola4k5@4ax.com>...
> Sara wrote:
> 
> >  replace "dog" with "canine" if dog is not preceeded by "cat " or
> >"mouse ".
> 
> Another approach:
> 
> 	s/((?:cat|mouse) dog)|dog/$1 || 'canine'/ge;
> 
> The idea is to replace what you don't want replaced by itself, thereby
> effectively skipping it; and process the rest normally.

Thanks Bart, interesting idea. I like the logic.

Cheers have a great weekend- I'm off to Daytona bikeweek tonight! yay!

-Gx


------------------------------

Date: Thu, 06 Mar 2003 13:20:27 -0500
From: Marshall Dudley <mdudley@execonn.com>
Subject: How do you match a \1?
Message-Id: <3E67916A.F4971C14@execonn.com>

I have a library routine adding a \1 to things, and I need to strip them
out.  But the \1 is a backreference, and I cannot find any way to match
a binary 1 byte.

Thanks,

Marshall



------------------------------

Date: Thu, 6 Mar 2003 20:48:42 +0100
From: "Asby" <asby@kinderen4kinderen.org>
Subject: Re: How do you match a \1?
Message-Id: <3e67a61b$0$49112$e4fe514c@news.xs4all.nl>

"Marshall Dudley" <mdudley@execonn.com> wrote in message
news:3E67916A.F4971C14@execonn.com...
> I have a library routine adding a \1 to things, and I need to strip them
> out.  But the \1 is a backreference, and I cannot find any way to match
> a binary 1 byte.

You can escape a backslash with another one. So \\1 will match \1.


--
ttfn,

Asby
$_="qdjb3H kqdP qdgsnmA srtJ";y/a-y3/b-za/;print scalar reverse




------------------------------

Date: 6 Mar 2003 19:59:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How do you match a \1?
Message-Id: <b489b4$gj4$1@mamenchi.zrz.TU-Berlin.DE>

Asby <asby@kinderen4kinderen.org> wrote in comp.lang.perl.misc:
> "Marshall Dudley" <mdudley@execonn.com> wrote in message
> news:3E67916A.F4971C14@execonn.com...
> > I have a library routine adding a \1 to things, and I need to strip them
> > out.  But the \1 is a backreference, and I cannot find any way to match
> > a binary 1 byte.
> 
> You can escape a backslash with another one. So \\1 will match \1.

I believe you misunderstood the question.  The OP wants to match a character
whose bit pattern is a binary 1.

The answer is to specify it in octal, /\01/, or in hex /\x1/.

Anno


------------------------------

Date: 06 Mar 2003 20:00:01 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: How do you match a \1?
Message-Id: <u98yvs6zb2.fsf@wcl-l.bham.ac.uk>

"Asby" <asby@kinderen4kinderen.org> writes:

> "Marshall Dudley" <mdudley@execonn.com> wrote in message
> news:3E67916A.F4971C14@execonn.com...
> > I have a library routine adding a \1 to things, and I need to strip them
> > out.  But the \1 is a backreference, and I cannot find any way to match
> > a binary 1 byte.
> 
> You can escape a backslash with another one. So \\1 will match \1.

No, the OP does not want to match '\1' he wants to match "\1"

A few ways spring to mind...

  /\01/
  /\cA/
  /[\1]/

But then again if the OP used tr/\1//d the question would not have
arrisen.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Thu, 06 Mar 2003 15:34:30 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: How do you match a \1?
Message-Id: <Xns9336A877F78F9sdn.comcast@216.166.71.239>

Brian McCauley <nobull@mail.com> wrote in
news:u98yvs6zb2.fsf@wcl-l.bham.ac.uk: 

> No, the OP does not want to match '\1' he wants to match "\1"

Ow, my brain!   ;-)

-- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;


------------------------------

Date: Thu, 06 Mar 2003 14:52:21 -0500
From: Eric Osman <ericosman-nospam@rcn.com>
Subject: Re: I  want to know the line n umber of the error !
Message-Id: <3E67A6F5.5040805@rcn.com>


 > sub readPostInput() {
 >      my (%searchField, $buffer, $pair, @pairs);
 >      if ($ENV{'REQUEST_METHOD'} eq 'POST') {
 >          read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
 >          @pairs = split(/&/,$buffer);
 >          foreach $pair (@pairs) {
 >              ($name, $value) = split(/=/, $pair);
 >              $value =~ tr/+/ /;
 >              $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
 >              $name =~ tr/+/ /;
 >              $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
 >              $searchField{$name} = $value;
 >          }
 >      }
 >      return (%searchField);
 > }


> Use the CGI module like God intended you to.  If you use CGI.pm, you
> a) won't have to worry about any of the above problems; b) will be
> using functions that have been thoroughly debugged and tested
> hundreds of millions of times; c) won't have to worry about whether
> the data was sent with POST or GET; d) will be able to debug/test
> your program in a non-cgi environment (ie on the command-line).
> 
> WHY do people insist on reinventing the wheel??  You may as well try
> to carve your own fuel injector out of wood for your car instead of
> going down to the auto parts store and buying one off the shelf.
> 


Because one of the two Perl books I have ("Perl, CGI, and Javascript
Complete" published by Sybex) shows the code posted above.

And the other Perl book I have ("Programming Perl" published by
O'Reilly) seems to focus on the Perl itself and not even give examples
of CGI programs.

However, I will now learn how to find the CGI module and use it.  Then
I'll consider installing apache on my local machine.

Thanks.  /Eric



------------------------------

Date: Thu, 06 Mar 2003 20:57:51 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: I  want to know the line n umber of the error !
Message-Id: <b48972$1nt8db$1@ID-184292.news.dfncis.de>

Eric J. Roode wrote:
> Do NOT attempt to parse CGI input yourself.  Only geniuses and morons
> do that -- and the geniuses don't do that unless they have a VERY
> good reason.
> 
> [snip]
> 
> Use the CGI module like God intended you to.  If you use CGI.pm, you
> a) won't have to worry about any of the above problems; b) will be
> using functions that have been thoroughly debugged and tested
> hundreds of millions of times; c) won't have to worry about whether
> the data was sent with POST or GET; d) will be able to debug/test
> your program in a non-cgi environment (ie on the command-line).
> 
> WHY do people insist on reinventing the wheel??

Hey, one of the morons speaking. ;-)

You know what, Eric? I'm convinced that the vast majority of those who 
take every chance to praise CGI.pm previously reinvented the wheel, over 
and over again. They did it until they had learned all the stuff you are 
mentioning, among other things. Then, when they felt quite comfortable 
about the CGI 'secrets', but only then, they discovered a module that 
could make the coding work easier.

About three years ago I started to write my first 'real' program ever. 
It was a CGI application, written in Perl. At that time, CGI.pm was not 
'the obvious' choice, at least not as far as I was aware of...  I have 
never regretted that wrote it without using either CGI.pm or cgi-lib.pl, 
since it forced me to learn a lot more about CGI than else would have 
been the case. That knowledge has been invaluable when providing support 
to the users of my application, who typically know very little about 
both Perl and CGI.

Just a thought.

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Thu, 06 Mar 2003 15:26:47 -0500
From: Eric Osman <ericosman-nospam@rcn.com>
Subject: Re: I  want to know the line n umber of the error !
Message-Id: <3E67AF07.1040404@rcn.com>



Tore Aursand wrote:


> Why split?  This code will do the same thing, AFAIK, and is using CGI.pm
> instead.  Not tested;
> 
> ----
> #!/usr/bin/perl
> #
> use strict;
> use warnings;
>  . . .


Well, I tested it and those two lines, the one with "strict" and the one
with "warnings", give problems.  If I leave out BOTH lines, the
following code works:

#!/usr/bin/perl
use CGI qw(:cgi);
use CGI::Carp qw(fatalsToBrowser);
use Regexp::Common qw /URI/;
print "Content-type: text/html\n\n";
my $cgi = CGI->new();
my $dcWhole = $cgi->param('digestContents') || die "$!";
@dcLines = split (/\r\n/ , $dcWhole);
$outName = "out.txt";
  open (outChan, ">$outName") || die "$!";
#  print "<textarea>\n";
     foreach $dcLine (@dcLines) {
         $dcLine =~ s#<#&lt;#g;
         $dcLine =~ s#>#&gt;#g;
         while($dcLine =~ s#  #&nbsp; #g) {};
         $dcLine =~ s#(.+)#<DIV>$1</DIV>#;
         $dcLine =~ s#$RE{URI}{HTTP}{-keep}#<A 
href="$1"\nEUDORA="AUTOURL">$1</A>#g;
         $dcLine =~ s#(mailto:[\w-@?=\.]+)#<A 
href="$1"\nEUDORA="AUTOURL">$1</A>#g;
         print "$dcLine\n";
         print outChan "$dcLine\n";
         }
# print "</textarea>\n";
print "Done scanning\n";
close (outChan);



However, if I attempt to put in the "strict" and "warning" lines, I get
this error from the server:

       Internal Server Error
       The server encountered an internal error or misconfiguration and 
     was unable to complete your request.

       Please contact the server administrator, webmaster@rcn.com and 
inform them of the time the error occurred, and anything you might have 
done that may have caused the error.

       More information about this error may be available in the server 
error log.

        Additionally, a 404 Not Found error was encountered while trying 
to use an ErrorDocument to handle the request.
Apache/1.3.26 Server at cgibin.rcn.com Port 80


If I only use the "strict" line, I get this error from the server:

        Software error:

        Execution of /htdocs/e/r/ericosman/cgi-bin/reFormat.pl aborted 
due to compilation errors.

         For help, please send mail to the webmaster 
(webmaster@rcn.com), giving this error message and the time and date of 
the error.




Maybe once I have apache server running locally the reason for these
errors will become apparent .  /Eric



------------------------------

Date: Thu, 06 Mar 2003 14:27:39 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: I  want to know the line n umber of the error !
Message-Id: <87isuwdyv8.fsf@limey.hpcc.uh.edu>

>> On Thu, 06 Mar 2003 15:26:47 -0500,
>> Eric Osman <ericosman-nospam@rcn.com> said:

>> Why split?  This code will do the same thing, AFAIK,
>> and is using CGI.pm instead.  Not tested; ----
>> #!/usr/bin/perl # use strict; use warnings; . . .

> Well, I tested it and those two lines, the one with
> "strict" and the one with "warnings", give problems.  If
> I leave out BOTH lines, the following code works:

>        Internal Server Error The server encountered an
> internal error or misconfiguration and was unable to
> complete your request.

What happens when you test the code locally on the
command-line with strict and warnings enabled?  That
should be *very* enlightening.

    $ perl -cw program

hth
t


------------------------------

Date: Thu, 06 Mar 2003 15:29:54 -0500
From: Eric Osman <ericosman-nospam@rcn.com>
Subject: Re: I  want to know the line n umber of the error !
Message-Id: <3E67AFC2.1090408@rcn.com>



Gunnar Hjalmarsson wrote:
> About three years ago I started to write my first 'real' program ever. 
> It was a CGI application, written in Perl. At that time, CGI.pm was not 
> 'the obvious' choice, at least not as far as I was aware of...  I have 
> never regretted that wrote it without using either CGI.pm or cgi-lib.pl, 
> since it forced me to learn a lot more about CGI than else would have 
> been the case. That knowledge has been invaluable when providing support 
> to the users of my application, who typically know very little about 
> both Perl and CGI.
> 
> Just a thought.
> 
> / Gunnar
> 



yes, that is a good thought.  I did some serious studying of this
routine, the one I've been "B rated" for using :

 > sub readPostInput() {
 >      my (%searchField, $buffer, $pair, @pairs);
 >      if ($ENV{'REQUEST_METHOD'} eq 'POST') {
 >          read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
 >          @pairs = split(/&/,$buffer);
 >          foreach $pair (@pairs) {
 >              ($name, $value) = split(/=/, $pair);
 >              $value =~ tr/+/ /;
 >              $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
 >              $name =~ tr/+/ /;
 >              $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
 >              $searchField{$name} = $value;
 >          }
 >      }
 >      return (%searchField);


and I learned alot about HTML packing, Perl expressions, and arrays,
just from studying it.

So I agree with you.

/Eric



------------------------------

Date: Thu, 06 Mar 2003 15:28:27 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: I  want to know the line n umber of the error !
Message-Id: <Xns9336A7717C634sdn.comcast@216.166.71.239>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in
news:b48972$1nt8db$1@ID-184292.news.dfncis.de:

> Hey, one of the morons speaking. ;-)

Hey, nothing personal.  ;-)


> You know what, Eric? I'm convinced that the vast majority of those
who 
> take every chance to praise CGI.pm previously reinvented the wheel,
over 
> and over again. They did it until they had learned all the stuff
you are 
> mentioning, among other things. Then, when they felt quite
comfortable 
> about the CGI 'secrets', but only then, they discovered a module
that 
> could make the coding work easier.

Mmmmaybe.  Or maybe they just don't know better. :-)   Anyhow,
whenever I see a broken form parsing routine (invariably invoked with
an ampersand!), I feel compelled to point out a better way.  And
maybe rant a bit.

- -- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13

iD8DBQE+Z70/Y96i4h5M0egRAk4uAJ9wjb+Rq6PJ2XH4PC7xYZDImQ/BaQCg1xpk
P/hrBBcNJ5+wTqt0OT+hYek=
=C30M
-----END PGP SIGNATURE-----


------------------------------

Date: Fri, 7 Mar 2003 08:36:52 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: I  want to know the line n umber of the error !
Message-Id: <b48f1m$1tbtoe$1@ID-172104.news.dfncis.de>


"Eric Osman" <ericosman-nospam@rcn.com> wrote in message
news:3E67A6F5.5040805@rcn.com...
> However, I will now learn how to find the CGI module and use it.  Then
> I'll consider installing apache on my local machine.

No need to look for the CGI module, it has been included in the standard
Perl distribution for years.




------------------------------

Date: Thu, 6 Mar 2003 14:24:28 -0500
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: Lightweight CGI module?
Message-Id: <tqGcnQJSiMNdPfqjXTWc2Q@giganews.com>


"Tore Aursand" <tore@aursand.no> wrote in message
news:pan.2003.03.06.18.38.53.925147@aursand.no...
>
> I think you're missing my main point here;  I'm only talking about the CGI
> module here;  "All" the other modules I can somehow cache in memory, so I
> don't care about them.

What makes you think you can cache everything but CGI.pm?  If you are not
running mod_perl or an equivalent solution, you are reloading every module
every time the new interpreter starts.

> The CGI module, however, can't be cached as I need the fresh parameters on
> each startup.  I can't compile it either, as I won't be running this thing
> under mod_perl (for the most of the time, I guess).

Again, either you have a misunderstanding of how CGI (the interface) works,
or we are missing something about your implementation.  Furthermore, even a
persistently loaded (cached) CGI.pm works just fine - simply create a new
query object.

> And - I'm not _really_ that much concerned about the performance;  I just
> see that just _loading_ CGI.pm takes too long compared to "everything
> else".  So I want to remove the CGI.pm bottleneck. :)

My (and others as well) point is that it isn't really a bottleneck at all,
and your original question is moot.  If CGI.pm were a true bottleneck (in
the sense that interferes with business requirements), then the help
received by switching to another CGI module would be inconsequential, and
there's nothing that can be done other than a mod_perl-style solution.  Just
because something is slow or could possibly made faster doesn't mean its a
bottleneck.

--Ben Kennedy




------------------------------

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.  

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 4676
***************************************


home help back first fref pref prev next nref lref last post