[18359] in Perl-Users-Digest
Perl-Users Digest, Issue: 527 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 19 11:05:46 2001
Date: Mon, 19 Mar 2001 08:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985017911-v10-i527@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 19 Mar 2001 Volume: 10 Number: 527
Today's topics:
ANNOUNCE: Win32::ActAcc 0.5 (Windows 'Active Accessib <pbwolf@bellatlantic.net>
Re: Can't combine > and $ <edward.coates@sabre.com>
confused about my and scoping (J.C.Posey)
Re: confused about my and scoping (Rafael Garcia-Suarez)
Re: confused about my and scoping (Anno Siegel)
Re: confused about my and scoping <joe+usenet@sunstarsys.com>
Re: confused about my and scoping (J.C.Posey)
Re: confused about my and scoping (Rafael Garcia-Suarez)
Re: confused about my and scoping (Anno Siegel)
Re: confused about my and scoping <goldbb2@earthlink.net>
Re: confused about my and scoping (Anno Siegel)
Re: confused about my and scoping (J.C.Posey)
Re: confused about my and scoping <joe+usenet@sunstarsys.com>
Re: HTTP Client Question <spohn@bigfoot.com>
Re: HTTP Client Question <iltzu@sci.invalid>
Re: HTTP Client Question <callgirl@la.znet.com>
News::Newsrc 1.08 released (Steven W McDougall)
Re: Perl for Windows <bart.lateur@skynet.be>
Re: Perl for Windows <bart.lateur@skynet.be>
Re: Perl for Windows <bart.lateur@skynet.be>
Re: Powers <iltzu@sci.invalid>
Re: Print "tar" Success or Failure (Tad McClellan)
Re: push, pop file handles to deal with recursive #incl (Randal L. Schwartz)
Re: Spaces in path to perl script (NT) <lmoran@wtsg.com>
Re: Straight array output (Anno Siegel)
Re: Why do "Learning Perl" Books Do This? A Subroutine <alun.moon@unn.ac.uk>
Win32::File::SetAttributes($file,$attr + COMPRESSED) w <ITguy@advalvas.NOSPAM.be>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 18 Mar 2001 22:25:40 GMT
From: "Phill Wolf" <pbwolf@bellatlantic.net>
Subject: ANNOUNCE: Win32::ActAcc 0.5 (Windows 'Active Accessibility')
Message-Id: <tbc4n1k0qm6me0@corp.supernews.com>
Active Accessibility (intended to assist the blind) lets programs "see"
what's on the screen and detect mouse motion, window focus changes, and the
like. Win32::ActAcc gives Perl scripts full run of the Active Accessibility
client API.
Sample included: aaAIMEliza.pl - watches for AOL Instant Message window,
scrapes the incoming message into a string, trots it through the
Chatbot::Eliza psychotherapist, and types Eliza's answer into AIM with
Win32::GuiTest. Keeps a separate antiseptic Eliza instance for each
correspondent. Has crippling imperfections, but none that a bit more
hacking couldn't solve (exercise left to reader). Rube Goldberg alert.
PPM installer included in the zip file on CPAN.
------------------------------
Date: Mon, 19 Mar 2001 09:07:52 -0600
From: Edward Coates <edward.coates@sabre.com>
Subject: Re: Can't combine > and $
Message-Id: <3AB620C8.41A1FE2B@sabre.com>
This is a multi-part message in MIME format.
--------------C802689B7F553DC68841BABA
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Not sure, but try enclosing the filena in quotes like this:
open(OUT, ">${_}/scripts/make_mask.txt") || die "can not make mask \n ";
Ed
Jim Kroger wrote:
>
> Hi, I'm trying to create an output file in a subdirectory.
>
> $_ contains a directory name. I tried:
>
> open(OUT, >${_}/scripts/make_mask.txt) || die "can not make mask \n ";
>
> and got the error in perldebug
>
> syntax error at myprogram line 85, near ", >"
> execution of myprogram aborted due to program errors
>
> I need the file to accept input, thus the >. The whole point of the
> program depends on using the variable, if I can't keep that there there's
> no point in writing the automation script in the first place.
>
> Any help greatly appreciated.
>
> Jim
--------------C802689B7F553DC68841BABA
Content-Type: text/x-vcard; charset=us-ascii;
name="edward.coates.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Edward Coates
Content-Disposition: attachment;
filename="edward.coates.vcf"
begin:vcard
n:Coates;Edward
tel;work:(817) 931-1939
x-mozilla-html:TRUE
org:Sabre;Unix Engineering
adr:;;;;;;
version:2.1
email;internet:Edward.Coates@sabre.com
fn:Edward Coates
end:vcard
--------------C802689B7F553DC68841BABA--
------------------------------
Date: 19 Mar 2001 12:54:32 +0000
From: jcp@myrtle.ukc.ac.uk (J.C.Posey)
Subject: confused about my and scoping
Message-Id: <jko7l1laph3.fsf@myrtle.ukc.ac.uk>
I may just be thick, but I continue to be confused about my and local
scoping. I understand how my works within a script (localizing it to
a particular section).
My problem is that I want to pass some arguments to these variables from
my command line, but I always get:
Can't use string ("F18") as a SCALAR ref while "strict refs" in use at
./cache-eval.pl line 73, <> chunk 2.
Where F18 is the name of the Field that I am looking to evaluate, i.e. it
could be F4, F1, F15, etc.
I'm trying to be "good" and use strict to create maintainable, safe code.
Thanks for the help,
Jake, an obvious newbie
------------------------------
Date: Mon, 19 Mar 2001 13:17:01 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: confused about my and scoping
Message-Id: <slrn9bc1mg.qmg.rgarciasuarez@rafael.kazibao.net>
J.C.Posey wrote in comp.lang.perl.misc:
> I may just be thick, but I continue to be confused about my and local
> scoping. I understand how my works within a script (localizing it to
> a particular section).
>
> My problem is that I want to pass some arguments to these variables from
> my command line, but I always get:
>
> Can't use string ("F18") as a SCALAR ref while "strict refs" in use at
> ./cache-eval.pl line 73, <> chunk 2.
>
> Where F18 is the name of the Field that I am looking to evaluate, i.e. it
> could be F4, F1, F15, etc.
It seems that you're trying to use hard references. (Look up this error
message in perldiag to learn more.) This is unrelated to local() vs my()
issues. However it's hard for us to help if you don't show some code.
> I'm trying to be "good" and use strict to create maintainable, safe code.
You shouldn't use hard references then. Code that uses hard references
is usually hard to maintain.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
use lib sub{$_=$_[1];y;_.mp; ,\n;d;print;
open+0;*0};use Just_another_Perl_hacker;1
------------------------------
Date: 19 Mar 2001 13:43:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: confused about my and scoping
Message-Id: <9952d6$bs5$1@mamenchi.zrz.TU-Berlin.DE>
According to Rafael Garcia-Suarez <rgarciasuarez@free.fr>:
> J.C.Posey wrote in comp.lang.perl.misc:
> > I may just be thick, but I continue to be confused about my and local
> > scoping. I understand how my works within a script (localizing it to
> > a particular section).
> >
> > My problem is that I want to pass some arguments to these variables from
> > my command line, but I always get:
> >
> > Can't use string ("F18") as a SCALAR ref while "strict refs" in use at
> > ./cache-eval.pl line 73, <> chunk 2.
> >
> > Where F18 is the name of the Field that I am looking to evaluate, i.e. it
> > could be F4, F1, F15, etc.
>
> It seems that you're trying to use hard references. (Look up this error
> message in perldiag to learn more.) This is unrelated to local() vs my()
> issues. However it's hard for us to help if you don't show some code.
>
> > I'm trying to be "good" and use strict to create maintainable, safe code.
>
> You shouldn't use hard references then. Code that uses hard references
> is usually hard to maintain.
s/hard/soft/, surely?
Anno
------------------------------
Date: 19 Mar 2001 08:56:20 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: confused about my and scoping
Message-Id: <m3ae6h50cb.fsf@mumonkan.sunstarsys.com>
jcp@myrtle.ukc.ac.uk (J.C.Posey) writes:
> ... I continue to be confused about my and local
> scoping. I understand how my works within a script (localizing it to
> a particular section).
Good- but "scoping" isn't your problem here, it's that varvarname thing.
Check out the pedantry at
http://perl.plover.com/varvarname.html
and for scoping, see
http://perl.plover.com/FAQs/
> My problem is that I want to pass some arguments to these variables from
> my command line, but I always get:
>
> Can't use string ("F18") as a SCALAR ref while "strict refs" in use at
> ./cache-eval.pl line 73, <> chunk 2.
>
> Where F18 is the name of the Field that I am looking to evaluate, i.e. it
> could be F4, F1, F15, etc.
You want to use a hash or an array for this, not a batch of
like-named scalars. But there's not much more to say unless
you post some code snippet that exhibits the problem.
--
Joe Schaefer Did I ever tell you that Mrs. McCave had twenty-three sons and
she named them all Dave? Well she did, and that wasn't a smart
thing to do.
-- Dr. Seuss
------------------------------
Date: 19 Mar 2001 14:15:47 +0000
From: jcp@myrtle.ukc.ac.uk (J.C.Posey)
Subject: Re: confused about my and scoping
Message-Id: <jko3dc9alpo.fsf@myrtle.ukc.ac.uk>
Joe Schaefer <joe+usenet@sunstarsys.com> writes:
> jcp@myrtle.ukc.ac.uk (J.C.Posey) writes:
>
> Good- but "scoping" isn't your problem here, it's that varvarname thing.
> Check out the pedantry at
>
> http://perl.plover.com/varvarname.html
You're correct, and I read your article about scoping earlier very helpful.
In regards to the above mention URL I particularly like,
"When people come into comp.lang.perl.misc asking how to do something
stupid..."
Hmmmm...as for me...I'm not a programmer, but I play one at work. :)
I've posted sample code below...very ugly. Basically, I'm trying to
evaluate a log file with 18 fields and want to be able to choose which
field from the command line. Any further help greatly appreciated.
#!/usr/local/bin/perl -w
use strict;
use Getopt::Std;
my %options;
my $field;
getopts('w:b:f:s', \%options);
if ($options{w}){
print "Running Response Time Mode...\n";
$field = $options{w};
&worst_times;
}elsif ($options{s}){
print "Running Refresh Rate Mode... \n";
&ref_eff;
}elsif($options{b}){
print "Running Best Time Mode...\n";
$field = $options{b};
&best_times;
}else{
&usage;
}
## GLOBAL VARIABLES ##
#This declares all the variables used w/in this script. Perl pro's will
#most likely hate this...but since this prog is running local only, and
#is self contained, it probably doesn't make a difference--it's just ugly.
#<<ACTUALLY...IT'S UGLY AND DOESN'T WORK. SOMETHINGS BROKEN IN MY HEAD
#HERE!>>
my ($FS,$F1,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$F10,$F11,
$F12,$F13,$F14,$F15,$F16,$F17,$F18,$day,$old_day,$hour,%response,
$timestamp,%daily_total,$item,$refresh_eff);
# subroutine to calculate various types of response times
# currently only calculates the worse_case [08/02/2001]
#THIS WAS CONVERTED FROM AWK SCRIPT, THUS THE FIRST FEW LINES.
sub worst_times{
$[ = 1; # set array base to 1
$, = ' '; # set output field separator
$\ = "\n"; # set output record separator
$FS = '|';
$old_day = $F1; #a null value, but is okay b/c
#makes prog skip ---Start Report---
#open(READFILE, "< $ARGV[1]");
while (<>) {
($F1,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$F10,$F11,
$F12,$F13,$F14,$F15,$F16,$F17,$F18)
= split(/[|\n]/, $_);
$day = $F1;
$hour = substr($F3, 1, 2);
if ($old_day == $day) {
if ($$field > $response{$hour}) {
$response{$hour} = $$field;
}
$old_day = $F1;
}
else {
foreach $hour (keys %response) {
$timestamp = $old_day . ' : ' . $hour;
$daily_total{$timestamp} = $response{$hour};
}
$old_day = $day;
foreach $hour (keys %response) {
$response{$hour} = 0;
}
}
}
#close(READFILE);
# sort and print the results
foreach $item (sort keys %daily_total) {
print $item, $daily_total{$item};
}
}# end worst_times
Many thanks,
Jake
------------------------------
Date: Mon, 19 Mar 2001 14:19:21 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: confused about my and scoping
Message-Id: <slrn9bc5bc.qui.rgarciasuarez@rafael.kazibao.net>
Anno Siegel wrote in comp.lang.perl.misc:
> According to Rafael Garcia-Suarez <rgarciasuarez@free.fr>:
> >
> > You shouldn't use hard references then. Code that uses hard references
> > is usually hard to maintain.
>
> s/hard/soft/, surely?
Hmm, sure, you're right. I always have problems with those terms. I've
to get the habit to compare them to soft and hard links in filesystems.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/perl/biscuit.html
------------------------------
Date: 19 Mar 2001 14:37:46 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: confused about my and scoping
Message-Id: <9955jq$m47$1@mamenchi.zrz.TU-Berlin.DE>
According to Rafael Garcia-Suarez <rgarciasuarez@free.fr>:
> Anno Siegel wrote in comp.lang.perl.misc:
> > According to Rafael Garcia-Suarez <rgarciasuarez@free.fr>:
> > >
> > > You shouldn't use hard references then. Code that uses hard references
> > > is usually hard to maintain.
> >
> > s/hard/soft/, surely?
>
> Hmm, sure, you're right. I always have problems with those terms. I've
That's probably because "soft" and "hard" don't say much about what
really happens. The term "symbolic reference" for "hard reference"
is much better, because it (correctly, if perhaps incidentally) implies
that the symbol table is used in the access.
> to get the habit to compare them to soft and hard links in filesystems.
Like you, I find it easier to remember which is "hard" and which "soft"
in the context of files and links, though I don't see how the terms
apply any better to files than to Perl references.
The analogy, however, is slightly misleading. In a file system, all
hard links are equivalent (as opposed to symlinks, which can be told
from the original), while a Perl reference (symbolic or not) can never
be confused with the original. Aliasing, as in "*y = \ $x" is much more
like a hard link than references are.
Anno
------------------------------
Date: Mon, 19 Mar 2001 14:47:42 GMT
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: confused about my and scoping
Message-Id: <3AB61C9C.AE3292AF@earthlink.net>
J.C.Posey wrote:
[snip]
> ## GLOBAL VARIABLES ##
> #This declares all the variables used w/in this script. Perl pro's
> #will most likely hate this...but since this prog is running local
> #only, and is self contained, it probably doesn't make a
> #difference--it's just ugly.
> #<<ACTUALLY...IT'S UGLY AND DOESN'T WORK. SOMETHINGS BROKEN IN MY HEAD
> #HERE!>>
>
> my ($FS,$F1,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$F10,$F11,
> $F12,$F13,$F14,$F15,$F16,$F17,$F18,$day,$old_day,$hour,%response,
> $timestamp,%daily_total,$item,$refresh_eff);
There's no reason at all to declare these here, as opposed to inside
your subroutine, and every reason not to.
>
> # subroutine to calculate various types of response times
> # currently only calculates the worse_case [08/02/2001]
> #THIS WAS CONVERTED FROM AWK SCRIPT, THUS THE FIRST FEW LINES.
> sub worst_times{
>
>
> $[ = 1; # set array base to 1
> $, = ' '; # set output field separator
> $\ = "\n"; # set output record separator
>
> $FS = '|';
These should all be done with local, so that they are automatically set
back to what the should be when the subroutine exits.
> $old_day = $F1; #a null value, but is okay b/c
> #makes prog skip ---Start Report---
Why not simply do $old_day = undef() ?
>
> #open(READFILE, "< $ARGV[1]");
>
> while (<>) {
> ($F1,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$F10,$F11,
> $F12,$F13,$F14,$F15,$F16,$F17,$F18)
>
> = split(/[|\n]/, $_);
Why not do something like @fields = split(/[|\n]/, $_); ? Especially
since you don't use all of them.
> $day = $F1;
> $hour = substr($F3, 1, 2);
>
> if ($old_day == $day) {
> if ($$field > $response{$hour}) {
Well, here's one big problem. $field is a string, from $options{w}, so
you don't want to do $$field, just $field. Also, you shouldn't use
$field as a global, but instead pass it as an argument to worst_times().
> $response{$hour} = $$field;
Same here.
> }
> $old_day = $F1;
Doesn't $old_day already equal $F1 at this point?
> }
> else {
> foreach $hour (keys %response) {
> $timestamp = $old_day . ' : ' . $hour;
> $daily_total{$timestamp} = $response{$hour};
> }
> $old_day = $day;
> foreach $hour (keys %response) {
> $response{$hour} = 0;
> }
This could probably be replaced by:
@response{ keys %response } = (0) x length keys response;
However, I'm not sure whether it would be better that way.
You definitely could do:
%response = ();
or
undef %response;
Which would probably be better.
I am curious why you even *have* %response, and don't simply write
directly to %daily_total
> }
> }
>
> #close(READFILE);
>
> # sort and print the results
> foreach $item (sort keys %daily_total) {
> print $item, $daily_total{$item};
> }
>
> }# end worst_times
>
> Many thanks,
> Jake
I think the biggest problem you have is your logic of when everything
happens. I wouldn't normally suggest this, but I think you should make
a flowchart.
--
The difference between theory and practice is that in theory, theory and
practice are identical, but in practice, they are not.
------------------------------
Date: 19 Mar 2001 14:51:36 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: confused about my and scoping
Message-Id: <9956do$m47$2@mamenchi.zrz.TU-Berlin.DE>
According to Benjamin Goldberg <goldbb2@earthlink.net>:
> I wouldn't normally suggest this, but I think you should make a flowchart.
If I had a sig, I'd quote it.
Anno
------------------------------
Date: 19 Mar 2001 14:55:58 +0000
From: jcp@myrtle.ukc.ac.uk (J.C.Posey)
Subject: Re: confused about my and scoping
Message-Id: <jkoy9u195a9.fsf@myrtle.ukc.ac.uk>
jcp@myrtle.ukc.ac.uk (J.C.Posey) writes:
> I may just be thick, but...
There seems to be about 45 different threads going on under this posting
that I can't even see. So possibly there have been answers that could help
me. Possibly not.
As they say, "What's the dealio?"
Jake
------------------------------
Date: 19 Mar 2001 10:57:26 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: confused about my and scoping
Message-Id: <m366h54uqh.fsf@mumonkan.sunstarsys.com>
jcp@myrtle.ukc.ac.uk (J.C.Posey) writes:
> Joe Schaefer <joe+usenet@sunstarsys.com> writes:
>
> > jcp@myrtle.ukc.ac.uk (J.C.Posey) writes:
> >
> > Good- but "scoping" isn't your problem here, it's that varvarname thing.
> > Check out the pedantry at
> >
> > http://perl.plover.com/varvarname.html
>
> You're correct, and I read your article about scoping earlier very helpful.
^^^^
Are you confusing me with Mark Jason Dominus? While I would consider
that high praise, I don't think he would :). The url's I posted were
links to MJD's articles, not mine.
> In regards to the above mention URL I particularly like,
>
> "When people come into comp.lang.perl.misc asking how to do something
> stupid..."
Yeah, I liked that one too. plover.com is loaded with cool stuff.
> #!/usr/local/bin/perl -w
>
> use strict;
Excellent.
[... code using $field as a parameter, but not passed to subs...]
I'd rework the top so $field is gone, and $options{.} is passed as an
argument to your subs like this:
if ($options{w}){
print "Running Response Time Mode...\n";
worst_times($options{w});
}
else { ...
but that's not really relevant to the error you're seeing.
> ## GLOBAL VARIABLES ##
More nitpicking- you have no "GLOBAL VARIABLES" in your code, which is great!
You might call them ## FILE VARIABLES ## if you really need to.
> #This declares all the variables used w/in this script. Perl pro's will
> #most likely hate this...but since this prog is running local only, and
> #is self contained, it probably doesn't make a difference--it's just ugly.
> #<<ACTUALLY...IT'S UGLY AND DOESN'T WORK. SOMETHINGS BROKEN IN MY HEAD
> #HERE!>>
>
> my ($FS,$F1,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$F10,$F11,
> $F12,$F13,$F14,$F15,$F16,$F17,$F18,$day,$old_day,$hour,%response,
> $timestamp,%daily_total,$item,$refresh_eff);
my ( $FS, # field separator
@F, # fields (replaces your $F# variables)
$day,
$old_day,
$hour,
%response,
$timestamp,
%daily_total,
$item, # what kind of item?
$refresh_eff,
);
[...]
> sub worst_times{
>
>
> $[ = 1; # set array base to 1
^^^^^^
Ugh. erase this and see if anything breaks. If you must put it back,
at least put a 'local' in front.
> $, = ' '; # set output field separator
^^
local
> $\ = "\n"; # set output record separator
^^
local
> $FS = '|';
^^
$FS is a record separator (or delimiter? - I confess my ignorance of
the difference). Unless you actually use it somewhere, get rid of $FS
altogether or at lease remove the original declaration and change this
line to
my $FS = '|'; # field separator (be careful if this goes into a regexp)
> $old_day = $F1; #a null value, but is okay b/c
> #makes prog skip ---Start Report---
So $old_day keeps state, but for what? Is it the worst_times
sub, or just the while(<>) loop below? If it's just for the
loop, get rid of the original declaration and change this to
my $old_day = '';
> while (<>) {
> ($F1,$F2,$F3,$F4,$F5,$F6,$F7,$F8,$F9,$F10,$F11,
> $F12,$F13,$F14,$F15,$F16,$F17,$F18)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
All that repetitive typing is a clear indication that you want
an array.
> = split(/[|\n]/, $_);
change all this to
while (<>) {
chomp;
@F = (undef); # place holder at $F[0] - don't set $[ !!!
# (can we get away with 'my @F' here?)
push @F, split /[|]/; # don't you want \Q$FS in the regexp?
> $day = $F1;
> $hour = substr($F3, 1, 2);
Replace $F1 with $F[1], $F2 with $F[2], etc.
> if ($old_day == $day) {
vvvvvvvvvvvvvvvvvvvvvvvvv
> if ($$field > $response{$hour}) {
^^^^^^^^^^^^^^^^^^^^^^^^^^
I think this line is the problem. $field is just the value
of the -w arg ( if called like '% scriptname -w F1', $field gets
set to "F1" ). With $$field, you are attempting to dereference
an ordinary scalar, so perl thinks you are looking for a symref.
Thankfully, "use strict" won't let you do that, so do this instead:
$field =~ /F(\d+)/ or die "Can't parse arg '$field'";
my $col = $1;
# above lines should be moved outside the while(<>) loop
if ( $F[$col] > $response{$hour} ) {
# this looks suspicious- are you sure you want to
# compare *any* field to $response{$hour}?
# And isn't $response{$hour} undefined for most values
# of $hour?
> $response{$hour} = $$field;
$response{$hour} = $F[$col];
[...]
HTH
--
Joe Schaefer "The only thing that interferes with my learning is my
education."
--Albert Einstein
------------------------------
Date: Mon, 19 Mar 2001 09:16:52 -0600
From: Al Spohn <spohn@bigfoot.com>
Subject: Re: HTTP Client Question
Message-Id: <MPG.151fdec35cd095b5989688@mayonews>
In article <slrn9b6ppo.lt.abigail@tsathoggua.rlyeh.net>, abigail@foad.org
says...
> Albert Spohn (spohn@bigfoot.com) wrote on MMDCCLV September MCMXCIII in
> <URL:news:MPG.151c93bc5401d2989681@news.chartermi.com>:
> `` In article <Pine.LNX.4.30.0103170122440.14900-100000@lxplus003.cern.ch>,
> `` flavell@mail.cern.ch says...
> `` > On Fri, 16 Mar 2001, Tad McClellan wrote:
> `` ...
> `` >
> `` > > Silently killfiling them for all time is *easier* than announcing it.
> `` >
> `` > Right: I got sick of trying to protect them from their own ignorance,
> `` > because of all the flak it caused. Usenet has far too many posts to
> `` > be able to read them all - one has to apply some kind of criteria or
> `` > one would never get time for real life (tm).
> `` >
> `` This is the best rationale for killfiling I've heard yet. If you're no
> `` longer, or never were, in baby-sitting mode, then make the kill quietly
> `` and move on. But there's no need for the public humiliation piece.
>
>
> Not is there a need to waste post after post whining about it. On what
> rationale is your public whine ok, and a public *plonk* not?
>
Finally, the voice from the mountain. Unfortunately, when you publically
plonk somebody you can't always expect them to assume the fetal
position, quietly lick their wounds and pray that the de-coder ring Gods
will eventually show mercy on them. Maybe it has something to do with my
being the youngest in the family, but somebody telling me "I'm not going
to listen to you and that's all their is to it" pretty much assures a
diarrhetic response on my part (which end we're talking about is left as
an exercise for the reader,) mostly because: a) they really *are*
listening [self-evident in this case], and b) it's not healthy to allow
them to believe they can treat people like garbage and get away with it.
In a nutshell, my public whine never would have been there had it not
been preceeded by the *plonk* - you made your bed, now you (and everybody
else unfortunately) can sleep in it.
> But I'm an equal opportunity plonker. I plonk Jeopardists, and whiners.
>
> *plonk*
Twice blessed, lucky me.
--
Al Spohn
http://www.bigfoot.com/~spohn
------------------------------
Date: 19 Mar 2001 15:28:55 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: HTTP Client Question
Message-Id: <985014566.4402@itz.pp.sci.fi>
In article <98qsge$5n4$1@tribune.mayo.edu>, Al Spohn wrote:
>
>Granted, the groups I'm thinking of don't approach the sheer volumes of
>this one, which I acknowledge makes being Mr. Rogers more of a
>strain... but in an environment where doing nothing doesn't cost you a
>thing vs. going out of your way to be a little nasty, that smacks more
>of a power trip than self-defense to me.
Doing nothing would mean not reading this group. Reading this group
costs time.
There is also a second-order effect here you've missed. If all the
regulars silently killfiled all the clueless, they wouldn't have to read
their posts. But the clueless would not notice, would not learn, and
would continue to spread their cluelessness. Newbies would come, see a
group filled with garbage, and either dive into it or recoil in disgust.
If we did nothing to make this group more readable for everyone, not
just for ourselves, we might as well just leave. We teach newbies how
to behave here, so that other newbies would find a well-behaved group.
When that doesn't help, a public plonk may serve as a warning that the
plonked poster is not a reliable source of information, or generally
worth listening to.
Yes, this does mean we have to decide what is proper behavior here. As
the Perl experts, the very people that keep this group worth anything,
we feel we do have the right to speak for the group. In any case, there
is no Usenet government to take this responsibility from us.
>And there are way too many knowledgeable regulars out there who don't
>feel this compulsion to twist the knife for me to have much patience
>with those that do.
Ah, yes. Not all of us bother, or have the time to. I plonk clueless
posters, delete my spam mail, and trust someone else to take care of the
actual source of the noise.
Most of the time, anyway.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Mon, 19 Mar 2001 08:02:11 -0800
From: Kira <callgirl@la.znet.com>
Subject: Re: HTTP Client Question
Message-Id: <3AB62D83.F6DCB7FE@la.znet.com>
Ilmari Karonen wrote:
> Al Spohn wrote:
> >Granted, the groups I'm thinking of don't approach the sheer volumes of
> >this one, which I acknowledge makes being Mr. Rogers more of a
> >strain... but in an environment where doing nothing doesn't cost you a
> >thing vs. going out of your way to be a little nasty, that smacks more
> >of a power trip than self-defense to me.
(various snippage)
> There is also a second-order effect here you've missed.
> If all the regulars silently killfiled all the clueless,
> they wouldn't have to read their posts.
> But the clueless would not notice....
> ...would continue to spread their cluelessness.
> We teach newbies how to behave here, so that other
> newbies would find a well-behaved group.
> a public plonk may serve as a warning that the plonked
> poster is not a reliable source of information,
> or generally worth listening to.
> ...we have to decide what is proper behavior here.
> ...we feel we do have the right to speak for the group.
> ...no Usenet government to take this responsibility from us.
Goodness Gracious. Such a stereotypical fascist cabal attitude.
You wear glossy black jackboots to bed?
Godzilla!
------------------------------
Date: Sun, 18 Mar 2001 04:13:06 GMT
From: world!swmcd@uunet.uu.net (Steven W McDougall)
Subject: News::Newsrc 1.08 released
Message-Id: <tbc4mo2haesed9@corp.supernews.com>
News::Newsrc 1.08 has been released to CPAN.
>From the README file:
News::Newsrc - manage newsrc files
DESCRIPTION
News::Newsrc manages newsrc files, of the style
alt.foo: 1-21,28,31-34
alt.bar! 3,5,9-2900,2902
Methods are provided for
- reading and writing newsrc files
- adding and removing newsgroups
- changing the order of newsgroups
- subscribing and unsubscribing from newsgroups
- testing whether groups exist and are subscribed
- marking and unmarking articles
- testing whether articles are marked
- returning lists of newsgroups
- returning lists of articles
>From the Changes file:
Revision history for Perl extension News::Newsrc
1.08 2001 mar 16
- added PREREQ_PM key to Makefile.PL
- added $file parameter to new()
- SWM
------------------------------
Date: Mon, 19 Mar 2001 11:27:43 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl for Windows
Message-Id: <h6qbbts4ba8hir08jsi10722lm0dlhhu2g@4ax.com>
jtjohnston wrote:
>Is Activestate teh only binary compiled. I don't the most recent
>compile.
No it's not. I use the IndigoStar (former DynamicState) port myself.
<http://www.indigostar.com/indigoperl.htm>
According to CPAN, there are at least tow other binary distributions,
but apparently not of 5.6 (I've not tried them myself):
SiePerl from Siemens: <http://www.cpan.org/authors/id/G/GR/GRAHAMC/>
nsPerl by Rich Megginson: <http://people.netscape.com/richm/nsPerl/>
And... wasn't there a Cygwin port as well?
(<http://sources.redhat.com/cygwin/>)
>What I do need is to install lib-net.
Gee. It looks like this is a pure perl set of modules, with no use of
Autoloader (it got a mention in Net::FTP). So all you need to do is get
the modules, extract the archive, and move the Net directory and all of
its contents into your site/lib directory in perl's directory.
I think that you can use ActiveState's PPM.BAT script file, or
IndigoStar's DPM (or the web interface), for these respective
installations, to install it, as well.
--
Bart.
------------------------------
Date: Mon, 19 Mar 2001 11:28:48 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl for Windows
Message-Id: <2drbbtkktmslam36g02k4na4neffrav2nj@4ax.com>
H C wrote:
>> Is Activestate teh only binary compiled.
>
>Nope. IndigoPerl has the Apache webserver compiled into it.
NEXT to it. The Apache server is still a separate program.
--
Bart.
------------------------------
Date: Mon, 19 Mar 2001 12:09:51 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl for Windows
Message-Id: <bqtbbtcqh2mnvi1uruj17vjh9ug5cgusqp@4ax.com>
H C wrote:
>> What I do need is to install lib-net.
>
>Comes with ActiveState.
Duh. It comes with IndigoPerl, too, apparently.
--
Bart.
------------------------------
Date: 19 Mar 2001 16:02:23 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Powers
Message-Id: <985017108.6910@itz.pp.sci.fi>
In article <slrn9b25ca.p0e.abigail@tsathoggua.rlyeh.net>, Abigail wrote:
>Kauser Ali Karim ;) (g9karkav@cdf.toronto.edu) wrote on MMDCCLIII
>September MCMXCIII in <URL:news:Pine.LNX.4.30.0103151348030.4037-100000@babirusa.cdf.toronto.edu>:
>**
>** Is there a function in perl, similar to pow() in C,
>** that would enable me to get 10^some_number.
>
> 10 ** $some_number;
Now this feels just weird. A fairly trivial question, the only reply is
from Abigail, and it gives the obvious, "normal" answer. I'd expected a
long list of WTDI, like
1 . 0 x $some_number;
or
eval "1e$some_number";
or
exp(log(10) * $some_number);
or even
sub pow { $_[0] * pow($_[0], $_[1]-1) }
Whatever happened to the "newsgroup Taliban"?
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Mon, 19 Mar 2001 06:37:06 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Print "tar" Success or Failure
Message-Id: <slrn9bbrr2.4bi.tadmc@tadmc26.august.net>
BUCK NAKED1 <dennis100@webtv.net> wrote:
>By "zombies"... I meant a blank page.
There is a source of confusion. "zombie" means something else.
"zombie" had it meaning long before the WWW was even *invented*.
>I thought a zombie was an empty
>page. Sorry, I guess I need to learn what "zombie" means.
http://www.tuxedo.org/~esr/jargon/html/entry/zombie.html
>BTW, I was
>using -w, but not strict. I haven't got around to learning lexical
>scoping yet.
Don't put that off too long.
>Thanks, Gary and Bart. I put your suggestions together and got something
>to work, but ... What was the "__END_" you suggested for?
perldoc perldata
------------------------------
The two control characters ^D and ^Z, and the tokens __END__ and __DATA__
may be used to indicate the logical end of the script before the actual
end of file. Any following text is ignored.
------------------------------
It tells the perl compiler to ignore everything after the __END__.
>I left it off
>because I have an END block at the end of this script, and I thought it
>might mess that up.
^^^^^^^^^^^^
Not if the END block is before the __END__ token.
>Also... is there a way to do the below without using if/else? (I already
>have too many if/else's in the script already)
>
>mkdir $tmpdir, 0705 or die "Coudn't make $tmpdir: $!";
>if ($rc = `tar -zxf $tmpfile -C $tmpdir 2>&1`) {
^^
^^
What you are putting in that variable is NOT a "return code". Is that
what "rc" stands for?
"$tar_output" would be a better name.
Since you do not use $rc, there isn't much point in saving something
in there anyway...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 19 Mar 2001 06:23:31 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: push, pop file handles to deal with recursive #include
Message-Id: <m1u24pkfbw.fsf@halfdome.holdit.com>
>>>>> "John" == John Lin <johnlin@chttl.com.tw> writes:
John> I wrote a program to deal with recursive #include
John> by using a @stack to store file handles.
See <http://www.stonehenge.com/merlyn/UnixReview/col19.html>.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 19 Mar 2001 09:12:51 -0500
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Spaces in path to perl script (NT)
Message-Id: <ar4cbt075hoa6u9ul65m0u1f6lvt8ku82o@4ax.com>
On Sat, 17 Mar 2001 10:24:31 GMT, Paul Goris
<paul@indigoproductions.be> wrote wonderful things about sparkplugs:
>
>Well thanks, but unless I'm missing something here, what you suggest would
>work if I was trying to reference a file from within a script - which I'm
>not.
PAUL>All other Perl scripts on our server work fine, just the ones
PAUL>with spaces in the path will generate this error.
This is where I was mistaken in my answer. You *seem* to be
referencing the file from a script. Hope it works out for you.
>What happens is that IIS can't find the script when it's being called from a
>browser, so there are no spaces in the script itself.
>
>ciao,
>
>Paul Goris
--
Member of the Nondeterministic Football League
------------------------------
Date: 19 Mar 2001 15:55:10 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Straight array output
Message-Id: <995a4u$rif$1@mamenchi.zrz.TU-Berlin.DE>
According to Craig Berry <cberry@cinenet.net>:
> George Kluver (GKluver@deja.com) wrote:
> : How might one print to screen twenty arrays in straight, vertical columns?
> : Each column is the contents of one of them.
>
> The answer has two components: (1) How to iterate over a bunch of arrays
> one element at a time, and (2) how to format columns neatly. The latter
> is a bigger can of worms, since the options are so varied -- formats,
> tabs, hand-padding, and so on and on. So we'll leave that for you to deal
> with, and concentrate on (1).
>
> Here's how I'd do it. For simplicity and neatness, I'm using four arrays
> rather than 20, but that's not important to the technique. Note that it's
> important that each array have the same number of elements, and my code
> does *not* check for this.
>
>
> #!/usr/bin/perl -w
> # ascols - function and demo code which prints multiple arrays in columns
> # Craig Berry (20010316)
>
> use strict;
>
> sub ascols {
> for (my $i = 0; $i < @{$_[0]}; $i++) {
> print join("\t", map { $_->[$i] } @_), "\n";
> }
> }
>
> ascols( [ 1, 2, 3 ],
> [ 4, 5, 6 ],
> [ 7, 9, 9 ],
> [ 10, 11, 12 ] );
What we want here is actually a variant of "foreach" that iterates over
many arrays at once, applying some code to all the first elements of
the lists, then all second elements and so on. Since this situation
arises occasionally in other contexts, you could go a step further and
base ascols() on a more general function:
sub foreach_n { # for want of a better name
my $code = shift;
$code->( map shift @$_, @_) while grep scalar @$_, @_;
}
(A similar map_n suggests itself.)
Then ascols( ...) can be written like this:
foreach_n sub { print( join( "\t", @_), "\n") },
[ 1, 2, 3 ],
[ 4, 5, 6 ],
[ 7, 9, 9 ],
[ 10, 11, 12 ];
Presumably prototyping foreach_n could make the call syntax a bit
smoother, but I didn't have much luck with that.
Anno
------------------------------
Date: 19 Mar 2001 12:01:51 +0000
From: Alun Moon <alun.moon@unn.ac.uk>
Subject: Re: Why do "Learning Perl" Books Do This? A Subroutine Question.
Message-Id: <ulmq255n4.fsf@unn.ac.uk>
Bart Lateur <bart.lateur@skynet.be> writes:
Slightly off topic reply...
> Uri Guttman wrote:
> Not really... I've read somewhere before that people with a mathematical
> inclination learning to program, can have a difficult time understanding
> the difference between a mathematical equation, and variable assignment
> in programming. For example, they'd expect that by typing in
>
> 16 = 3*x + 4*y
> 25 = 2*x + 3*y
>
> the computer would magically find the values for x and y.
If you were writing a "program" in MetaFont or MetaPost, then
the above would be a correct way of finding (x,y)!
MetaFont is Donald Knuth's font generating program, MetaPost
is the PostScript equivalent.
Both text based, source file, which has lots of scope for
interacting with Perl...
Alun
------------------------------
Date: Mon, 19 Mar 2001 16:04:14 +0100
From: Jan <ITguy@advalvas.NOSPAM.be>
Subject: Win32::File::SetAttributes($file,$attr + COMPRESSED) won't work.
Message-Id: <3AB61FEE.4DED@advalvas.NOSPAM.be>
Hi all,
While building a logfile archivation script, I ran against a problem
with the Win32::File module (v 0.03).
I used the following lines:
#-------------------------------------------------------------------------
Win32::File::GetAttributes ("$dir\\$file", $atts) ;
if ($atts & COMPRESSED) {print " was Compressed\n" }
else { Win32::File::SetAttributes("$dir\\$file",$atts + COMPRESSED);
#-------------------------------------------------------------------------
I can set any attibute except COMPRESSED (on a local NTFS).
Any thoughts on how to set the compress attribute are welcome.
Thanks, Jan.
------------------------------
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 V10 Issue 527
**************************************