[18697] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 865 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 9 21:05:34 2001

Date: Wed, 9 May 2001 18:05:09 -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: <989456709-v10-i865@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 9 May 2001     Volume: 10 Number: 865

Today's topics:
        1 billion seconds bug (John Doe)
    Re: 1 billion seconds bug (Craig Berry)
        Apache::Session::Postgres & Postgres <troyr@vicnet.net.au>
        Javascript or Perl ? <zlach@yahoo.com>
    Re: Javascript or Perl ? (Tim Hammerquist)
    Re: Javascript or Perl ? <mischief@velma.motion.net>
    Re: Javascript or Perl ? <godzilla@stomp.stomp.tokyo>
    Re: Javascript or Perl ? <Jonathan.L.Ericson@jpl.nasa.gov>
    Re: latest stable version of Perl <mischief@velma.motion.net>
    Re: Local Time <flavell@mail.cern.ch>
    Re: Local Time <todd@designsouth.net>
    Re: Local Time <tony_curtis32@yahoo.com>
    Re: Local Time (Craig Berry)
    Re: Local Time (David H. Adler)
    Re: Local Time <tony_curtis32@yahoo.com>
    Re: Local Time <todd@designsouth.net>
    Re: Local Time <todd@designsouth.net>
    Re: MD/DC area ? (David H. Adler)
    Re: Perl 2 Exe <wyzelli@yahoo.com>
    Re: Perl 2 Exe <wyzelli@yahoo.com>
    Re: weird error on @array syntax <godzilla@stomp.stomp.tokyo>
    Re: weird error on @array syntax <godzilla@stomp.stomp.tokyo>
    Re: weird error on @array syntax (Craig Berry)
    Re: weird error on @array syntax <godzilla@stomp.stomp.tokyo>
    Re: weird error on @array syntax (Jay Tilton)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 09 May 2001 23:49:45 GMT
From: jdoe@main.com (John Doe)
Subject: 1 billion seconds bug
Message-Id: <slrn9fjltn.67r.jdoe@zazzie.universe>

This _isn't_ a perl bug of course.

Anyway I just want to share the kind
of traps I fell into having to do with this
1 billion seconds time point.

One of my modperl scripts use 'cmp'
to sort records in a dbm file. Each
record begin with the number of seconds
(of some events) since "that zero time"
in unix.  The rest of the record is
other jumble of strings and at the time
I thought it was natural to use 'cmp' to
sort the strings --
even though I wanted to sort according
to time.

To make the long story short
I had to replace 'cmp' with '<=>'
or else according to perl string '100blabla'
is less than '99zzz' if 'cmp' is used.

Me bad! Perl rules!






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

Date: Thu, 10 May 2001 00:14:40 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: 1 billion seconds bug
Message-Id: <tfjnbgojdqj9b1@corp.supernews.com>

John Doe (jdoe@main.com) wrote:
: Anyway I just want to share the kind of traps I fell into having to do
: with this 1 billion seconds time point.

We're probably going to be talking about this almost as much as good ol'
y2k a couple of years ago.

Quite soon now (specifically, Sun Sep 9 01:46:40 2001 GMT), the Unix epoch
time (seconds since Jan 1 1970) will reach one billion.  This will
certainly break code which compares epoch times lexically, and will also
break code which stores such times as a string representation in
nine-char-wide fields.  Start your code reviews now -- avoid the
last-second rush. :-)

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "God becomes as we are that we may be as he is."
   |               - William Blake


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

Date: Thu, 10 May 2001 10:05:30 +1000
From: "Troy Boy" <troyr@vicnet.net.au>
Subject: Apache::Session::Postgres & Postgres
Message-Id: <x_kK6.3608$ZJ.136494@ozemail.com.au>

Hi all..this question is half perl half postgres..

Has anyone encountered tables in postgres stalling when they use
Apache::Session?

It doesn't happen every time but frequent enough

I tie the sesssion, use the data.... untie it at the end of the script...and
when i permanently want to delete the data store i use
tied(%session)->delete;

These are the kind of errors i get when i do a ps aux|grep postgres

postgres 20912  0.0  1.7  7192 4368 ?        S    04:00   0:00
/usr/lib/postgresql/bin/postgres localhost postgres sessions VACUUM waiting
postgres 21140  0.0  1.3  7024 3404 ?        S    05:41   0:00
/usr/lib/postgresql/bin/postgres ip_addy session sessions idle waiting


