[18741] in Perl-Users-Digest
Perl-Users Digest, Issue: 909 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 15 18:10:52 2001
Date: Tue, 15 May 2001 15:10:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <989964619-v10-i909@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 15 May 2001 Volume: 10 Number: 909
Today's topics:
Re: static values in a subroutine <ren@tivoli.com>
Subroutine XXXXX redefined at <jason@jasnik.net>
Re: Taint <uri@sysarch.com>
Re: Taint <joe+usenet@sunstarsys.com>
Re: Taint <joe+usenet@sunstarsys.com>
Re: Taint <bart.lateur@skynet.be>
Re: Taint <ren@tivoli.com>
Re: Taint (Anno Siegel)
Re: testing offline (Abigail)
Re: Urgent: CGI program wanted <muksca@hotmail.com>
Re: Urgent: CGI program wanted <michael@stroeck.com>
Re: Urgent: CGI program wanted <flavell@mail.cern.ch>
Re: Urgent: CGI program wanted <AgitatorsBand@yahoo.com>
Re: What is wrong with my Regular Expression? (Anno Siegel)
Re: What is wrong with my Regular Expression? <godzilla@stomp.stomp.tokyo>
Re: What is wrong with my Regular Expression? (Anno Siegel)
Re: What is wrong with my Regular Expression? (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 15 May 2001 14:29:52 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: static values in a subroutine
Message-Id: <m366f2jtqn.fsf@dhcp9-172.support.tivoli.com>
On Tue, 15 May 2001, bart.lateur@skynet.be wrote:
> Save, er, declare them outside your sub. You can even share a
> variable between two subs this way. Unless the code is in a "used"
> module, you might need to initialize the variable in a BEGIN block.
>
> {
> my $foo; # variable static and shared
> BEGIN {
> $foo = "starting value";
> }
> sub foo1 {
> $foo = shift;
> }
> sub foo2 {
> return $foo;
> }
> }
You can often get away with making the bare block the BEGIN block:
#!/usr/bin/perl
use warnings;
use strict;
print foo2();
foo1("new value");
print foo2();
BEGIN {
my $foo = "starting value";
sub foo1 { $foo = shift }
sub foo2 { return $foo }
}
__END__
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Tue, 15 May 2001 17:33:40 -0400
From: Jason Czerak <jason@jasnik.net>
Subject: Subroutine XXXXX redefined at
Message-Id: <3B01A0B4.4030906@jasnik.net>
This problem I am having has been discussed a few years
back. I'll draw things out a little to make this easier.
/index.pl
and
/member/index.pl
they both have module files for thier functions.
They are located in /vhost/domains.com/lib/test.pm and
/vhost/domains/lib/member/test.pm
when I call /index.pl it loads correctly. I load
/member/index.pl and it load correctly. eventually if you
hit reload enough they will get mixed up.
internally they work the same as in that use simular calls.
index.pl calls test.pm like this &foo::maintest();
that's where things are messing up. I get errors in the logs
about subroutines redefined this and that.
This also happens across Virtual domains as well as within
the domain.
In the index.pl I found that if I use 'do "/path/to/test.pm"'
as apposed to 'require "/path/to/test.pm"' thigns appear to
work fine.
At the same time as things appearing to work fine, I'm not
sure Apache::Registry or Apache::RegistryNG is caching the
compiled code becuase when I edit the perl files and reload,
it knows of the changes and i do not have any debugging
enabled anywhere. So I don't C y it's checking to recompile
code, it shouldn't. unless this is normal in mod_perl 1.25
making the debugging illrevelent.
Anyways. if some one could shed some light on the subject
here it woudl be great.
To recap, I need full mod_perl, to work over multi v-domains
with multi scrips per domain. I am running dual apache
servers. one for static content and one for dynamic content,
I'm using Documenroot as the CGI bin for the dynamic servers
to make things simple (this COULD be the root of the problem
also, I dunno tho.)
--
Jason J. Czerak (Jason-Czerak@Jasnik.net)
Jasnik Services, LLC
http://www.Jasnik.net
------------------------------
Date: Tue, 15 May 2001 19:41:41 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Taint
Message-Id: <x7zoce8kne.fsf@home.sysarch.com>
>>>>> "D" == Dodger <dodger@necrosoft.net> writes:
>> > It can, if there's a newline in the string.
>>
>> You are right!
>>
>> $ perl -wle 'print "matched" if "\n" =~ /^(.*)$/'
>> matched
>> $ perl -wle 'print "matched" if "\na" =~ /^(.*)$/'
>> $
D> sub untaint ($) { local $/ = undef and /^(.*)$/ and return $1; }
huh???? how does $/ affect matching a newline in a regex? $/ only
affects reading files.
and why the and? in fact the = undef will work and should return false
so the untainting will never occur.
two bugs in one!
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: 15 May 2001 15:51:23 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Taint
Message-Id: <m3d79a1jd0.fsf@mumonkan.sunstarsys.com>
"Dodger" <dodger@necrosoft.net> writes:
> > On Tue, 15 May 2001 06:02:24 GMT, Bart Lateur <bart.lateur@skynet.be>
> wrote:
> > > Garry Williams wrote:
> > >
> > >>> sub untaint ($) { /^(.*)$/ and return $1; }
> > >>
> > >>That's what perlsec says to do, if you must. (Although the
> > >>short-circuit is superfluous, since the match can never fail.)
> > >
> > > It can, if there's a newline in the string.
> >
> > You are right!
> >
> > $ perl -wle 'print "matched" if "\n" =~ /^(.*)$/'
> > matched
> > $ perl -wle 'print "matched" if "\na" =~ /^(.*)$/'
> > $
> >
> > Oops. :-)
>
> Hmm. Good point.
>
> sub untaint ($) { local $/ = undef and /^(.*)$/ and return $1; }
Well, this will always return an untainted variable, but probably not
the one you have in mind. Also, look for the s-modifier in your
perlre docs.
--
Quintessential Williams: enable open-source channels
------------------------------
Date: 15 May 2001 16:03:51 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Taint
Message-Id: <m38zjy1is8.fsf@mumonkan.sunstarsys.com>
Uri Guttman <uri@sysarch.com> writes:
> >>>>> "D" == Dodger <dodger@necrosoft.net> writes:
> D> sub untaint ($) { local $/ = undef and /^(.*)$/ and return $1; }
>
> huh???? how does $/ affect matching a newline in a regex? $/ only
> affects reading files.
>
> and why the and? in fact the = undef will work and should return false
> so the untainting will never occur.
>
> two bugs in one!
Just two? Wnat variable is that pattern supposed to match?
--
Quintessential Williams: e-enable user-centric systems
------------------------------
Date: Tue, 15 May 2001 20:25:44 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Taint
Message-Id: <d643gtk111oifs252ibgpefqnjp60ksqdf@4ax.com>
Dodger wrote:
>Hmm. Good point.
>
>sub untaint ($) { local $/ = undef and /^(.*)$/ and return $1; }
?????????????????
sub untaint ($) { /^(.*)$/s and return $1; }
At least you should replace the first "and" with ";".
--
Bart.
------------------------------
Date: 15 May 2001 15:08:56 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Taint
Message-Id: <m31ypqjrxj.fsf@dhcp9-172.support.tivoli.com>
On Tue, 15 May 2001, dodger@necrosoft.net wrote:
> "Garry Williams" <garry@ifr.zvolve.net> wrote in message
> news:slrn9g20pm.1e3.garry@zfw.zvolve.net...
>> On Tue, 15 May 2001 06:02:24 GMT, Bart Lateur
>> <bart.lateur@skynet.be>
> wrote:
>> > Garry Williams wrote:
>> >
>> >>> sub untaint ($) { /^(.*)$/ and return $1; }
>> >>
>> >>That's what perlsec says to do, if you must. (Although the
>> >>short-circuit is superfluous, since the match can never fail.)
>> >
>> > It can, if there's a newline in the string.
>>
>> You are right!
>>
>> $ perl -wle 'print "matched" if "\n" =~ /^(.*)$/'
>> matched
>> $ perl -wle 'print "matched" if "\na" =~ /^(.*)$/'
>> $
>>
>> Oops. :-)
>
> Hmm. Good point.
>
> sub untaint ($) { local $/ = undef and /^(.*)$/ and return $1; }
Eh? $/ has nothing to with this, and using a prototype of ($) but then
doing the work on $_ seems quite non-intuitive.
Perhaps you meant:
sub untaint ($) { $_[0] =~ /^(.*)$/s; return $1 }
or even:
sub untaint ($) { ($_[0]=~/^(.*)$/s)[0] }
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 15 May 2001 21:31:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Taint
Message-Id: <9ds77q$s34$1@mamenchi.zrz.TU-Berlin.DE>
According to Bart Lateur <bart.lateur@skynet.be>:
> Dodger wrote:
>
> >Hmm. Good point.
> >
> >sub untaint ($) { local $/ = undef and /^(.*)$/ and return $1; }
>
> ?????????????????
>
> sub untaint ($) { /^(.*)$/s and return $1; }
>
> At least you should replace the first "and" with ";".
I get the impression this guy is trolling. Within 48 hours he has
managed to post three distinct code examples that don't untaint
a string, each time claiming they do. That can't be for real, can it?
Anno
------------------------------
Date: Tue, 15 May 2001 19:38:02 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: testing offline
Message-Id: <slrn9g31cq.k6b.abigail@tsathoggua.rlyeh.net>
Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMDCCCXIV September
MCMXCIII in <URL:news:slrn9g26ae.v5e.mgjv@martien.heliotrope.home>:
)) On Mon, 14 May 2001 19:24:38 +0000 (UTC),
)) Abigail <abigail@foad.org> wrote:
)) > Amelia Clarke (stu00ac@rdg.ac.uk) wrote on MMDCCCXI September MCMXCIII in
)) ><URL:news:3AFD7E04.F4408DC9@rdg.ac.uk>:
)) > '' I'm fairly new to perl and have been using it to make cgi scripts - the
)) > '' only thing is, I'd like to be able to test them fully offline. Is there
)) > '' a (free) program I can download to allow me to do this?
)) >
)) > Sure. I'd say Apache is the most common.
))
)) Even Apache doesn't work offline. It needs at least one running CPU.
The dumb terminal of yesteryear is todays Intel box running Windows.
As stupid as its predecessor, but one with a CPU in it.
Abigail
--
:;$:=~s:
-:;another Perl Hacker
:;chop
$:;$:=~y:;::d;print+Just.$:
------------------------------
Date: Tue, 15 May 2001 20:41:59 +0100
From: "muksca" <muksca@hotmail.com>
Subject: Re: Urgent: CGI program wanted
Message-Id: <tg3190q5t1d54b@corp.supernews.co.uk>
Actually I'm only a graphics designer working freelance for the company.
I said that I would agree to using the URL in my sig.
Im trying to learn something new here but thanks anyway for the link.
--
NO NONSENSE professional Websites:
www.your-new-site.com
"Michael Ströck" <michael@stroeck.com> wrote in message
news:3b011357$1@e-post.inode.at...
> "muksca" <muksca@hotmail.com> schrieb :
>
> > Sorry to ask here only for weeks now I have tried other groups and
> resources
> > to no avail.
> > Anyone here have or know of a perl script which does (or modification)
the
> > following...
>
> <snip>
>
> > NO NONSENSE professional Websites:
> > www.your-new-site.com
>
> 1 ) If you have even basic knowledge about programming, you could
> have written that script yourself within one to three days without prior
> knowledge about Perl.
> And in weeks... Even a complete and utter moron should be able
> to learn that much Perl ;-)
>
> 2) A 1-minute google-search turned up with more than a dozen of websites
> like the following:
> http://cgi.resourceindex.com/Programs_and_Scripts/Perl/File_Management/
>
> 3) Do you think that lying (sig and website) to potential customers
> is a good idea ?
>
>
> Michael Ströck
>
>
------------------------------
Date: Tue, 15 May 2001 22:13:02 +0200
From: "Michael Ströck" <michael@stroeck.com>
Subject: Re: Urgent: CGI program wanted
Message-Id: <3b018da4$1@e-post.inode.at>
"muksca" <muksca@hotmail.com> schrieb :
> Actually I'm only a graphics designer working freelance for the company.
> I said that I would agree to using the URL in my sig.
> Im trying to learn something new here but thanks anyway for the link.
>
> --
> NO NONSENSE professional Websites:
> www.your-new-site.com
Well, that's the point people are trying to make : Show how you tried
to do something yourself, and in my experience you are likely to get lots
of replies pointing out errors / giving you hints to the right resources.
BTW: If you use a fake mail-adress, use one I that people won't
try to email :-) Like TRY_AND_SPAM_MEaccount@domain.com :-)
Happy programming.
Michael Ströck
------------------------------
Date: Tue, 15 May 2001 22:24:31 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Urgent: CGI program wanted
Message-Id: <Pine.LNX.4.30.0105152221340.29163-100000@lxplus003.cern.ch>
On Tue, 15 May 2001, Michael Ströck wrote:
> BTW: If you use a fake mail-adress, use one I that people won't
> try to email :-) Like TRY_AND_SPAM_MEaccount@domain.com :-)
Don't use fake email addresses that end in valid top-level domains.
(The reasons should be obvious). If you really must, then use
.invalid as the TLD.
(We now return you to your normal programming on this group...)
------------------------------
Date: Tue, 15 May 2001 21:32:56 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Urgent: CGI program wanted
Message-Id: <cghM6.745$du2.68512@news.shore.net>
muksca <muksca@hotmail.com> wrote:
: Actually I'm only a graphics designer working freelance for the company.
: I said that I would agree to using the URL in my sig.
: Im trying to learn something new here but thanks anyway for the link.
If you're trying to learn Perl from the ground up, your best bet is Randal
Schwarz's book "Learning Perl" published by O'Reilly & Associates.
And, as someone else pointed out, you'll get a much better response in
this group if you post something along the lines of "Here's what I
tried; what am I doing wrong?" rather than "How do I do this?"
--Art
------------------------------
Date: 15 May 2001 18:32:12 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: What is wrong with my Regular Expression?
Message-Id: <9drsnc$l5k$1@mamenchi.zrz.TU-Berlin.DE>
According to Godzilla! <godzilla@stomp.stomp.tokyo>:
> Eric Bohlman wrote:
>
> > Randal L. Schwartz wrote:
>
> > > I think what you're doing often spreads inffective Perl memes, which I
> > > then end up having to correct when I do code reviews or maintenance
> > > rewrites for large companies. So in some senses, you're making
> > > billable work for me. :) Why should I hate you for that? :)
>
> > I'd just like to point out that ineffective or incorrect Perl memes make
> > it all that much harder to convince managers that Perl should be used in
> > an organization, and that this is much more of a problem than with
> > ineffective VB, Java or C++ memes because Perl doesn't have slick
> > marketing behind it. So spreading bad code memes hurts the entire Perl
> > community.
>
>
> You are faced with a problem of who decides what is bad
> coding and what rules are to be applied to decide what is
> bad coding. Programming is an art, not a paradigm.
No, programming is a craft that is being developed by the programming
community. We don't have formal mastership, but some voices definitely
and rightly carry more weight than others when it comes to defining
what is practice of the guild.
As to art, that's entirely subjective. I have seen programs I consider
works of art, but yours are not among them.
Anno
[...]
------------------------------
Date: Tue, 15 May 2001 12:11:57 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: What is wrong with my Regular Expression?
Message-Id: <3B017F7D.F5F658A5@stomp.stomp.tokyo>
Anno Siegel wrote:
> Godzilla! wrote:
> > Eric Bohlman wrote:
> > > Randal L. Schwartz wrote:
(snipped)
> > You are faced with a problem of who decides what is bad
> > coding and what rules are to be applied to decide what is
> > bad coding. Programming is an art, not a paradigm.
(unnoted snippage by Siegal, context deliberately changed)
> No, programming is a craft that is being developed by the programming
> community. We don't have formal mastership, but some voices definitely
> and rightly carry more weight than others when it comes to defining
> what is practice of the guild.
I am not a member of your guild. I am a rogue programmer.
I reside with few others out here on the ever so imaginative
creative fringe. I am the Andret Warhol of Perl.
> As to art, that's entirely subjective. I have seen programs
> I consider works of art, but yours are not among them.
You have never engaged nor read my programs.
You are not an artist. I am, an artist, a masquer,
whom does not play your maladroit masquerade game.
Godzilla!
--
This Masquerade
http://la.znet.com/~callgirl3/masq.mid
------------------------------
Date: 15 May 2001 21:37:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: What is wrong with my Regular Expression?
Message-Id: <9ds7jm$s34$3@mamenchi.zrz.TU-Berlin.DE>
According to Godzilla! <godzilla@stomp.stomp.tokyo>:
> Anno Siegel wrote:
>
> > Godzilla! wrote:
> > > Eric Bohlman wrote:
> > > > Randal L. Schwartz wrote:
>
> (snipped)
>
> > > You are faced with a problem of who decides what is bad
> > > coding and what rules are to be applied to decide what is
> > > bad coding. Programming is an art, not a paradigm.
>
>
> (unnoted snippage by Siegal, context deliberately changed)
I did indicate my snip.
>
> > No, programming is a craft that is being developed by the programming
> > community. We don't have formal mastership, but some voices definitely
> > and rightly carry more weight than others when it comes to defining
> > what is practice of the guild.
>
> I am not a member of your guild. I am a rogue programmer.
> I reside with few others out here on the ever so imaginative
> creative fringe. I am the Andret Warhol of Perl.
No you're not a member, and that's fine with me. There's room
enough for unconventional programming styles, yours included.
Just don't propagate it as state-of-the-art, because it isn't.
Personally, it doesn't remind me so much of subversive glory than
of grandmotherly crochet work (with not all the threads all the
time where they belong), but that's just me. How close that puts
you to Andy Warhol is another question entirely.
[rest snipped]
Anno
------------------------------
Date: Tue, 15 May 2001 17:01:00 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: What is wrong with my Regular Expression?
Message-Id: <slrn9g368c.l28.tadmc@tadmc26.august.net>
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>of "Tad" and post a hateful expression with each
^^^^
>and every post?
^^^^^^^^^^^^^^
It is not "each and every post". I only attached it to two posts,
both of them followups to you (it appears I don't follow my own
advice very well).
It is not hateful. I do not hate you.
"Will not listen to you" does not imply "hate you".
I just find you a waste of time. Don't take offense, there are
still plenty of targets left.
I've put my newsfeed back the way it was.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
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 909
**************************************