[23326] in Perl-Users-Digest
Perl-Users Digest, Issue: 5546 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 23 00:05:48 2003
Date: Mon, 22 Sep 2003 21:05:07 -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, 22 Sep 2003 Volume: 10 Number: 5546
Today's topics:
Re: CGI.pm <tore@aursand.no>
Re: CGI.pm <stop.spam@whitehouse.gov>
Re: CGI.pm <tcurrey@no.no.no.i.said.no>
Re: CGI.pm <tcurrey@no.no.no.i.said.no>
Re: killing zombie file lock <ryantate@OCF.Berkeley.EDU>
LOCAL/MY in outsite files in USE (Great Deals)
Re: LOCAL/MY in outsite files in USE <mgjv@tradingpost.com.au>
Re: Perl: how to stop users from executing commands fro <spam@thecouch.homeip.net>
Re: PPM problems <bwaNOlSPtAMon@rochester.rr.com>
Re: PPM problems <david-del@del-nonspiritual.com>
RegExp: Matching <tore@aursand.no>
Re: RegExp: Matching <cs@edu.edu>
Re: RegExp: Matching <mgjv@tradingpost.com.au>
Re: some proxies post and some won't with lwp (Robert)
Re: string length? <tcurrey@no.no.no.i.said.no>
Re: string length? <tcurrey@no.no.no.i.said.no>
Re: string length? (Sam Holden)
What wrong with my module? (Great Deals)
Re: What wrong with my module? <noreply@gunnar.cc>
Re: What wrong with my module? (Sam Holden)
Re: What wrong with my module? <kkeller-usenet@wombat.san-francisco.ca.us>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 Sep 2003 03:08:58 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: CGI.pm
Message-Id: <pan.2003.09.23.01.07.19.635444@aursand.no>
On Mon, 22 Sep 2003 22:41:13 +0100, D Borland wrote:
> OK, dudes i understand - I'm a lazy git, and i really gotta get my head out
> my arse and in gear!
While you're at it: Stop top-posting.
--
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 01:54:40 GMT
From: "Robert" <stop.spam@whitehouse.gov>
Subject: Re: CGI.pm
Message-Id: <HLn9B3.JCw@news.boeing.com>
Lincoln Stein is my Hero! You need to change professions!
"D Borland" <notavailable@nospamplease.com> wrote in message
news:4WEbb.734$xr.21@newsfep1-gui.server.ntli.net...
> Hi folks,
>
> How do i go about get a parameter list from a form, without having to use
> CGI.pm?
>
> I was going to use this, but it's just a waste of time learning how to use
> it correctly - i mean if i wanted to read, read, read and read i would
have
> just got a job in a library. It's something that i have been finding with
> perl more and more. I finished reading the Llama about a week ago, and
have
> since been horrified by sheer mass of perl bits and bobs. The TMTOWTDI
> motto, is all well and fine but it also helps to badly confuse a beginner
in
> language, you read a peice of text from one person and later you read
> another telling you that what you just read, isn't the best or safest way
to
> do it, then later on you read that, that people don't like it that way
> either, but prefer to do this. Then there's all the modules, soom seem to
> have tried to re-create a sub-language within perl as some of the syntax
for
> some modules i have seen. Then there's the book on every kind of subject
> that you can think of with perl - (i ain't rich and can't afford these, so
> perl's free but learning it's not? as the only other alternative to
outdated
> or badly coded tutorials by the odd perl programmer) To be quite honest
the
> only reason i chose perl over PHP was because i believe(d) that PHP was
just
> a hype and when when perl6 is released everyone would come flooding back
to
> perl, et cetera, but somehow i'm starting to think i chose wrong :( Maybe
> PHP was the better choice.
>
> Well that's a little bit of the stress perl has given me gone... sigh
>
> Dagmar
>
>
------------------------------
Date: Mon, 22 Sep 2003 20:30:29 -0700
From: "Trent Curry" <tcurrey@no.no.no.i.said.no>
Subject: Re: CGI.pm
Message-Id: <bkoet0$71a$1@news.astound.net>
Malcolm Dew-Jones wrote:
> Trent Curry (tcurrey@no.no.no.i.said.no) wrote:
>> Jeff 'japhy' Pinyan wrote:
>>> On Mon, 22 Sep 2003, D Borland wrote:
>
>>>
>>>> Maybe PHP was the better choice.
>>>
>>> If what you need is web-based stuff, by all means, use PHP. That's
>>> what it's there for.
>
>> Perl works quite well for web apps too you know ;-p
>
> Yes, but it's at least as good to use php if you don't want to read
> the perl manuals.
Well, both have good uses in this area. I really depends on what you really
want to achieve, and which tool you'd prefer to use. I just happen to be
more comfortable with Perl. Other people may wish to use php.
What ever floats thy boat :-)
--
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1)!eg
;print(reverse("$s")."\n");'
------------------------------
Date: Mon, 22 Sep 2003 20:33:45 -0700
From: "Trent Curry" <tcurrey@no.no.no.i.said.no>
Subject: Re: CGI.pm
Message-Id: <bkof34$71i$1@news.astound.net>
Trent Curry wrote:
> Malcolm Dew-Jones wrote:
>> Trent Curry (tcurrey@no.no.no.i.said.no) wrote:
>>> Perl works quite well for web apps too you know ;-p
>>
>> Yes, but it's at least as good to use php if you don't want to read
>> the perl manuals.
>
> Well, both have good uses in this area. I really depends on what you
> really want to achieve, and which tool you'd prefer to use. I just
> happen to be more comfortable with Perl. Other people may wish to use
> php.
>
> What ever floats thy boat :-)
oops, I mis read your line. True, if you really want to make good use of
Perl, you must know that perldoc is your friend, and not a burden.
On that note, I've seen the docs at www.php.net, and I'd say they too would
require getting aquainted too for any successful task in php, save maybe
Hello World level examples...
--
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1)!eg
;print(reverse("$s")."\n");'
------------------------------
Date: Tue, 23 Sep 2003 02:20:32 +0000 (UTC)
From: Ryan Travis Tate <ryantate@OCF.Berkeley.EDU>
Subject: Re: killing zombie file lock
Message-Id: <bkoalg$pkj$1@agate.berkeley.edu>
Darren Dunham <ddunham@redwood.taos.com> wrote:
| Prior to doing that, I would have run 'fuser <filename>' to see what
| processes it identified as holding a lock on the file.
Thanks for that, I'll use it next time.
Cheers,
Ryan
------------------------------
Date: 22 Sep 2003 18:54:11 -0700
From: deals@slip-12-64-108-121.mis.prserv.net (Great Deals)
Subject: LOCAL/MY in outsite files in USE
Message-Id: <cafe07c7.0309221754.17a2a637@posting.google.com>
I know how to use the sub now. My sub is using my and global
veriables. I want to know how I can put the sub in an outside file. If
I put
in main.pl if i put
use mysub.pl
I know the my in mysub will be fine, but how can the sub in mysub.pl
use the global verible in main.pl?
by the way, it is just copy and paste the whole sub into a seperate
file and just use it in the main file? do i need to package it or
something? any reference on how to pack them? thanks
------------------------------
Date: 23 Sep 2003 02:15:46 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: LOCAL/MY in outsite files in USE
Message-Id: <slrnbmvb6k.7ha.mgjv@verbruggen.comdyn.com.au>
On 22 Sep 2003 18:54:11 -0700,
Great Deals <deals@slip-12-64-108-121.mis.prserv.net> wrote:
> I know how to use the sub now. My sub is using my and global
> veriables. I want to know how I can put the sub in an outside file. If
Stop there.
Now continue by reading this:
http://perl.plover.com/FAQs/Namespaces.html
Once you understand that:
- You will need to redesign your interface to use lexicals, or
- You use a package global.
If you want to use a package global, to make it work under strictures,
you need to specify the full name of the variable, use 'our', or if
you're on an old Perl 'use vars'.
> I put
> in main.pl if i put
> use mysub.pl
>
> I know the my in mysub will be fine, but how can the sub in mysub.pl
> use the global verible in main.pl?
By referring to it in the correct manner. if you have 'use strict',
which you _should_ have, you need to predeclare you're going to use
it, or use its full name ($main::foo);
> by the way, it is just copy and paste the whole sub into a seperate
> file and just use it in the main file? do i need to package it or
> something? any reference on how to pack them? thanks
$ perldoc perlmod
$ perldoc perlfaq7
/How do I create a module?
In other words, read the perlmod documentation, and the perl faq,
section 7. If you share code, it is generally best to put some work
into doing it nicely, and creating a decent interface to it, instead
of just dumping it in some file somewhere.
Martien
--
|
Martien Verbruggen | Make it idiot proof and someone will make a
Trading Post Australia | better idiot.
|
------------------------------
Date: Mon, 22 Sep 2003 22:40:58 -0400
From: Mina Naguib <spam@thecouch.homeip.net>
Subject: Re: Perl: how to stop users from executing commands from browser
Message-Id: <%oObb.4927$9n4.241731@wagner.videotron.net>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
Nick wrote:
> I'm working on an HTML file that calls cope of Perl scripts with
> parameters.
> If you take your cursor over to the link, you can see the command that
> will be send to the perl script and at this point user can modify that
> and execute it from web browser. How can i prevent this from
> happening?????
> Anyway to block users from executing any commands from web browser????
Rule #1 when developing a server-client program (including web server -> web browser relationship):
NEVER TRUST THE CLIENT
Rule #2:
Never trust the data the client sends you.
You have to be extremely meticulous in which data you accept from a client and what format it's in,
and validate and re-format it very carefully to make sure it's safe.
Accepting a commandline command (or even argument) submitted from a web browser is just a disaster
waiting to happen.
Instead, you should have a list of valid commands like so in your CGI:
%validcommands = (
"foo" => {
"command" => "/path/to/foo.bin",
"validarguments" => {
"fooarg1" => "-s",
"fooarg2" => "-Wall",
},
},
"bar" => {
"command" => "/path/to/bar.bin",
"validarguments" => {
"bararg1" => "-X",
"bararg2" => "--n",
},
},
);
And then only accept command references from the client and check them against the above structure:
exists $validcommands{ $cgi->param("command") } || die "Error: Invalid command\n";
# Same goes for allowed parameters:
exists $validcommands{ $cgi->param("command") }{"validarguments"}{ $cgi->param("parameter") } || die
"Error: Invalid argument for command\n";
# Then, form actual command to execute from known trusted data, never from direct client input
system($validcommands{ $cgi->param("command") }, $validcommands{ $cgi->param("command")
}{"validarguments"}{ $cgi->param("parameter") });
Finally, try to do whatever you're doing with just perl or Perl modules if possible, and at all
costs avoid using system(), exec() and `` from a CGI program. Also always enable strict and taint
checking, and log everything that you do in sensitive areas including timestmp and IP addresses.
The above is probably a lot more work than you're used to, but it just might save you from an
unpleasant "rm -rf /" by mr. anonymous cracker someday.
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE/b7K9eS99pGMif6wRAnmQAKD9OjRIXJ6QvLHpAIudmNTduCZQjwCgpwgt
ccqk6D6SVVgjzzzFSjAW94E=
=BIgO
-----END PGP SIGNATURE-----
------------------------------
Date: Tue, 23 Sep 2003 01:44:11 GMT
From: Bob Walton <bwaNOlSPtAMon@rochester.rr.com>
Subject: Re: PPM problems
Message-Id: <3F6FA54A.4030508@rochester.rr.com>
David McDivitt wrote:
> I read what I could find about package importing prior to posting. When I
> typed:
>
> ppm install DBI
>
> I received an error and what I read indicated it was because of our
> firewall. I displayed connection properties in internet explorer and found
> the following:
>
> a03.zzzz.zzzz.zz.us:8080
>
> The following environment variable was added to Win2000:
>
> set HTTP_PROXY=a03.zzzz.zzzz.zz.us:8080
>
> Now I the following error with PPM:
>
> Error: No valid repositories: Error: 501 Protocol scheme
> 'a03.zzzz.zzzz.zz.us' is not supported Error: 501 Protocol
> scheme 'a03.zzzz.zzzz.zz.us' is not supported
>
> DBI.zip was downloaded from ActivePerl and unzipped into a folder honoring
> folder names in the zip file. When I type the following:
>
> ppm install DBI.ppd
>
> I still get the internet error above. I would like to know two things.
> First, how do I get rid of the internet error so I don't have to download
> stuff. Second, why is it trying to use the internet if I invoked PPM from
> within the directory I unzipped the files. Thanks
>
>
I think you'll have to follow the detail of your proxy
server implementation to the letter, including the
provision of a userID and password, in order to get
the internet repositories to work. To get your own
files to work, you will need to add the directory
where they appear to your list of "active repositories".
Look at the "ppm repository add" command in perldoc ppm.
If you didn't get the proxy to work, you might need to
"ppm repository delete" the default internet repository.
--
Bob Walton
------------------------------
Date: Mon, 22 Sep 2003 22:17:45 -0500
From: David McDivitt <david-del@del-nonspiritual.com>
Subject: Re: PPM problems
Message-Id: <eoevmvsml3fqus4r5u88vfhq0jgg00bgcc@4ax.com>
Thanks Bob and Dagmar.
>From: Bob Walton <bwaNOlSPtAMon@rochester.rr.com>
>Date: Tue, 23 Sep 2003 01:44:11 GMT
>Lines: 52
<snip>
>I think you'll have to follow the detail of your proxy
>
>server implementation to the letter, including the
>
>provision of a userID and password, in order to get
>the internet repositories to work. To get your own
>files to work, you will need to add the directory
>where they appear to your list of "active repositories".
>Look at the "ppm repository add" command in perldoc ppm.
>If you didn't get the proxy to work, you might need to
>"ppm repository delete" the default internet repository.
--
http://nonspiritual.com
http://freeconservative.org
------------------------------
Date: Tue, 23 Sep 2003 03:42:02 +0200
From: Tore Aursand <tore@aursand.no>
Subject: RegExp: Matching
Message-Id: <pan.2003.09.23.01.42.00.171350@aursand.no>
Hi!
I'm totally stuck with a regular expression. It has actually to do with
my Apache configuration (I've posted to alt.apache.configuration), but as
regular expressions are quite similar, I hope it's OK to post my question
here as well.
The problem is that I want to match (inside a <DirectoryMatch> directive)
'/var/www/html/test/' and all the subdirectories. However, I _do not_
want the regular expression to match on subdirectories which begin with an
underscore ('_').
Example:
/var/www/html/test/ - Match
/var/www/html/test - Match
/var/www/html/test/2 - Match
/var/www/html/test/23/ - Match
/var/www/html/test/_foo/ - Do _not_ match
Thanks for any help!
--
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: Mon, 22 Sep 2003 19:05:12 -0700
From: Chief Squawtendrawpet <cs@edu.edu>
Subject: Re: RegExp: Matching
Message-Id: <3F6FAA58.99558226@edu.edu>
Tore Aursand wrote:
> /var/www/html/test/ - Match
> /var/www/html/test - Match
> /var/www/html/test/2 - Match
> /var/www/html/test/23/ - Match
> /var/www/html/test/_foo/ - Do _not_ match
/^\/var\/www\/html\/test(\/[^_].*|\/|$)$/
Chief S.
------------------------------
Date: 23 Sep 2003 02:09:29 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: RegExp: Matching
Message-Id: <slrnbmvaqr.7ha.mgjv@verbruggen.comdyn.com.au>
On Tue, 23 Sep 2003 03:42:02 +0200,
Tore Aursand <tore@aursand.no> wrote:
> Hi!
>
> I'm totally stuck with a regular expression. It has actually to do with
> my Apache configuration (I've posted to alt.apache.configuration), but as
> regular expressions are quite similar, I hope it's OK to post my question
> here as well.
I have no idea whether Apache's RE is similar to Perl's. I'll answer
for Perl RE, and leave it up to you to translate.
If you had crossposted you might have avoided people saying the same
thing in the two disparate places.
> The problem is that I want to match (inside a <DirectoryMatch> directive)
> '/var/www/html/test/' and all the subdirectories. However, I _do not_
> want the regular expression to match on subdirectories which begin with an
> underscore ('_').
>
> Example:
>
> /var/www/html/test/ - Match
> /var/www/html/test - Match
> /var/www/html/test/2 - Match
> /var/www/html/test/23/ - Match
> /var/www/html/test/_foo/ - Do _not_ match
I wouldn't normally try to capture this in a single regexp, but I
guess that's what you're looking for, so...
my $dir = "/var/www/html/test";
print "matches" if m#\A^$dir(/[^_]|/?\Z)#;
More readable:
m#
\A^$dir # Start with the directory
( # followed by either
/[^_] # a slash and a non-underscore character
| # or
/?\Z # the end of the string, optionally preceded by slash
)
#x;
If Apache doesn't have '\A' and '\Z', you can probably replace them
with '^' and '$'.
Martien
--
|
Martien Verbruggen | True seekers can always find something to
Trading Post Australia | believe in.
|
------------------------------
Date: 22 Sep 2003 18:10:33 -0700
From: robert@nrc.net (Robert)
Subject: Re: some proxies post and some won't with lwp
Message-Id: <22d0e990.0309221710.750ecc5c@posting.google.com>
Then maybe you can tell me if there's a way with perl that i can solve this problem?
"Gregory Toomey" <NOSPAM@bigpond.com> wrote in message news:<bknodd$3k5td$1@ID-202028.news.uni-berlin.de>...
> "Robert" <robert@nrc.net> wrote in message
> news:22d0e990.0309221252.60c0379c@posting.google.com...
> > Hi,
> > I have a problem posting through proxies that only happens about half
> > the time, using different proxies.
>
> Havent got a clue. Try a newsgroup that deals with proxies. I only
> understand Perl.
>
> gtoomey
------------------------------
Date: Mon, 22 Sep 2003 20:26:06 -0700
From: "Trent Curry" <tcurrey@no.no.no.i.said.no>
Subject: Re: string length?
Message-Id: <bkoekq$6s0$1@news.astound.net>
Chris Mattern wrote:
> Trent Curry wrote:
>> Chris Mattern wrote:
>>
>>> Abigail wrote:
>>>
>>>> Bob Smith (bobsmith@jippii.fi) wrote on MMMDCLXXIV September
>>>> MCMXCIII in <URL:news:3F6F0C2D.20514EE8@jippii.fi>:
>>>> '' how do I get the string length of a string?
>>>>
>>>>
>>>> That's why Perl has the handy chop function!
>>>>
>>>> $str = "I want to know the length";
>>>> $length = 0;
>>>> while ($str ne "") {
>>>> $tmp = $length + 1;
>>>> chop $str;
>>>> $length = $tmp;
>>>> }
>>>>
>>>>
>>>
>>> Now, is that a nice thing to do to a newbie, Abigail?
>>>
>>> Chris Mattern
>>
>>
>> I don't think there was any reason to do that at all. It's just
>> confusing a new person even more and could just result in him coming
>> back whining about why the code isn't working.
>
> Not work? What in the above code does not work? It's horribly ugly
> and incredibly ludicrous, but it does *work* (it does destroy the
> source string, but then the original poster never said he needed it
> preserved...).
True, it working in the sense of being able to compile and run, but it
doesn't work in any way the the op would expect, espially being a beginning,
ehich if you ask me, is just a mean thing to do and serves no one.
>> If you don't like newbie questions why respond
>> to them?
>>
> Even newbies should have read the FAQ, and thus know how to read the
> basic documentation. That may have been a bit harsh, though.
Of course. But what most of the experts don't take into account that newbies
may not even know such FAQs exist. Pointing out sources for them is one
thing, giving code that only serves to confuse them is another.
--
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1)!eg
;print(reverse("$s")."\n");'
------------------------------
Date: Mon, 22 Sep 2003 20:28:06 -0700
From: "Trent Curry" <tcurrey@no.no.no.i.said.no>
Subject: Re: string length?
Message-Id: <bkoeoh$718$1@news.astound.net>
Abigail wrote:
> Chris Mattern (syscjm@gwu.edu) wrote on MMMDCLXXIV September MCMXCIII
> in <URL:news:3F6F1CCA.4040702@gwu.edu>:
>>> Abigail wrote:
>>>> Bob Smith (bobsmith@jippii.fi) wrote on MMMDCLXXIV September
>>>> MCMXCIII in <URL:news:3F6F0C2D.20514EE8@jippii.fi>:
>>>> '' how do I get the string length of a string?
>>>>
>>>>
>>>> That's why Perl has the handy chop function!
>>>>
>>>> $str = "I want to know the length";
>>>> $length = 0;
>>>> while ($str ne "") {
>>>> $tmp = $length + 1;
>>>> chop $str;
>>>> $length = $tmp;
>>>> }
>>>>
>>>>
>>> Now, is that a nice thing to do to a newbie, Abigail?
>
>
> Well, I'd considered roasting him over a fire, and feeding him to
> my dog, but my dog doesn't like Bobs. (The dog is a sysadmin).
I'm sorry, but where do you get off "flaming" someone like this?
(Sorry I coudln't resist ;p)
Now really, why beat this poor newbie too death?
--
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1)!eg
;print(reverse("$s")."\n");'
------------------------------
Date: 23 Sep 2003 03:47:12 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: string length?
Message-Id: <slrnbmvghv.khu.sholden@flexal.cs.usyd.edu.au>
On Mon, 22 Sep 2003 20:26:06 -0700,
Trent Curry <tcurrey@no.no.no.i.said.no> wrote:
> Chris Mattern wrote:
>> Trent Curry wrote:
[snip length in terms of chop]
>
> True, it working in the sense of being able to compile and run, but it
> doesn't work in any way the the op would expect, espially being a beginning,
> ehich if you ask me, is just a mean thing to do and serves no one.
It places the length of the string in $length.
How is that not what the op would expect, when the op wanted to
determine the length of the string?
Seems pretty damn intuitive to me.
Placing it in the function would have been better, but Abigail was
being nice and realised the OP probably wouldn't know what a function
was and would be confused by the syntax.
>>> If you don't like newbie questions why respond
>>> to them?
>>>
>> Even newbies should have read the FAQ, and thus know how to read the
>> basic documentation. That may have been a bit harsh, though.
>
> Of course. But what most of the experts don't take into account that newbies
> may not even know such FAQs exist. Pointing out sources for them is one
> thing, giving code that only serves to confuse them is another.
They are pointed out in the standard places, not for comp.lang.perl.misc
but for usenet in general. As well as in docs that come with perl.
Though of course people who would use a language without glancing at the
docs might be expected to post to usenet without reading the "rules".
Those people would probably also push to the front of the line at the
rollercoaster, since they wouldn't bother reading the "line up here"
sign, or learning about society's default rules.
Luckily in most places you need a license to drive a car, so these
people don't go running red lights because they didn't bother reading
the road rules.
A license to post would be a terrible thing, so instead we have
social pressure.
If you push to the front of the line at the rollercoaster you can expect
to not be treated so well by those around you. Just like if you post
FAQs answered by searching almost *anywhere* for the subject you used,
you can expect to not be treated in a nice manner.
You'll get cryptic answers, RTFMs, flames, plonks, and be silently
ignored forever by many knowledgable posters. Reap what you sow and
all that...
--
Sam Holden
------------------------------
Date: 22 Sep 2003 20:08:03 -0700
From: deals@slip-12-64-108-121.mis.prserv.net (Great Deals)
Subject: What wrong with my module?
Message-Id: <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 05:30:55 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: What wrong with my module?
Message-Id: <bkoeoj$3vgc3$1@ID-184292.news.uni-berlin.de>
Great Deals wrote:
> I put a file called test.pm in the same dir as test.pl
>
> test.pm:
> #perl
> package test;
> sub getit (){
> return time;
> }
Ensure that the module returns a true value by adding
1;
to the bottom.
> test.pl:
> #perl
Try adding
use lib '.';
here.
> use test;
>
> $ab= test::getit();
> print "$ab\n";
>
> the error is:
> Undefined subroutine &test::getit called at test.pl line 4.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 23 Sep 2003 03:35:37 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: What wrong with my module?
Message-Id: <slrnbmvfs9.khu.sholden@flexal.cs.usyd.edu.au>
On 22 Sep 2003 20:08:03 -0700,
Great Deals <deals@slip-12-64-108-121.mis.prserv.net> wrote:
> I put a file called test.pm in the same dir as test.pl
>
> test.pm:
> #perl
> package test;
> sub getit (){
> return time;
> }
>
Since the temp.pm above doesn't return a true value either aren't
getting the error you specifiy below, or you aren't using the code
you posted.
> test.pl:
> #perl
> use test;
>
> $ab= test::getit();
> print "$ab\n";
>
> the error is:
> Undefined subroutine &test::getit called at test.pl line 4.
There's not much point in fixing some random code that you aren't
actually using.
test.pm doesn't contain what you claim it does, or a different
test.pm is getting included than the one you think is...
--
Sam Holden
------------------------------
Date: Mon, 22 Sep 2003 20:54:47 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: What wrong with my module?
Message-Id: <76gokb.949.ln@goaway.wombat.san-francisco.ca.us>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In article <slrnbmvfs9.khu.sholden@flexal.cs.usyd.edu.au>, Sam Holden wrote:
> There's not much point in fixing some random code that you aren't
> actually using.
>
> test.pm doesn't contain what you claim it does, or a different
> test.pm is getting included than the one you think is...
If the latter, then certainly Great Deals could be using the
code he posted. (I tested it, and it gives the undefined
sub error.) The second fix Gunnar suggested would produce an
error due to not returning true in test.pm. Without it, I bet
the OP is on a case-insensitive filesystem which has Test::Harness
installed. (Another reason not to name things test or Test.)
- --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.2.1 (Darwin)
iD8DBQE/b8QDhVcNCxZ5ID8RAoTPAKCKoNlVmSH6LqsIPzyxRrLZwMKtFQCeOXpd
iSvVZORrEPk23bbEUGikUiM=
=G9r6
-----END PGP SIGNATURE-----
------------------------------
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 5546
***************************************