Has anyone encountered something similiar?

Much help appreciated

--
----------------------------------------------------------------
Troy Rasiah
Melbourne, Aus




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

Date: Wed, 9 May 2001 22:14:14 +0200
From: "Zlach" <zlach@yahoo.com>
Subject: Javascript or Perl ?
Message-Id: <9dchot$7dj$1@ss204.hinet.hr>

I'd like to learn Javascript and Perl.
And the question is which one to learn first ?

Zlach






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

Date: Thu, 10 May 2001 00:10:21 GMT
From: tim@vegeta.ath.cx (Tim Hammerquist)
Subject: Re: Javascript or Perl ?
Message-Id: <slrn9fjni8.4e6.tim@vegeta.ath.cx>

Zlach <zlach@yahoo.com> wrote:
> I'd like to learn Javascript and Perl.
> And the question is which one to learn first ?

If you make a lot of web pages without much server-side processing,
JavaScript may be higher in your priorities.  Otherwise, learn Perl.
After you learn Perl, decide whether you even care about JavaScript
anymore.  ;)

HTH
-- 
-Tim Hammerquist <timmy@cpan.org>
Millions long for immortality who do not know what
to do with themselves on a rainy Sunday afternoon.
	-- Susan Ertz


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

Date: Thu, 10 May 2001 00:21:48 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Javascript or Perl ?
Message-Id: <tfjnosci6iai36@corp.supernews.com>

Zlach <zlach@yahoo.com> wrote:
> I'd like to learn Javascript and Perl.
> And the question is which one to learn first ?

Whichever pays more in your area. HTH.

Chris

P.S. Read Google's newsgroups section if you think you might
     be asking a question that is already well-covered.

P.P.S. This question is well-covered.

P.P.P.S. You are not likely to get the same answer from everyone.

P.P.P.P.S. Some people will not answer with either of the choices
           you provide. Life is not multiple choice. Get over this
           fact and carry on.

P.P.P.P.P.S. Google's newsgroups section is at http://groups.google.com

P.P.P.P.P.P.S. Good day now, and aren't you glad there are no more
               postscripts? ;-)

-- 
Even in the worst of times, there is always someone who's
never had it better. Even in the best of times, there is
always someone who's never had it worse.



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

Date: Wed, 09 May 2001 17:55:09 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Javascript or Perl ?
Message-Id: <3AF9E6ED.B7277BA7@stomp.stomp.tokyo>

Zlach wrote:
 
> I'd like to learn Javascript and Perl.
> And the question is which one to learn first ?
 
Although my personal opinion is Java sucks, learn
both Perl and Java languages, together. They are
compatible, similar in syntax and can be blended
into rather useful programs, such as mine following
my signature.

Always remember to provide alternative standard html
loading on a site page, for those whom never have
java enabled, such as myself. When I encounter pure
java pages, my response is to email the author or
site owner and, advise him what a bozo he is and to
remove his site from our internet with it being 
insultingly unfit for use.


Godzilla!
-- 

Name this java.pl and enable
java script in your browser.


#!perl

print "Content-type: text/html\n\n";

$message1 = "I told you not to click this!";
$message2 = "You are such a bozo!";
$message3 = "You will email an apology to me!";
$email = "callgirl\@la.znet.com";
$subject = "My Apology";

print "
<HTML><BODY>
<BR><BR>
<CENTER>

<TABLE BORDER=\"5\" CELLPADDING=\"3\">
<TD BGCOLOR=\"#ffffff\">
<FONT FACE=\"mistral\" SIZE=\"6\" COLOR=\"#000000\">
&nbsp;
Godzilla
&nbsp;
</TD>

<TD BGCOLOR=\"#c0c0c0\">
<FONT FACE=\"arial rounded mt bold\" SIZE=\"4\" COLOR=\"#000000\">
<A HREF=\"java.pl\" onClick=\"
alert('$message1');
alert('$message2');
alert('$message3');
window.open('mailto:$email?subject=$subject')\">
&nbsp;
Do NOT Click
&nbsp;
</A>
</FONT>
</TD>

<TD BGCOLOR=\"#000000\">
<FONT FACE=\"mistral\" SIZE=\"6\" COLOR=\"#ffffff\">
&nbsp;
Rocks!
&nbsp;
</FONT>
</TD>
</TABLE>
</CENTER>
</BODY></HTML>";

exit;


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

