[15435] in Perl-Users-Digest
Perl-Users Digest, Issue: 2845 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 22 21:10:21 2000
Date: Sat, 22 Apr 2000 18:10:12 -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: <956452211-v9-i2845@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 22 Apr 2000 Volume: 9 Number: 2845
Today's topics:
Re: Need advice on file accessing <gellyfish@gellyfish.com>
Re: print using? <dwb1@home.com>
Re: PUNY Perl Sig, Tue Apr 25th @ IBM, NYC john@thinman.com
Re: purpose of use vars () ? <schan_ca@geocities.com>
Re: purpose of use vars () ? (Kragen Sitaker)
Re: Quick Reference Book recommendations needed <gellyfish@gellyfish.com>
Referencing nightmare timf97@earthlink.net
Response from perlbug@perl.com (Mike Fry)
Re: Search a line with =~ <gellyfish@gellyfish.com>
set-like data structure? <Tom_Roche@ncsu.edu>
Re: set-like data structure? <tony_curtis32@yahoo.com>
Re: set-like data structure? (Kragen Sitaker)
Re: subname from subref <joseph.kazimierczyk@bms.com>
Re: UNC drive\path\file for NT Cgi/Perl script <gellyfish@gellyfish.com>
upload in nt <jesus@planetavirtual.com>
Re: What's the meaning of "my Foo $x"? <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Apr 2000 23:49:05 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need advice on file accessing
Message-Id: <8dta91$piu$1@orpheus.gellyfish.com>
On Wed, 12 Apr 2000 16:17:26 +0200 Joachim Pimiskern wrote:
> Hi Frank,
>
> Franklin Edward Sadler schrieb in
> Nachricht <8d1u2l$l2v@catapult.gatech.edu>...
>>for ex. open(RESULTS, ">FRANK.txt") || die "xxx";
>>For some reason this doesnt seem to work, I can read from the file though,
>>just can't open it for writing. All file permissions are set and what not.
>
>
> you could at least let your script die
> with the error message on its lips: die "$!\n";
>
I know its more than a week ago but I love that you punk poet.
/J\
--
I'm not a bad guy! I work hard, and I love my kids. So why should I
spend half my Sunday hearing about how I'm going to Hell?
--
fortune oscar homer
------------------------------
Date: Fri, 21 Apr 2000 15:48:24 GMT
From: <dwb1@home.com>
Subject: Re: print using?
Message-Id: <390242d5$0$17676@personalnews.de.uu.net>
On Fri, 21 Apr 2000, Tom Briles wrote:
> dwb1@home.com wrote:
> >
> > A few months ago, I ran across in perl the same
> > functionality (well close, only better), of the
> > "print using" command in BASIC. Of course, now
> > that I have a use for it, I can't remember what
> > it was called, of find the test scripts I made
> > at the time to play with it...
> >
> > Anyone know what it is I'm talking about?
>
> Assuming I sorta remember what 'print using' does...
>
> perldoc -f format
> perldoc perlform
>
Yes, that's exactly what I was looking for!
Thanks!
Dan.
------------------------------
Date: Fri, 21 Apr 2000 15:39:21 GMT
From: john@thinman.com
Subject: Re: PUNY Perl Sig, Tue Apr 25th @ IBM, NYC
Message-Id: <390242d6$0$17676@personalnews.de.uu.net>
I put the link as a tribute to the mongers.
I framed it because it is really ugly.
I removed it because you are a self-admitted "ass", ( do you want me to
post the letter you sent David and me? )
You chose to make this a public issue, I offered to forget the whole
thing.
> tax-exempt determination to be denied, or our not-for-profit status
> to be revoked.
Who cares, you sell hats. The IRS isn't after you.
> a good attorney...
BTW, thats a NYSIA member service, a good organization to belong to.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 22 Apr 2000 21:42:52 GMT
From: stephen <schan_ca@geocities.com>
Subject: Re: purpose of use vars () ?
Message-Id: <39021E29.8F18CB6C@geocities.com>
Jonathan Stowe wrote:
> On Sat, 22 Apr 2000 05:33:07 GMT stephen wrote:
> > What's the purpose of use vars () ?
> >
>
> It is used mostly when 'use strict' or 'use strict "vars"' is in operation.
>
> It causes package global variables to be predeclared in such a way that
> you dont have to supply an explicit package name to to the variable.
>
Then there's no difference between
-----------
package aaa;
use strict;
my ($var_1);
-----------
and
-------------
package aaa;
use strict;
use vars ($var_1);
-------------
because in both cases, I can simple access "$var_1"
within it's package "aaa" without explicitly stating "$aaa::var_1".
Do I have this right?
Thanks
Steve
------------------------------
Date: Sun, 23 Apr 2000 01:57:11 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: purpose of use vars () ?
Message-Id: <XLsM4.753$RM6.729541@news-east.usenetserver.com>
In article <39021E29.8F18CB6C@geocities.com>,
stephen <schan_ca@geocities.com> wrote:
>> It causes package global variables to be predeclared in such a way that
>> you dont have to supply an explicit package name to to the variable.
>
>Then there's no difference between
>
>-----------
>package aaa;
>use strict;
>my ($var_1);
>-----------
>
>and
>
>-------------
>package aaa;
>use strict;
>use vars ($var_1);
>-------------
>
>because in both cases, I can simple access "$var_1"
>within it's package "aaa" without explicitly stating "$aaa::var_1".
>
>Do I have this right?
Not quite --- I thought so too, but I was wrong. my $var_1 creates a
new lexical variable $var_1 that is completely unrelated to the package
variable $aaa::var_1. The lexical variable is not accessible via the
symbol table.
Also, use vars needs strings as arguments, not variables:
use vars '$var_1'; # or
use vars qw($var_1); # or
use vars ('$var_1');
HTH.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
The power didn't go out on 2000-01-01 either. :)
------------------------------
Date: 21 Apr 2000 15:27:08 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Quick Reference Book recommendations needed
Message-Id: <390242d0$0$17676@personalnews.de.uu.net>
On 21 Apr 2000 02:30:18 GMT David H. Adler wrote:
> On 20 Apr 2000 10:00:52 -0700, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
>>What *do* you want in your bag at TPC?
>
...
> A Steenbeck (in a pinch I'd take a moviola)
...
Wuss. Whats wrong with a Pic-Sync and a steady hand ? And the Moviola
would take up less floor space. Perhaps they might stretch to a box of
Chinagraph pencils and some blades ;-}
Anyhow whats the plan 'Perl - The movie' ?
/J\ - who used to work with this stuff before taking up the keyboard.
--
I'm not a bad guy! I work hard, and I love my kids. So why should I
spend half my Sunday hearing about how I'm going to Hell?
--
fortune oscar homer
------------------------------
Date: Fri, 21 Apr 2000 15:29:10 GMT
From: timf97@earthlink.net
Subject: Referencing nightmare
Message-Id: <390242d1$0$17676@personalnews.de.uu.net>
I have a hash that contains two scalers and an array of hashes.
I pass a reference to the hash to a subroutine, and then want to pass
each of the hashes contained in the array to another subroutine. I
have been able to get it working by putting a special 'last hash' flag
in the array (of hashes), and using the following code:
my $x = 0;
while (%$rThisSec->{XpndHashs}->[$x]->{Title} ne 'Terminator') ){
my $NextSec = (%$rThisSec->{XpndHashs}->[$x]);
&subPrntSec ( \%$NextSec );
$x++;
}
I would think that I should be able to do this with a simple foreach
loop (and forget the screwy 'last hash' flag, such as:
my $HdrArray = \%$rThisSec->{'XpndHashs'};
foreach $NextSec (@$HdrArray) {
&subPrntSec ( \%$NextSec );
}
but everything I try either goes into an infinite loop or doesn't see
anything.
Any ideas on what I am doing wrong?
------------------------------
Date: 23 Apr 2000 01:08:48 +0200
From: nospam.yrfekim@nospam.acirfai.com (Mike Fry)
Subject: Response from perlbug@perl.com
Message-Id: <UdqMGoQ7Ipid-pn2-HsjcNSB2ZJWS@minitower>
When reporting errors to perlbug@perl.com, should I expect to receive
any acknowledgement?
--
Regards, Mike Fry
email: mikefry@iafrica.com
------------------------------
Date: 22 Apr 2000 23:57:59 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Search a line with =~
Message-Id: <8dtapn$pjo$1@orpheus.gellyfish.com>
On 3 Apr 2000 05:39:30 GMT David H. Adler wrote:
> On Sun, 02 Apr 2000 23:21:52 GMT, Elaine Ashton <elaine@chaos.wustl.edu> wrote:
>>in article slrn8ebav7.l4l.dha@panix2.panix.com, David H. Adler at
>>dha@panix.com quoth:
>>
>>> ...and hopefully abandons the theory above. If even a third of the
>>> stories about Hughes' later years are true, he was *quite* insane.
>>> Perhaps more comfortable than those psychotics less well off, but
>>> certainly well beyond "eccentric".
>>
>>He was neither, really, as he was dying of an advanced case of Syphillus
>>which 'ate his brain' so to speak. He began most of his erratic and crazy
>>behaviour after he contracted the disease.
>
> Regardless of its cause, I still call it crazy. *shrug*
>
When the spyroachete has your brain, the spyroachete has your brain ...
its all over bub.
Mrs gellyfish deals with people with acute dimentias if you want some
advice ;-}
/J\
--
First you don't want me to get the pony, then you want me to take it
back. Make up your mind.
--
fortune oscar homer
------------------------------
Date: Sat, 22 Apr 2000 02:14:23 -0400
From: Tom Roche <Tom_Roche@ncsu.edu>
Subject: set-like data structure?
Message-Id: <3901433F.C0985142@ncsu.edu>
I need a Perl data structure that functions minimally like a set--
a subset of "set," if you will :-) It should efficiently support the
operations of
0 adding a member
1 testing for membership
2 serial retrieval of members
Lists are fine for 0 (push, unshift) and 2 (pop, shift, foreach) and
would seem to be space-efficient ... but is there a time-efficient
test for list membership?
One could also use a hash, using the keys as the set members. This
does 0 easily enough enough, and 1 via "exists($hash{$key})", though I
don't know how efficiently. I'm also wondering about how efficiently
this approach does 2 (since one must do "keys %hash" to get at the
data, correct?), and I'm pretty skeptical about this approach's space
efficiency anyway.
Is one of these options actually superior? Are there other options
I've not considered that are superior to both?
Please respond directly to me as well as the group, and TIA,
Tom_Roche@ncsu.edu
------------------------------
Date: 22 Apr 2000 17:54:27 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: set-like data structure?
Message-Id: <87vh197nmk.fsf@shleppie.uh.edu>
>> On Sat, 22 Apr 2000 02:14:23 -0400,
>> Tom Roche <Tom_Roche@ncsu.edu> said:
> I need a Perl data structure that functions minimally
> like a set-- a subset of "set," if you will :-) It
> should efficiently support the operations of
> 0 adding a member
$set{foo} = 1;
> 1 testing for membership
if (defined $set{foo}) { ... }
> 2 serial retrieval of members
keys %set;
> One could also use a hash, using the keys as the set
> members. This does 0 easily enough enough, and 1 via
Well there you go. A hash is fine. The keys are the
members of the set.
$set{$member} = 1;
and so on. The individual values can be greater values if
you want to implement a bag.
There are also various Set:: modules available through
CPAN.
hth
tony
------------------------------
Date: Sat, 22 Apr 2000 23:57:13 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: set-like data structure?
Message-Id: <t%qM4.526$RM6.124677@news-east.usenetserver.com>
In article <3901433F.C0985142@ncsu.edu>, Tom Roche <Tom_Roche@ncsu.edu> wrote:
>Lists are fine for 0 (push, unshift) and 2 (pop, shift, foreach) and
>would seem to be space-efficient ... but is there a time-efficient
>test for list membership?
No.
>One could also use a hash, using the keys as the set members. This
>does 0 easily enough enough, and 1 via "exists($hash{$key})", though I
>don't know how efficiently. I'm also wondering about how efficiently
>this approach does 2 (since one must do "keys %hash" to get at the
>data, correct?)
Depending on what you're doing, each %hash might make you happier.
>and I'm pretty skeptical about this approach's space
>efficiency anyway.
Perl is not particularly space-efficient in general. I haven't
benchmarked, but I doubt the hash will be much bigger than the list.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
The power didn't go out on 2000-01-01 either. :)
------------------------------
Date: Fri, 21 Apr 2000 11:08:58 -0400
From: Joe Kazimierczyk <joseph.kazimierczyk@bms.com>
Subject: Re: subname from subref
Message-Id: <390242cb$0$17676@personalnews.de.uu.net>
I guess another option would be to pass the sub name as a string instead of a reference. I could
still use this to call the sub, and be able print out the name. But something tells me this isn't
the right way to go?
Bart Lateur wrote:
> Er... you could try traversing Perl's symbol table(s), and check all
> entries for the CODE entry inf the typeglob, and compare it to what
> you've got.
------------------------------
Date: 22 Apr 2000 21:54:26 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: UNC drive\path\file for NT Cgi/Perl script
Message-Id: <8dt3i2$ocs$1@orpheus.gellyfish.com>
On Sat, 22 Apr 2000 17:23:04 GMT Fred Zimmerman wrote:
> How do I specify a drivename:\pathname\filename within a Perl/CGI
> script.
> I am running CGI on NT/IIS system.
>
> I tried the following which failed to open file:
>
> file:///d:/cgi/movies.dat
>
I believe that you already asked a similar question. With NT the
administrator is able to restrict user access to a wide variety of
resources amongst which is access to the network. The user which CGI
programs are run as has extremely limited rights to *all* resources by
default. You will need to consult the administrator of your system
to arrange to have the appropriate user given the appropriate rights.
If you *are* the administrator of the system then you will want to
either consult the appropriate documentation or ask in a group that
discusses the administration of NT systems.
Once you have all that sorted out you will find that you can open
files by their UNC path (ie //server/share/path )
/J\
--
Does whisky count as beer?
--
fortune oscar homer
------------------------------
Date: Sun, 23 Apr 2000 02:56:59 +0200
From: "Jesus" <jesus@planetavirtual.com>
Subject: upload in nt
Message-Id: <8dthu8$o5h$1@diana.bcn.ttd.net>
Hello,
When i try the next lines (for uploading in nt server), i get a 'CGI open of
.\CGItemp4560001: Permission denied' error.
It looks like there's no permissions for writing a temporary file. If so,
which is the path for this temp stuff?
use CGI;
$obj=new CGI;
$file = $obj->param("file");
Thanks for your attention.
------------------------------
Date: 21 Apr 2000 15:11:44 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: What's the meaning of "my Foo $x"?
Message-Id: <390242ce$0$17676@personalnews.de.uu.net>
On 20 Apr 2000 19:20:07 +0100 nobull@mail.com wrote:
> merlyn@stonehenge.com (Randal L. Schwartz) writes:
>
>> >>>>> "nobull" == nobull <nobull@mail.com> writes:
>>
>> nobull> "John Lin" <johnlin@chttl.com.tw> writes:
>> >> my Foo $x;
>>
>> >> Can someone explain its meaning, and in what situation it is useful?
>>
>> nobull> Lot's of people have offered RTFM answers to this referring to
>> nobull> manuals that do not answer this question.
>>
>> Really?
>
> Yes.
>
>> What part of your docs do not look like this....
> [ snip "perldoc fields" ]
>
>
> BTW given that this syntax does not appear in "perldoc -f my" I think
> we should all thank John for finding a docuentation bug and stop
> treating him like an idiot.
>
It is touched upon in the perlsub manpage - 'Private Variables via my()'
but the attributes manpage is the one where this is really discussed.
/J\
--
It may be on a lousy channel, but the Simpsons are on TV!
--
fortune oscar homer
------------------------------
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 2845
**************************************