[15617] in Perl-Users-Digest
Perl-Users Digest, Issue: 3030 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 12 18:06:48 2000
Date: Fri, 12 May 2000 15:05:21 -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: <958169121-v9-i3030@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 12 May 2000 Volume: 9 Number: 3030
Today's topics:
"make test" question (perl-5.6) garrem@my-deja.com
Re: A couple of quick questions jlamport@calarts.edu
A question linda.lambright@lmco.com
Re: A question <andrew.mcguire@walgreens.com>
Re: Accidental Creation of Static Variable <mjcarman@home.com>
Re: Accidental Creation of Static Variable (Abigail)
ALSO Re: Newbie CGI/Perl <nospam@devnull.com>
Announce: Perl Projector (presentation software) (Clinton A. Pierce)
Available: New Book, Perl Annotated Archives 1999 <jdkahn@megsinet.net>
Re: BEGIN and use (Ilya Zakharevich)
Re: BEGIN and use <lr@hpl.hp.com>
Re: BEGIN and use (Ilya Zakharevich)
Calling another executable from within a perl script <randyb2@uswest.net>
Re: can scalars evaluate as operators? (Abigail)
Re: can scalars evaluate as operators? <sariq@texas.net>
Re: can scalars evaluate as operators? eedlin@my-deja.com
Re: can scalars evaluate as operators? (Abigail)
contract position in nyc-DB2/SQL johnkail@way.com
Re: Converting Macintosh files to UNIX <gellyfish@gellyfish.com>
DBM file problem <kschacht@uiuc.edu>
Re: DBM file problem <rootbeer@redcat.com>
Diamond operator litchoon@my-deja.com
Re: Diamond operator <sariq@texas.net>
Re: directory contents showing up ?!? (Abigail)
Re: directory contents showing up ?!? <danielxx@bart.nl>
Re: home PC talking to webserver <totally@bogus.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 12 May 2000 19:21:16 GMT
From: garrem@my-deja.com
Subject: "make test" question (perl-5.6)
Message-Id: <8fhliq$je6$1@nnrp1.deja.com>
I've managed to get perl 5.6 to build on my AIX 4.3 box. When i do
a "make test", there are three failures listed:
lib/attrs............FAILED at test 0
lib/io_linenum.......FAILED at test 0
lib/io_xs............FAILED at test 0
Yet when i execute each of the three tests on its own, each seems to
succeed; e.g.:
# lib/io_linenum.t
1..12
ok 1
ok 2
ok 3
ok 4
ok 5
ok 6
ok 7
ok 8
ok 9
ok 10
ok 11
ok 12
... and similarly with the other two. Am i correct in assuming that
output like the above indicates a successful test? Should i be
concerned that the 3 tests fail when done as part of the complete test,
even if they succeed on their own?
Thanks,
-Matt
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 12 May 2000 20:09:20 GMT
From: jlamport@calarts.edu
Subject: Re: A couple of quick questions
Message-Id: <8fhod3$mq7$1@nnrp1.deja.com>
In article <8fh8qq$507$1@nnrp1.deja.com>,
Kostis <ke77le@my-deja.com> wrote:
> Hi all.
> Does anyone know if the anonymous subroutine passed to a map function
> constitute a closure if it appears within the implementation of a
> subroutine?
> I'm developing for mod_perl and would like to make sure that:
> sub someSub {
> return map {someOthersub($_)} @array;
> }
> won't cause a leak.
> (Obviously assuming that someOtherSub doesn't leak...)
What anonymous subroutine? There are no anonymous subroutines (nor any
closures) in the code you've posted. I'm not sure I understand the
question, since I don't see how this would cause a leak, or even cause
you to *suspect* a leak. (Though is there a reason you've written this
as
map {someOthersub($_)} @array;
rather than
map( someOthersub, @array );
)?
>
> Another thing...
> Consider the example code below:
>
> my $object = SomeModule->new;
> $object->{'.hidden'}{'anotherObject'} = SomeOtherModule->new;
>
> Will Perl's garbage collection mechanism take care of freeing the
> memory occupied by $object->{'.hidden'}{'anotherObject'} if I undef
> $object but don't explicitly undef $object->{'.hidden'}
> {'anotherObject'} beforehand?
Yes. The *only* time that Perl's garbage-collection doesn't work is when
there are circular references. The only way this code would create a
memory leak is if one of these module's new() methods created circular
references, *and* if the module's DESTROY method then failed to break
those references.
-jason
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 12 May 2000 21:42:05 GMT
From: linda.lambright@lmco.com
Subject: A question
Message-Id: <8fhtrb$sup$1@nnrp1.deja.com>
I am trying to troubleshoot a program and I don't have my perl books
with me. I ran across a statement I am not familiar with and thought I
would ask you guys what it means.
STOP: foreach $line (@logo)
I am of course familiar with foreach statements but what does the STOP:
mean.
Thank you in advance
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 12 May 2000 16:58:49 -0500
From: "Andrew N. McGuire" <andrew.mcguire@walgreens.com>
Subject: Re: A question
Message-Id: <391C7E99.1F036BBF@walgreens.com>
linda.lambright@lmco.com wrote:
>
> I am trying to troubleshoot a program and I don't have my perl books
> with me. I ran across a statement I am not familiar with and thought I
> would ask you guys what it means.
>
> STOP: foreach $line (@logo)
>
> I am of course familiar with foreach statements but what does the STOP:
> mean.
[ snip ]
It is a loop label:
#!/usr/bin/perl -w
use strict;
my @words = qw[ This is a test ];
LABEL:
for (@words) {
next LABEL if /a/;
print "$_ ";
}
__END__
prints "This is test". You may use it to jump out
of nested loops if you wish, as opposed to the default
behaviour of 'next' which jumps to the beginning of
the nearest enclosing loop. 'perldoc -f next' should
yield more info...
Cheers,
anm
--
Andrew N. McGuire
andrew.mcguire@walgreens.com
------------------------------
Date: Fri, 12 May 2000 14:05:48 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: Accidental Creation of Static Variable
Message-Id: <391C560C.2A999FAF@home.com>
Abigail wrote:
>
[Large chunk of what is getting dangerously close to a p*ssing match
between Abigail and nobull snipped.]
>
> You consider it intuitive that the following are equivalent:
>
> my $foo = 3 if $bar == 16;
>
> and
>
> my $foo;
> $foo = 3 if $bar == 16;
I consider it intuitive enough that I would expect Perl's DWIM'ing
nature to make them equivalent.
> The compile time effects are the same (the compiler takes notice),
> but the runtime effects are different. In the former case, nothing
> happens at runtime (assuming $bar != 16),
But the documentation states that my() variables are initialized at
runtime. As no initialization takes place under these conditions,
something (be it code or docs) is awry.
> while in the latter case, all the runtime effects of the first
> statement (my $foo;) will happen. And the runtime effect is
> setting $foo to 'undef'.
Which really is more likely to be what Joe Average would expect to
happen even in the former case. If nothing else, there is *no*
documentation (AFAIK) that would support $foo *retaining* its value upon
reentry into the block/subroutine where it is scoped. In fact, I don't
think that the this behavior can be relied upon:
Assuming no references to $foo external to its enclosing block, its
memory will be returned to the pool after it goes out of scope. If we go
off and do other things for a while, then come back into the block, it
is quite possible that something else will have used the chunk of memory
that held $foo before. $foo will be allocated someplace else and (being
completely unitialized) could contain anything at all.
I made a couple of half-hearted attempts at causing this, without
success, but know of no reason to think that it could not happen.
-mjc
------------------------------
Date: 12 May 2000 21:36:05 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Accidental Creation of Static Variable
Message-Id: <slrn8houa3.bgd.abigail@ucan.foad.org>
On Fri, 12 May 2000 14:05:48 -0500, Michael Carman <mjcarman@home.com> wrote:
++ Abigail wrote:
++ >
++ [Large chunk of what is getting dangerously close to a p*ssing match
++ between Abigail and nobull snipped.]
++ >
++ > You consider it intuitive that the following are equivalent:
++ >
++ > my $foo = 3 if $bar == 16;
++ >
++ > and
++ >
++ > my $foo;
++ > $foo = 3 if $bar == 16;
++
++ I consider it intuitive enough that I would expect Perl's DWIM'ing
++ nature to make them equivalent.
So, you are saying that 'my $foo;' should not have any runtime
effects? Or that 'EXPR if COND' should execute EXPR, even if COND
is false? Or should Perl analyze EXPR and say "well, I know you
made this expression conditional, and I know the condition is false,
but for this kind of expression, I'm going to execute it anyway"?
What should then happen with:
my $foo = print "bar\n" if 0;
++ > The compile time effects are the same (the compiler takes notice),
++ > but the runtime effects are different. In the former case, nothing
++ > happens at runtime (assuming $bar != 16),
++
++ But the documentation states that my() variables are initialized at
++ runtime. As no initialization takes place under these conditions,
++ something (be it code or docs) is awry.
So, the documentation is also `awry' because it says + does addition
but no addition is do with:
$a = 3 + 7 if 0;
Does the documentation really have to spell out every possible combination
of operators, keywords and control structures before it's no longer `awry'?
Can you give me a book or manual of any language that manages to document
each possible way of writing a program (because that's what you're asking
for)?
++ > while in the latter case, all the runtime effects of the first
++ > statement (my $foo;) will happen. And the runtime effect is
++ > setting $foo to 'undef'.
++
++ Which really is more likely to be what Joe Average would expect to
++ happen even in the former case. If nothing else, there is *no*
++ documentation (AFAIK) that would support $foo *retaining* its value upon
++ reentry into the block/subroutine where it is scoped. In fact, I don't
++ think that the this behavior can be relied upon:
++
++ Assuming no references to $foo external to its enclosing block, its
++ memory will be returned to the pool after it goes out of scope. If we go
++ off and do other things for a while, then come back into the block, it
++ is quite possible that something else will have used the chunk of memory
++ that held $foo before. $foo will be allocated someplace else and (being
++ completely unitialized) could contain anything at all.
++
++ I made a couple of half-hearted attempts at causing this, without
++ success, but know of no reason to think that it could not happen.
Well, it doesn't seem to be happening.... ;-)
Too bad hardly anyone of the Perl core hackers read this group.
Abigail
------------------------------
Date: 12 May 2000 20:40:33 GMT
From: The WebDragon <nospam@devnull.com>
Subject: ALSO Re: Newbie CGI/Perl
Message-Id: <8fhq81$6he$1@216.155.32.232>
In article <20000511230644.19175.00002234@ng-ci1.aol.com>, dedsrd@aol.com (DEDSRD) wrote:
also you might want to get some books
I have two so far
Mac Perl Power and Ease, Prime Time Freeware (www.ptf.com)
and
Programming Perl, O'Reilly & Associates (any decent bookstore)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Fri, 12 May 2000 22:00:00 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Announce: Perl Projector (presentation software)
Message-Id: <A9%S4.71147$h01.508183@news1.rdc1.mi.home.com>
This is to announce the release of version 1.0a of Perl Projector,
a presentation software package. (A Powerpoint work-alike.) It was
initially written to scratch an itch of mine, and may help you scratch
yourself.
Perl Projector is freely redistributable under the same terms as Perl
itself. I welcome your comments and suggestions.
The web page hosting this software is at:
http://www.geeksalad.org/projector/
Some features from the documentation:
Portable
It works under Win32 and Unix Perls. The Font and Color browser
work fine under both architectures as well.
Easy to Use
Once started, three clicks advance and retreat through slides
and configure the application. All of the common configuration
options (fonts, colors, etc...) are easily changed and saved.
Screen size is changed with a radio button so that it fits
your presentation hardware perfectly.
Lightweight
The presentation is stored in a text file, images are GIFs.
Familar Markup
The markup used is similar to POD (Plain Old Documentation)
used in Perl. I also have a translator for this markup to
HTML pages that I use for the slides. (This is much better than
using a browser though...)
Expandable
The classes that make up Perl Projector can be used without the
markup stuff indicated below for slide presentation. The markup
is simply converted into function calls to build the slide
by a short while() loop.
I hope you enjoy it.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Fri, 12 May 2000 17:05:18 -0600
From: JDK <jdkahn@megsinet.net>
Subject: Available: New Book, Perl Annotated Archives 1999
Message-Id: <391C8E2C.C594DD11@megsinet.net>
Tons of Perl and integrating it into other technologies
See link for details:
http://cgi.ebay.com/aw-cgi/eBayISAPI.dll?ViewItem&item=331160949
------------------------------
Date: 12 May 2000 18:05:31 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: BEGIN and use
Message-Id: <8fhh5b$50h$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.1382012de057702298aa32@nntp.hpl.hp.com>:
> > > {
> > > STATEMENT;
> > > STATEMENT;
> > > }
> Well, as we now know, a semicolon is a statement separator, not a
> statement terminator. So there is a null statement after the second
> semicolon and before the closing brace.
I do not think this approach is entirely laudable. Observe:
perl -wle 'sub a { 23 ; } print a'
23
With your approach a() would return an empty list. ;-)
Ilya
------------------------------
Date: Fri, 12 May 2000 12:43:23 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: BEGIN and use
Message-Id: <MPG.1385feb594c7876898aa67@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <8fhh5b$50h$1@charm.magnus.acs.ohio-state.edu> on 12 May 2000
18:05:31 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> says...
> [A complimentary Cc of this posting was sent to Larry Rosler
> <lr@hpl.hp.com>],
> who wrote in article <MPG.1382012de057702298aa32@nntp.hpl.hp.com>:
> > > > {
> > > > STATEMENT;
> > > > STATEMENT;
> > > > }
>
> > Well, as we now know, a semicolon is a statement separator, not a
> > statement terminator. So there is a null statement after the second
> > semicolon and before the closing brace.
>
> I do not think this approach is entirely laudable. Observe:
>
> perl -wle 'sub a { 23 ; } print a'
> 23
>
> With your approach a() would return an empty list. ;-)
Well, if you generalize this to:
perl -wle 'sub a { 23 ; ; ; ; ; } print a'
23
In perlsub, we find "The return value of a subroutine is the value of
the last expression evaluated." A null statement seems to have *no*
expression to evaluate, not a *null* expression, which would evaluate to
"" or () depending on context.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 12 May 2000 20:53:58 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: BEGIN and use
Message-Id: <8fhr16$oea$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Larry Rosler
<lr@hpl.hp.com>],
who wrote in article <MPG.1385feb594c7876898aa67@nntp.hpl.hp.com>:
> > > Well, as we now know, a semicolon is a statement separator, not a
> > > statement terminator. So there is a null statement after the second
> > > semicolon and before the closing brace.
> >
> > I do not think this approach is entirely laudable. Observe:
> >
> > perl -wle 'sub a { 23 ; } print a'
> > 23
> >
> > With your approach a() would return an empty list. ;-)
>
> Well, if you generalize this to:
>
> perl -wle 'sub a { 23 ; ; ; ; ; } print a'
> 23
Good catch.
> In perlsub, we find "The return value of a subroutine is the value of
> the last expression evaluated." A null statement seems to have *no*
> expression to evaluate, not a *null* expression, which would evaluate to
> "" or () depending on context.
But if you take this at the face value, then
sub a {}
would "return nothing", but it returns an empty list (or undef)
instead. ;-)
Ilya
------------------------------
Date: Fri, 12 May 2000 15:26:31 -0500
From: "Randy Bey" <randyb2@uswest.net>
Subject: Calling another executable from within a perl script
Message-Id: <XNZS4.1357$zI5.24218@news.uswest.net>
Greetings, all.
I am a shell script writer more than a perl writer, and I would like to know
how to do a simple thing.
Were this shell, I would write it thus:
while read arg1 arg2 arg3
do
/path/to/other/thing <<- EOF
$arg1
$arg2
$arg3
EOF
done < /some/file/of/various/args
which, unless I screwed up somewhere would scarf a line off the args file,
bust it into three args, then perform the internal executable and pass it
(one at a time) the three args, repeating until the args file is processed.
So, I have not figured out how to do this in Perl -- of course I am a
complete neophyte, so I don't doubt that this is a simple construct for
wiser heads.
Please help!
Randy Bey
------------------------------
Date: 12 May 2000 20:13:30 GMT
From: abigail@foad.org (Abigail)
Subject: Re: can scalars evaluate as operators?
Message-Id: <slrn8hopfa.bgd.abigail@ucan.foad.org>
On 11 May 2000 10:14:17 +0100, nobull@mail.com <nobull@mail.com> wrote:
++ epement@jpusa.chi.il.us (Eric Pement) writes:
++
++ > I'm working on a Perl script tonight that I need to get finished in a
++ > few hours. Simple question, but I can't find the answer:
++ >
++ > Is there any way to coerce scalar variables to replace operators?
++
++ eval(EXPR)
++
++ But eval(EXPR) is evil - do not do it unless you absolutely must.
It is? Why? What's so evil about eval(), and if it's so evil, why is
it present? Just stating it's evil without telling us why you think
it's evil isn't very useful.
Or are you just repeating someones mantra?
++
++ > Here's a highly-simplified way of expressing my question.
++ >
++ >
++ > if ($both) {
++ > $oper = "&&"
++ > } else {
++ > $oper = "||"
++ > }
++ > ....more code....
++ >
++ > if ($a $oper $b) { # 30 lines of code in this block }
++
++ if ( $both ? ( $a && $b) : ( $a || $b ) )
++
++ If you find the EXPR?EXPR:EXPR syntax hard to read (I know I do for
++ non-trival values of EXPR) you can spell it out:
++
++ if ( do {
++ if ($both) {
++ $a && $b
++ } else {
++ $a || $b
++ }
++ } )
Urg.
eval "\$a $oper \$b"; # Or eval '$a' . $oper . '$b';
is not only more readable, but also a lot more flexible.
++ Or if you want to do something more like what you originally tried
++ (perhaps because there really are more than two operators):
++
++ if ($both) {
++ $oper = sub { $_[0] && &{$_[1]} }
++ } else {
++ $oper = sub { $_[0] || &{$_[1]} }
++ }
++
++ if (&$oper($a,sub{$b}) { # 30 lines of code in this block }
++
++ Note: I'm passing $b as a CODE reference so that we don't loose the
++ lazy evaluation optomisation on the && an || operators. You may
++ remove this additional complexity if you do not need this optomisation.
++
++ > I've tried wrapping $oper with eval(),
++
++ eval("\$a $oper \$b") would work but it is not good style.
"Good style" as defined by whom?
Abigail
------------------------------
Date: Fri, 12 May 2000 15:33:16 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: can scalars evaluate as operators?
Message-Id: <391C6A8C.BC6D03E8@texas.net>
Abigail wrote:
>
> On 11 May 2000 10:14:17 +0100, nobull@mail.com <nobull@mail.com> wrote:
> ++ eval(EXPR)
> ++
> ++ But eval(EXPR) is evil - do not do it unless you absolutely must.
>
> It is? Why?
I suspect that Abigail already knows why many people consider 'eval
EXPR' to be evil (or at least dangerous). But for anyone who doesn't
know, I quote Tom Phoenix from 05 Nov 1999:
"It's not _always_ evil, just as stealing candy from a baby isn't
_always_ evil. But it's close.
"When you eval a string, you are running code which isn't known until
runtime. This is against all principles of structured programming. It
can lead to programs which are difficult to debug. It can leak memory or
even (in very rare cases) crash your program. Avoid, avoid, avoid.
"Fortunately, it's rare in modern Perl to need to use eval STRING. (Note
that eval BLOCK is not evil; it's a totally separate arrangement.)"
Context is available via:
http://deja.com/viewthread.xp?AN=544944655
- Tom
------------------------------
Date: Fri, 12 May 2000 21:05:24 GMT
From: eedlin@my-deja.com
Subject: Re: can scalars evaluate as operators?
Message-Id: <8fhrm9$qd5$1@nnrp1.deja.com>
In article <391a30fb.30779437@news.jpusa.net>,
epement@jpusa.chi.il.us (Eric Pement) wrote:
> I'm working on a Perl script tonight that I need to get finished in a
> few hours. Simple question, but I can't find the answer:
>
> Is there any way to coerce scalar variables to replace operators?
> Here's a highly-simplified way of expressing my question.
>
> if ($both) {
> $oper = "&&"
> } else {
> $oper = "||"
> }
> ....more code....
>
> if ($a $oper $b) { # 30 lines of code in this block }
>
> What I'm trying to do is to avoid having to duplicate 30 lines of code
> in my first if...else blocks. I would like to have the bottom line be
> interpreted as
>
> if ($a && $b){...}
> or
> if ($a || $b){...}
I must be missing something here, because this makes no sense to me
mathematically any how. You state that you want to act the same on the
following (since you stated that you did not want to dupe the 30 lines
of code): (a & b) | (a | b).
This breaks down to only (a | b). The (a & b) part has no effect since
(a|b) will always be true if (a&b) is also true. Just look at the truth
table for the or (|) operator.
a b result
------------
0 0 0
0 1 1
1 0 1
1 1 1
When the (a & b) is true, (a | b) is also true.
So instead of using
if ($a || $b) or if ($a && $b) {...}
why don't you just say if ($a | $b) {...}??
Eric
>
> depending on how the a different variable evaluated somewhat earlier
in
> the script. I've tried wrapping $oper with eval(), and tried $$oper,
and
> some other tricks, but I can't seem to figure out how to do it. If
> anyone has a solution, please e-mail me directly. Thanks much.
>
> --
> Eric Pement <epement@jpusa.org>
> executive editor, Cornerstone mag. Info on SED here:
> http://www.cornerstonemag.com http://www.cornerstonemag.com/sed
> 939 W. Wilson, Chicago, IL 60640
> tel: 773/561-2450, 1-(ext.)2084 fax: 773/989-2076
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 12 May 2000 21:44:33 GMT
From: abigail@foad.org (Abigail)
Subject: Re: can scalars evaluate as operators?
Message-Id: <slrn8houq1.bgd.abigail@ucan.foad.org>
On Fri, 12 May 2000 15:33:16 -0500, Tom Briles <sariq@texas.net> wrote:
++ Abigail wrote:
++ >
++ > On 11 May 2000 10:14:17 +0100, nobull@mail.com <nobull@mail.com> wrote:
++ > ++ eval(EXPR)
++ > ++
++ > ++ But eval(EXPR) is evil - do not do it unless you absolutely must.
++ >
++ > It is? Why?
++
++ I suspect that Abigail already knows why many people consider 'eval
++ EXPR' to be evil (or at least dangerous). But for anyone who doesn't
++ know, I quote Tom Phoenix from 05 Nov 1999:
++
++ "It's not _always_ evil, just as stealing candy from a baby isn't
++ _always_ evil. But it's close.
++
++ "When you eval a string, you are running code which isn't known until
++ runtime. This is against all principles of structured programming. It
++ can lead to programs which are difficult to debug. It can leak memory or
++ even (in very rare cases) crash your program. Avoid, avoid, avoid.
So, noone should be sending SQL queries as strings to a database server,
but use stored procedures that have been compiled in advance?
Too bad for those scores of people using MySQL.
How about require? /e? do? system? qx? /$string/?
Of course, non of the things mentioned by Tom have much to do with
the original question.
Tom said some sensible things, but that doesn't make it a mantra to be
applied without any thinking of your own. For the stated question, the
eval STRING solution is by far the easiest solution.
Abigail
------------------------------
Date: Fri, 12 May 2000 20:49:13 GMT
From: johnkail@way.com
Subject: contract position in nyc-DB2/SQL
Message-Id: <8fhqo3$phg$1@nnrp1.deja.com>
hi, i'm a headhunter seeking an experienced DB2 SQL programmer for our
client, a major international bank in new york city. "DB2
developer,perlscripting on an NT platform"-candidates must have
experience with UDB, must have financial background, SWIFT experience a
big plus. 6Mo+ contract, W2 or corp,not offsite.
please contact:
John Kail
Dynax Solutions, Inc.
192 Lex. Ave. 15fl
NYC 10016
johnkail@way.com
212.331.8614
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 12 May 2000 19:11:27 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Converting Macintosh files to UNIX
Message-Id: <8fhhgf$n9l$1@orpheus.gellyfish.com>
On 10 May 2000 17:36:30 GMT The WebDragon wrote:
> In article <8fc3sf$7pv$0@216.155.32.13>, The WebDragon
> <nospam@devnull.com> wrote:
>
> | methinks I need to update my Benchmark.pm :)
>
> ok, Benchmark.pm is NOT a separate file on CPAN? what gives?
>
Its part of the distribution :
Benchmark 1 GSAR/perl-5.6.0.tar.gz
From the file 02packages.details.txt.gz .
/J\
--
And how is education supposed to make me feel smarter? Besides, every time
I learn something new, it pushes some old stuff out of my brain. Remember
when I took that home winemaking course, and I forgot how to drive?
--
fortune oscar homer
------------------------------
Date: Fri, 12 May 2000 13:13:23 -0500
From: "Keith Schacht" <kschacht@uiuc.edu>
Subject: DBM file problem
Message-Id: <URXS4.16769$nb2.337716@vixen.cso.uiuc.edu>
Hello,
I have apache setup with DBM support (for the .htaccess equilivant) and am
attempting to write a perl script that automatically adds a users name/pw to
the DBM file upon registration via a HTML form.
I wrote a test script that adds a record to the DBM file.. this works
successfully when executed from the command line. However, when I execute
this same script as a CGI program from a webpage it doesn't work? Is there
something about the CGI environment that would effect using dbmopen()?
In essence, my code is doing the following.
dbmopen(DBM, $file, 0666);
$DBM{'username'} = "password";
close(DBM);
If anyone has any clues it would be greatly appreciated.
Keith Schacht
Without putting all the co
------------------------------
Date: Fri, 12 May 2000 11:28:55 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: DBM file problem
Message-Id: <Pine.GSO.4.10.10005121127360.16364-100000@user2.teleport.com>
On Fri, 12 May 2000, Keith Schacht wrote:
> In essence, my code is doing the following.
>
> dbmopen(DBM, $file, 0666);
Could it be that the webserver user doesn't have permission to open
or create this file? Could $file be a relative path?
The CGI spec doesn't specify which directory will be the current working
directory when a CGI program is started.
http://hoohoo.ncsa.uiuc.edu/cgi/
It may be the root directory, the server's working directory, the home
directory for user nobody, the home directory for root, the directory the
program is stored in, the directory the server is stored in, the base
cgi-bin directory, the /tmp directory, a directory you don't have access
to from the shell, a directory named after an annoying character from
Saturday Night Live, a directory chosen at random, or some other
directory.
A CGI program which uses a relative path before chdir()ing to a
non-relative path is in a state of sin.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 12 May 2000 19:42:55 GMT
From: litchoon@my-deja.com
Subject: Diamond operator
Message-Id: <8fhmrq$kti$1@nnrp1.deja.com>
I am trying to move the file handle backwards for a few lines after
matching some string in a log file. Is there a way to do this ? I would
appreciate if someone could respond.
I tried using the seek & tell statements to move back the file handle
but it does not correspond to the start of the line when I read from the
<file>.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 12 May 2000 15:02:07 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Diamond operator
Message-Id: <391C633F.42B65A5A@texas.net>
litchoon@my-deja.com wrote:
>
> I am trying to move the file handle backwards for a few lines after
> matching some string in a log file. Is there a way to do this ? I would
> appreciate if someone could respond.
use File::ReadBackwards; # From CPAN
Then, you don't have to roll back "a few lines".
- Tom
------------------------------
Date: 12 May 2000 21:10:28 GMT
From: abigail@foad.org (Abigail)
Subject: Re: directory contents showing up ?!?
Message-Id: <slrn8hosq4.bgd.abigail@ucan.foad.org>
On Thu, 11 May 2000 22:44:57 GMT, Daniel van den Oord <danielxx@bart.nl> wrote:
++ I want to make a CGI script with a custom layout and extra options like
++ show next 20 or previous and stuff so it should be dynamic !!! not like the
++ webserver and put it on enable directory browser if standard file isn't
++ found !!
Well, that's very nice. What have you got so far? And don't use too many
exclaimation marks, it makes you look silly.
Abigail
------------------------------
Date: Fri, 12 May 2000 21:43:55 GMT
From: "Daniel van den Oord" <danielxx@bart.nl>
Subject: Re: directory contents showing up ?!?
Message-Id: <vW_S4.754$Kk2.13075@Typhoon.bART.nl>
Wel actually haven't started yet because I don't know yet hoe to start.. I
had not time the last few days to look into the perlhelpfile included with
active perl.. So I think I'm gona do that somewhere in the next 2 days...
But anybody who knows how to start especially how to let CGI read the
filenames and display them into a list and I can go from there... (Why think
of something that has allready been made right ?!?)
Daniel
> On Thu, 11 May 2000 22:44:57 GMT, Daniel van den Oord <danielxx@bart.nl>
wrote:
> ++ I want to make a CGI script with a custom layout and extra options
like
> ++ show next 20 or previous and stuff so it should be dynamic !!! not like
the
> ++ webserver and put it on enable directory browser if standard file isn't
> ++ found !!
>
>
> Well, that's very nice. What have you got so far? And don't use too many
> exclaimation marks, it makes you look silly.
>
>
>
> Abigail
------------------------------
Date: Fri, 12 May 2000 19:41:06 +0100
From: mopi <totally@bogus.com>
Subject: Re: home PC talking to webserver
Message-Id: <9ujohs8kkt4feqvq2cmq7p44h5jtvrimj9@4ax.com>
Thank you jraff
I haven't a clue what you are talking about :) but I'll readup an LWP
and qmform tonight, god bless search engines.
thanks again for reply
Paul
On Fri, 12 May 2000 14:15:30 GMT, "jraff" <jraff@home.com> wrote:
>Seemingly all you would have to do is create a web access client using LWP
>and send the form "qmform"
>with the appropriate fields: address, message, CharCount, counter and
>submit.
>----------------------------------------------------------------------------
>--------------
>"mopi" <totally@bogus.com> wrote in message
>news:8n3nhs0cjs55ua3pr3airujfc0d0mqpnfj@4ax.com...
>> Excuse subject I'm not certain how to ask question.
>>
>> Do you know of a something I can install on my home PC that will
>> automatically talk to online webserver and fill in details I specify.
>>
>> I want to use email client to mail my mailserver/linux gateway and
>> have that PC type in details (username/password and more) on an online
>> webserver [ www.quios.com to be specific ] end result will be email to
>> mobile phone sms message.
>>
>> tia
>> Paul
>>
>>
>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 V9 Issue 3030
**************************************