Date: 10 May 2001 00:15:33 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: Javascript or Perl ?
Message-Id: <867kzq83fe.fsf@jon_ericson.jpl.nasa.gov>

"Zlach" <zlach@yahoo.com> writes:

> I'd like to learn Javascript and Perl.
> And the question is which one to learn first ?

I suppose it depends on what you plan to do and what sort of expertise
you already have.  Or is this just a troll?

Jon


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

Date: Wed, 09 May 2001 22:32:22 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: latest stable version of Perl
Message-Id: <tfjhbm6etis4c2@corp.supernews.com>

Craig Berry <cberry@cinenet.net> wrote:
> Chris Stith (mischief@velma.motion.net) wrote:
> : Not that I'd dare to speak for Abigail, but I took it to mean that
> : there's no single version of Perl Abigail would consider to be of
> : penultimate stability and more fit for production than all other
> : versions.

> Just for the record, 'penultimate' means 'next to ultimate', or 'next to
> last'.  It's not a more intense way to say 'ultimate'.  Rather the
> opposite, actually.  Sorry, sore spot of mine...

Sorry, bad editing on my part. The original wording was different
but long. When I pared it, I saw 'ultimate', and overlooked the
'pen'. 

Here's my post in a nutshell, as I'm so bad at doing:

    There's probably no version of perl which is better
    than all others in every way. Some are likely to be
    nearly best at one thing and nearly worst at another.
    A good balance needs to be struck when searching for
    a version, and accounting for your specific needs as
    part of the decision is in order.

Chris

-- 
For the pleasure of others, please adhere to the following
rules when visiting your park:
    No swimming.  No fishing.  No flying kites.  No frisbees.
    No audio equipment. Stay off grass.  No pets. No running.



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

Date: Thu, 10 May 2001 00:27:11 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Local Time
Message-Id: <Pine.LNX.4.30.0105100011400.25626-100000@lxplus003.cern.ch>

On Wed, 9 May 2001, Scratchie wrote:

> How does he know that /usr/bin/perl (or whatever) is really the perl
> compiler and not something malicious?

I challenged the hon. Usenaut about his tainting for a specific
reason. You'll notice he advocated spawning-off a command via an
implicit path.  That might, for example, have been a compromised
executable that had gotten saved into his current directory (if that's
on his path) or into wherever he keeps his personal binaries (which
presumably _is_ on his path).

While it's obviously not totally out of the question that some hacker
had got in and interfered with system binaries (such as ls or date or
even perl), most systems that dare to connect to a live Internet have
some means of auditing those, and setting off alarms when they have
been 'got at'.  I think we can be pretty sure that the hon. Usenaut
doesn't run Tripwire (or equivalent) on the subdirectories where he
stashes his own binaries.

If he had advocated executing `/bin/date` or wherever the _system_
copy lives on his system, his proposal would merely have been very
silly. As it was, it was not only very silly, but pointlessly risky.

And I rather suspect that his continuing to insist that all this fuss
is over nothing is convincing the regulars that it wasn't just done
out of lack of knowledge - which is at least open to remedy - but was
something worse.

ttfn



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

Date: Wed, 09 May 2001 22:50:03 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Local Time
Message-Id: <vQjK6.1489$I5.436668@news1.rdc1.tn.home.com>

what does "hon. Usenaut" mean? If I'm going to be called that, I'd like to
know what it means.

-todd




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

Date: 09 May 2001 18:06:53 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Local Time
Message-Id: <87y9s6ceb6.fsf@limey.hpcc.uh.edu>

>> On Wed, 09 May 2001 22:50:03 GMT,
>> "Todd Smith" <todd@designsouth.net> said:

> what does "hon. Usenaut" mean? If I'm going to be called
> that, I'd like to know what it means.

Honourable sailor of USENET.

use + naut, naut from Grk. "nautikos", Lat. "nauticus",
hence "nautilus", "nautical" etc.

hth
t
-- 
Just reach into these holes.  I use a carrot.


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

Date: Wed, 09 May 2001 23:32:46 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Local Time
Message-Id: <tfjksuogg3gcdd@corp.supernews.com>

Todd Smith (todd@designsouth.net) wrote:
: what does "hon. Usenaut" mean? If I'm going to be called that, I'd like to
: know what it means.

"Hon." is an abbreviation for "honorable"; one often sees the abbreviation
used in transcripts of the proceedings of the English Parliament, for
example, where referring to the previous speaker as "The honorable Member"
is a custom.  Hence the classic "The honorable Member is a horse's ass."
You have to love the Brits.

