[23331] in Perl-Users-Digest
Perl-Users Digest, Issue: 5551 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 23 18:10:44 2003
Date: Tue, 23 Sep 2003 15:10:11 -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 Tue, 23 Sep 2003 Volume: 10 Number: 5551
Today's topics:
Re: reading STDIN with Perl on Linux / Apache <Juha.Laiho@iki.fi>
Re: RegExp: Matching <cs@edu.edu>
Re: RegExp: Matching <tore@aursand.no>
Re: RegExp: Matching <tore@aursand.no>
Re: RegExp: Matching <cs@edu.edu>
Session Management: NO Cookies.... (Sucpraran)
Re: some proxies post and some won't with lwp (Anno Siegel)
Re: splitting lines (Mala Ananthamurthy)
Re: splitting lines (Mala Ananthamurthy)
Re: What wrong with my module? <kkeller-usenet@wombat.san-francisco.ca.us>
Re: What wrong with my module? (Great Deals)
Re: What wrong with my module? <noreply@gunnar.cc>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 Sep 2003 15:42:00 GMT
From: Juha Laiho <Juha.Laiho@iki.fi>
Subject: Re: reading STDIN with Perl on Linux / Apache
Message-Id: <bkppjk$ki2$2@ichaos.ichaos-int>
"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> said:
>"John Smith" <someone@microsoft.com> wrote in
>news:PLDbb.13752$Ej.1997190@ursa-nb00s0.nbnet.nb.ca:
>> It received this information from an HTML document that used the GET
>> method to send its form data to the perl script, such as:
>> <FORM method="get" action="/cgi-bin/script.pl">
>>
>> This worked fine, but the form data ends up as part of the URL, such
>> as:
>> http://domainname/cgi-bin/script.pl?year=2003&pwd=12345
Ok, change to method="POST", and adapt your script appropriately, and
you're done.
>Why not? It's not really any less secure than transmitting it via POST
>method.
The difference is that you don't see POST data from server logs, whereas
GET data will be logged. It's not a major difference, but at least I
feel more comfortable browsing server logs when the logs do not contain
passwords.
>> Here is a look at part of my script.
...
>Why go to all this work? CGI.pm does all of this for you, and more.
>You're already using CGI.pm. Just ask it what the query parameters are.
>Don't parse it all out yourself.
Heartily agreed.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
------------------------------
Date: Tue, 23 Sep 2003 11:55:53 -0700
From: Chief Squawtendrawpet <cs@edu.edu>
Subject: Re: RegExp: Matching
Message-Id: <3F709739.7E682F61@edu.edu>
Tore Aursand wrote:
> > /^\/var\/www\/html\/test(\/[^_].*|\/|$)$/
>
> Thanks for the answer. This regular expression doesn't work the way
> intended, however. It still matches on '/var/www/html/test/subdir/_foo/',
> which it should skip.
Not on my Perl. But you should use Martien's regex; it's simpler.
for (<DATA>){
chomp;
print "Match: $&\n" if /^\/var\/www\/html\/test(\/[^_].*|\/|$)$/;
}
__DATA__
/var/www/html/test/
/var/www/html/test
/var/www/html/test/2
/var/www/html/test/23/
/var/www/html/test/_foo/
# OUTPUT
Match: /var/www/html/test/
Match: /var/www/html/test
Match: /var/www/html/test/2
Match: /var/www/html/test/23/
------------------------------
Date: Tue, 23 Sep 2003 21:14:55 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: RegExp: Matching
Message-Id: <pan.2003.09.23.19.11.03.780188@aursand.no>
On Tue, 23 Sep 2003 11:55:53 -0700, Chief Squawtendrawpet wrote:
>>> /^\/var\/www\/html\/test(\/[^_].*|\/|$)$/
>> Thanks for the answer. This regular expression doesn't work the way
>> intended, however. It still matches on '/var/www/html/test/subdir/_foo/',
>> which it should skip.
> Not on my Perl.
Then something is wrong with your Perl, I assume. Remember that I don't
want the regular expression to match on "subdirectories of subdirectories"
either.
> for (<DATA>){
> chomp;
> print "Match: $&\n" if /^\/var\/www\/html\/test(\/[^_].*|\/|$)$/;
> }
> __DATA__
> /var/www/html/test/
> /var/www/html/test
> /var/www/html/test/2
> /var/www/html/test/23/
> /var/www/html/test/_foo/
So...
/var/www/html/test/subdir/_foo
...also matches, but it shouldn't. :-)
--
Tore Aursand <tore@aursand.no>
"You know the world is going crazy when the best rapper is white, the best
golfer is black, France is accusing US of arrogance and Germany doesn't
want to go to war."
------------------------------
Date: Tue, 23 Sep 2003 21:15:00 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: RegExp: Matching
Message-Id: <pan.2003.09.23.19.08.08.63631@aursand.no>
On Tue, 23 Sep 2003 10:35:40 +0000, Anno Siegel wrote:
> Indeed. In Perl, this would be a typical case where a single-regex
> match is possible, but a combination with other techniques simplifies
> things.
AFAIK, there's no way I can accomplish what I'm trying to do without doing
all this matching in _one_ regular expression.
Your regexp works _perfect_ in Perl, but doesn't seem to do the same in
Apache. Hard to debug in Apache, really, and I don't get any errors or
warnings when running a test on the configuration file.
However. I might have found a way round the whole problem, as I might
need to match _even more_. :-)
The problem is that I've written a quite tricky ApacheHandler. It needs
to handle _everything_ in '/var/www/html/Application/' and all the subdirs
(and their content), except sub-directories starting with '_'.
I now see that I might be able to do this matching in the ApacheHandler
itself...? Anyone know if it's possible to give the control back to
Apache from a Handler written by yourself?
Anyway. Guess alt.apache.configuration is the right place.
--
Tore Aursand <tore@aursand.no>
"You know the world is going crazy when the best rapper is white, the best
golfer is black, France is accusing US of arrogance and Germany doesn't
want to go to war."
------------------------------
Date: Tue, 23 Sep 2003 13:42:37 -0700
From: Chief Squawtendrawpet <cs@edu.edu>
Subject: Re: RegExp: Matching
Message-Id: <3F70B03D.78BB5C67@edu.edu>
Tore Aursand wrote:
> Then something is wrong with your Perl, I assume. Remember that I don't
> want the regular expression to match on "subdirectories of subdirectories"
> either.
My mistake for not reading carefully enough, though you could have nudged
us in the right direction had you included just one more entry in your
original sample data, and your OP didn't place any real emphasis on the
subdir-of-subdir issue. Sorry for the confusion.
Chief S.
------------------------------
Date: 23 Sep 2003 09:31:48 -0700
From: sucpraran@yahoo.com (Sucpraran)
Subject: Session Management: NO Cookies....
Message-Id: <938f9bf4.0309230831.796712c3@posting.google.com>
New to Perl, Apache world.
Like to get thoughts on maintaining session WITHOUT using Client Side
Cookies.
Our environment is Perl, Apache, Oracle DB, Unix OS.
What are the capabilities of Server side/Database session management
in this environment? We can't compromise on security and load
balancing (multiple servers).
Thanks
------------------------------
Date: 23 Sep 2003 15:13:10 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: some proxies post and some won't with lwp
Message-Id: <bkpnu6$s3m$1@mamenchi.zrz.TU-Berlin.DE>
Robert <robert@nrc.net> wrote in comp.lang.perl.misc:
> my bad for not researching more. The official RFC 2616 says the
> following: "The server refuses to accept the request without a defined
> Content-Length. The client MAY repeat the request if it adds a valid
> Content-Length header field containing the length of the message-body
> in the request message."
>
> So I added this:
> $request->header('content-length' => $content_length);
>
>
>
> -----------
>
> Gregory
>
> 1. I DID ask a question about Perl, (ahem... see above Perl solution).
No, you didn't. The solution (supposing it is a solution) was finding
the pertinent part of the RFC. That it can be implemented in Perl doesn't
make it a "Perl solution", or the problem a Perl problem.
> 2. Obviously years programming don't account for knowledge. It shows
> great arrogance and greater ignorance claiming to know it all.
Where is the claim to "know it all"? Gregory stated his ignorance of CGI,
despite many years of Perl programming. Looks like realistic self-assessment,
not arrogance.
> 3. I didn't ask for what many Perl programmers use. Especially one
> that can't anwser my question.
You post, we comment. You don't get to tell people what aspect of your
posting they comment on. Your dismissal of everyone who can't answer
your precious question -- on a group that doesn't talk about your type
of problem -- is the real arrogance displayed in this thread.
> 4. If you want to flame people for wanting answers, maybe you should
> understand the questions?
Not required. You don't have to understand a CGI question to know it's
off topic.
And you weren't flamed for wanting answers, you are flamed because you
insist in asking the wrong people.
[TOFU snipped]
Anno
------------------------------
Date: 23 Sep 2003 12:12:54 -0700
From: mala_mukund@yahoo.com (Mala Ananthamurthy)
Subject: Re: splitting lines
Message-Id: <11729251.0309231112.2d3b0e2e@posting.google.com>
Bob Smith <bobsmith@jippii.fi> wrote in message news:<3F6F2625.B949AE9@jippii.fi>...
> hi
> how to split text into lines?
> I have in a db whitespace delimited words forming chapters in one field,
> and I want to nicely put it on the page with max 30 or so characters per
> paragraph, after that line breaks should occur,
> but I can't figure out the regexp for doing it,
> any help much appreciated. Thank you
> /G
$outputline =~ s/(.{1,30})/$1\n/gs;
print "$outputline";
------------------------------
Date: 23 Sep 2003 12:56:11 -0700
From: mala_mukund@yahoo.com (Mala Ananthamurthy)
Subject: Re: splitting lines
Message-Id: <11729251.0309231156.527ab854@posting.google.com>
Bob Smith <bobsmith@jippii.fi> wrote in message news:<3F6F2625.B949AE9@jippii.fi>...
> hi
> how to split text into lines?
> I have in a db whitespace delimited words forming chapters in one field,
> and I want to nicely put it on the page with max 30 or so characters per
> paragraph, after that line breaks should occur,
> but I can't figure out the regexp for doing it,
> any help much appreciated. Thank you
> /G
#This one looks for space character
$outputline =~ s/(.{1,30})\s+/$1\n/gs;
print "$outputline";
------------------------------
Date: Tue, 23 Sep 2003 09:31:48 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: What wrong with my module?
Message-Id: <khspkb.tm1.ln@goaway.wombat.san-francisco.ca.us>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message
On 2003-09-23, Sam Holden <sholden@flexal.cs.usyd.edu.au> wrote:
>
> Do I really have to test everything on all possible architectures before
> I can take a guess at the cause of a problem?
No, of course that's unreasonable. I think Jeff's point is that you
shouldn't accuse someone of not using the code he's posted unless you're
*sure* it couldn't produce the posted output. (e.g., an error like
$my=; shouldn't parse on any platform) You could even phrase it more
like a question: "Are you *sure* that's the code you're running? Here's
what I get...."
Some might contend that, while we shouldn't have to know every nuance
of every platform, popular problems like a case-insensitive filesystem
should be considered when reading about a problem you can't reproduce.
Obviously this is a grey area of problem-solving.
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iEYEARECAAYFAj9wdXAACgkQhVcNCxZ5ID+HfACeKg6wDHMBT/kHVXjIHxI9H09C
mycAn0E773O5E1JL59x357FQ6MsgV20A
=8ZJq
-----END PGP SIGNATURE-----
------------------------------
Date: 23 Sep 2003 11:29:46 -0700
From: deals@slip-12-64-108-121.mis.prserv.net (Great Deals)
Subject: Re: What wrong with my module?
Message-Id: <cafe07c7.0309231029.635bebb2@posting.google.com>
here is the working one: the 1st mistake i made was the test.pm, it
does not call my local test.pm but some default test.pm, secondly i
missed the
our @ISA=qw(Exporter);
our @EXPORT=qw (getit2);
test2.pm:
#!/usr/bin/perl -w
package test2;
use strict;
use Exporter;
our @ISA=qw(Exporter);
our $abc;
our @EXPORT=qw (getit2);
sub getit2{
return $abc;
}
1;
__END__
in test2.pl:
#!/usr/bin/perl -w
use test2;
$abc='123';
$ab= getit2;
print "$ab\n";
print getit2;
My questtion is
our @ISA=qw(Exporter);
our @EXPORT=qw (getit2);
a must thing to declare?
Secondly, how the module use the global value in main? I want to set a
value $abc to 123 in test2.pl, but I also want to get this value in
module in test2.pm. I don't want to pass the value as a parameter,
because I am still learning the passing by ref.
If in sub ($para1){$para1='new value'}, will the global value of para1
will changed? or once the sub is finished the value will be reset just
as using local or my?
deals@slip-12-64-108-121.mis.prserv.net (Great Deals) wrote in message news:<cafe07c7.0309221908.221e911@posting.google.com>...
> I put a file called test.pm in the same dir as test.pl
>
> test.pm:
> #perl
> package test;
> sub getit (){
> return time;
> }
>
> test.pl:
> #perl
> use test;
>
> $ab= test::getit();
> print "$ab\n";
>
> the error is:
> Undefined subroutine &test::getit called at test.pl line 4.
------------------------------
Date: Tue, 23 Sep 2003 21:09:59 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: What wrong with my module?
Message-Id: <bkq5po$4ed53$1@ID-184292.news.uni-berlin.de>
Great Deals wrote:
> secondly i missed the
>
> our @ISA=qw(Exporter); our @EXPORT=qw (getit2);
That was not necessarily a mistake. An alternative is to fully qualify
the subroutine name as you did in the first post:
$ab = test2::getit2();
> Secondly, how the module use the global value in main? I want to
> set a value $abc to 123 in test2.pl, but I also want to get this
> value in module in test2.pm. I don't want to pass the value as a
> parameter, because I am still learning the passing by ref.
Right now you have two $abc variables: $main::abc and $test2::abc. You
set $main::abc in test2.pl, while the subroutine in test2.pm returns
the value of $test2::abc (which is empty).
Again, you can qualify the name:
return $main::abc;
Or you can export/import it (but then you need to skip $test2::abc).
> If in sub ($para1){$para1='new value'}, will the global value of
> para1 will changed? or once the sub is finished the value will be
> reset just as using local or my?
Not sure what you are talking about here.
You'd better do some reading and homework, right? A couple of pointers:
http://www.perldoc.com/perl5.8.0/pod/perlmod.html
http://www.perldoc.com/perl5.8.0/pod/perlintro.html#Variable-scoping
Good luck!
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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 5551
***************************************