Usenaut is a rather nice pun, combining Usenet (which I'm sure you
recognize) with the Greek-derived suffix -naut, from "nautos", sailor.
Astronaut, for example, means "star sailor".  A "usenaut" is thus a
compact way of saying "one who sails the Usenet".

By the way, "naus" is the Greek for "ship" (with a clear relation to
"nautos"), which was borrowed into Latin as "navis", which is in turn the
root of such English words as "navigate" and "navy".  So "nautical" means
"about sailors", but "naval" means "about ships".

What a great language we have.  Oh, and perl is pretty cool, too. :)

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "God becomes as we are that we may be as he is."
   |               - William Blake


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

Date: 9 May 2001 23:34:25 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: Local Time
Message-Id: <slrn9fjl02.fq6.dha@panix2.panix.com>

In article <n_hK6.1415$I5.347460@news1.rdc1.tn.home.com>, Todd Smith wrote:
> 
> All he knows is that I use `date` instead 'localtime'. I don't think that
> makes me a bad coder. If you do, don't hire me.

He also has a pretty good idea from this thread what your knowledge of
security issues are.  Apparently they don't appear particularly secure.

No offence intended, but given that you think calling to an outside
process is secure and Randal thinks it isn't, I'm siding with Randal.

Of course, you will probably just interpret this as an attack of some
sort, rather than gathering that you could actually learn something from
some of the people in this thread.  Oh well.  *shrug*

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"Anybody's apt to trip."
"Not over a sofa!" - The Lady Eve


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

Date: 09 May 2001 18:36:54 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Local Time
Message-Id: <87pudiccx5.fsf@limey.hpcc.uh.edu>

>> On Wed, 09 May 2001 23:32:46 -0000,
>> cberry@cinenet.net (Craig Berry) said:

> What a great language we have.  Oh, and perl is pretty
> cool, too. :)

hence

    use Net;

I knew there was an ulterior motive for "use" :-)

-- 
Just reach into these holes.  I use a carrot.


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

Date: Wed, 09 May 2001 23:38:38 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Local Time
Message-Id: <2ykK6.1560$I5.480701@news1.rdc1.tn.home.com>

now this is a post I can learn from!

"Craig Berry" <cberry@cinenet.net> wrote in message
news:tfjksuogg3gcdd@corp.supernews.com...
> Todd Smith (todd@designsouth.net) wrote:
> : what does "hon. Usenaut" mean? If I'm going to be called that, I'd like
to
> : know what it means.
>
> "Hon." is an abbreviation for "honorable"; one often sees the abbreviation
> used in transcripts of the proceedings of the English Parliament, for
> example, where referring to the previous speaker as "The honorable Member"
> is a custom.  Hence the classic "The honorable Member is a horse's ass."
> You have to love the Brits.
>
> Usenaut is a rather nice pun, combining Usenet (which I'm sure you
> recognize) with the Greek-derived suffix -naut, from "nautos", sailor.
> Astronaut, for example, means "star sailor".  A "usenaut" is thus a
> compact way of saying "one who sails the Usenet".
>
> By the way, "naus" is the Greek for "ship" (with a clear relation to
> "nautos"), which was borrowed into Latin as "navis", which is in turn the
> root of such English words as "navigate" and "navy".  So "nautical" means
> "about sailors", but "naval" means "about ships".
>
> What a great language we have.  Oh, and perl is pretty cool, too. :)
>
> --
>    |   Craig Berry - http://www.cinenet.net/~cberry/
>  --*--  "God becomes as we are that we may be as he is."
>    |               - William Blake




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

Date: Wed, 09 May 2001 23:40:34 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Local Time
Message-Id: <SzkK6.1563$I5.481893@news1.rdc1.tn.home.com>


"David H. Adler" <dha@panix2.panix.com> wrote in message
news:slrn9fjl02.fq6.dha@panix2.panix.com...
> In article <n_hK6.1415$I5.347460@news1.rdc1.tn.home.com>, Todd Smith
wrote:
> >
> > All he knows is that I use `date` instead 'localtime'. I don't think
that
> > makes me a bad coder. If you do, don't hire me.
>
> He also has a pretty good idea from this thread what your knowledge of
> security issues are.  Apparently they don't appear particularly secure.
>
> No offence intended, but given that you think calling to an outside
> process is secure and Randal thinks it isn't, I'm siding with Randal.
>
> Of course, you will probably just interpret this as an attack of some
> sort, rather than gathering that you could actually learn something from
> some of the people in this thread.  Oh well.  *shrug*
>
> dha

Apparently it doesn't matter what I think- everything I say is wrong or
stupid or pointless to everybody else. But I see your point about the
unsecure outside process. (I hope that wasn't the wrong thing to say!)

-todd




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

Date: 9 May 2001 23:50:30 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: MD/DC area ?
Message-Id: <slrn9fjlu8.fq6.dha@panix2.panix.com>

In article <20010508232639.04389.00002290@ng-fr1.aol.com>, CDantes wrote:
> Hi,
> Im looking for a PERL programmer to work on a couple pages for me; simple
> database retrieval stuff.

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :)  (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

http://jobs.perl.org may be of more use to you

Yours for a better usenet,

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Hat! Hat! Hat!	- piglet@piglet.org


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

Date: Thu, 10 May 2001 09:07:58 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Perl 2 Exe
Message-Id: <wwkK6.2$Pm.3152@vic.nntp.telstra.net>

"Tony Van der Voort" <tvdv@advalvas.be> wrote in message
news:3af92457.900417@news.skynet.be...
> Can this PerlApp also be used to create executables for linux ?
> Because this is what I need, my webserver runs under Unix-Linux.

I don't believe so, as this is designed for Windows, but check Activestate's
homepage at www.activestate.com

Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;




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

Date: Thu, 10 May 2001 09:11:13 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Perl 2 Exe
Message-Id: <uzkK6.3$Pm.3142@vic.nntp.telstra.net>

"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:vecifto3c1pmjk3d7iimeusvg1a5uti6gu@4ax.com...
> Wyzelli wrote:
>
> >I have had better success with PerlApp from the PDK which is available
from
> >Activestate.
>
> What do you mean, "better success"?

Ah, the vague qualitative term.

I tried Perl2exe some time ago, and was not happy with the results (or the
price).  I tried the PDK more recently and was very happy with the results,
not least because you get so much other stuff, like the gui debugger etc,
and the trial actually is a non crippled trial as well.

I have created and distributed several .exe since purchasing the PDK, where
I had no confidence to do so with Perl2exe.

All in all a pretty vague response, but since ActivePerl comes from
Activestate, I guess I have more confidence in their compiler.

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_!=1)? 's':'';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';





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

Date: Wed, 09 May 2001 15:28:47 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: weird error on @array syntax
Message-Id: <3AF9C49F.B7F88A45@stomp.stomp.tokyo>

Craig Berry wrote:
 
> Srdan Simunovic wrote:

(snipped problem with printing eval returns)

> I understand this will be downgraded to a warning in some future version.
> In brief, the Perl compiler cannot, at compiler time, see any other
> reference to @a anywhere in your program, so it leaps to the conclusion
> that you are trying to write a literal '@' rather than trying to
> interpolate @a.  You could correct this problem by doing a 'use vars' or
> 'our' declaration of @a before the eval, so that the variable will be
> recognized as a variable at compile time.  Or...
 
> ...using the variable *as* an unambiguous variable also makes the compiler
> recognize it, removing the problem.
 
> : Is it me (more probably) or perl?
 
> I'd actually blame this one more on perl.


Yours is a very good explanation; clear and concise.
 
This is beyond my area of expertise. Nonetheless,
I am not so sure use of the eval function under
these circumstances presented, should be changed
from a fatal error to a warning. Ironically, no
solution can be offered by me. This seems more a
case of a programmer being sufficiently skilled
and experienced to know about this oddball glitch.

Run my script below my signature, then analyze how
it is written. You will quickly notice how this type
of problem could slip right past a programmer who
does not write programs in verbose Plain English,
my Perl 4 style, or is not paying attention to a
database. This would certainly slip by those who copy
and paste syntax, rather than write code, such as
with those whom learn Perl by copy and paste of
module syntax.

Certainly does add a new twist for you boys, about
my contention people should place every effort 
possible on learning how to program, rather than
learning how to become a copy and paste technician.

Copy and paste is no substitute for programming experience.


Godzilla!
--

My "test.txt" is the same as the originating
author's "inc" file: @a=(1,2,3);


#!perl

print "Content-type: text/plain\n\n";

@a = (4,5,6);

print @a;

print "\n\n";

open(PARMS, "test.txt");
undef $/;
$str=<PARMS>;
close(PARMS);
print eval $str;

print "\n\n";

print @a;

exit;


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

Date: Wed, 09 May 2001 15:55:58 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: weird error on @array syntax
Message-Id: <3AF9CAFE.E895FBA9@stomp.stomp.tokyo>

"Godzilla!" wrote:
 
> Craig Berry wrote:
> > Srdan Simunovic wrote:

> (snipped problem with printing eval returns)
 
> > I understand this will be downgraded to a warning in some future version.

(snipped again)

Oh what the heck. I might as well launch into one of 
my tirades about the importance of local () usage,
a function almost all scream should be removed
from perl core.

Read and run my script, then play around with use
of my () declarations. You will discover you have
to bend an unwritten rule to make effective of use
my () for these circumstances, and have desired 
results of eval () not FUBAR'n the array.

Godzilla!
--

My test.txt contains: @a = (1,2,3);


#!perl

print "Content-type: text/plain\n\n";

@a = (4,5,6);

print @a;

print "\n\n";

&Local;

sub Local
 {
  local (@a, $/);
  open(PARMS, "test.txt");
  undef $/;
  my ($str) = <PARMS>;
  close(PARMS);
  print eval $str;
  print "\n\n";
  print @a;
 }

print "\n\n";

print @a;

exit;


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

Date: Wed, 09 May 2001 23:39:26 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: weird error on @array syntax
Message-Id: <tfjl9eijjoud6a@corp.supernews.com>

Godzilla! (godzilla@stomp.stomp.tokyo) wrote:
: Yours is a very good explanation; clear and concise.

Thanks.

: This is beyond my area of expertise. Nonetheless,
: I am not so sure use of the eval function under
: these circumstances presented, should be changed
: from a fatal error to a warning.

Note that it's not the use of eval that causes the error; rather, it's the
use of an otherwise unknown-at-compile-time array variable in double-
quotish context.  The eval changes the DWIMosity of the situation, but
there's no way for the compiler to know that.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "God becomes as we are that we may be as he is."
   |               - William Blake


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

Date: Wed, 09 May 2001 17:31:12 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: weird error on @array syntax
Message-Id: <3AF9E150.71C6401F@stomp.stomp.tokyo>

Craig Berry wrote:
 
> Godzilla! wrote:

> : Yours is a very good explanation; clear and concise.
 
> Thanks.

Thank yourself for investing your own time and effort
into a well written article.

 
> : This is beyond my area of expertise. Nonetheless,
> : I am not so sure use of the eval function under
> : these circumstances presented, should be changed
> : from a fatal error to a warning.
 
> Note that it's not the use of eval that causes the error; rather, it's the
> use of an otherwise unknown-at-compile-time array variable in double-
> quotish context.  The eval changes the DWIMosity of the situation, but
> there's no way for the compiler to know that.


Well, this does change my DUHosity. Glad I prefaced with this being
beyond my expertise. There are fleeting moments, usually when I am
angry with someone here, I wish I could remember these little known
bugs with Perl. However, anger increases DIMosity of thinking and
usually leads to making embarrassing mistakes.

It is rewarding to discover a "You are ready for IBM" moment.
I have not thought about this compile / eval glitch for a very
long time. My cure came to mind, right off though. I thought
about suggesting, following his eval function,

@a = @a;
print "@a\n";

to satisfy the author's possible need to incorporate spaces
between elements by moving the eval created array into a 
double quoted treatment. However, I decided most would laugh
with such crazy looking syntax. Works though!

I really enjoy your articles.


Godzilla!


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

Date: Thu, 10 May 2001 00:54:28 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: weird error on @array syntax
Message-Id: <3af9e4bf.175972546@news.erols.com>

On Wed, 09 May 2001 16:40:19 -0400, Srdan Simunovic
<lastnamefirstnameinitial@ornl.gov> wrote:

>I am getting an error:
>../bin/inctest
>In string, @a now must be written as \@a at ../bin/inctest line 9, near
>"@a"
>Execution of ../bin/inctest aborted due to compilation errors.

The cause and cure to this problem have been discussed already, so
I'll skip that.  It should be mentioned, however, that whenever you
think "weird error," your reflex should be to type "use diagnostics;"
into your program.  The blurb of text displayed when this particular
error occurs would probably have provided all the help you needed.


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

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


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