[13753] in Perl-Users-Digest
Perl-Users Digest, Issue: 1163 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 24 05:05:30 1999
Date: Sun, 24 Oct 1999 02:05:08 -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: <940755908-v9-i1163@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 24 Oct 1999 Volume: 9 Number: 1163
Today's topics:
Re: _Please_ improve localtime! <Russell_Schulz@locutus.ofB.ORG>
Re: Can't do "make" on perl module <gellyfish@gellyfish.com>
Re: Check whether a string is numeric, mixed or only ch (Abigail)
Re: CPAN modules in RPM format. (Abigail)
Re: Date Addition (Abigail)
Re: E-Mail via script Perl ? (Abigail)
Re: E-Mail via script Perl ? (Abigail)
Re: file sorting <spyder@pikesville.net>
Re: file sorting <spyder@pikesville.net>
Re: file sorting <gellyfish@gellyfish.com>
Re: finding date and time (Abigail)
Re: Help................ (Fleet Admiral Peter Hodder)
Re: How do you substitute '/' ? (Abigail)
Re: How to approach this Array problem? <schapel@cs.uiowa.edu>
Re: How to get file size? (Abigail)
Re: New short cut assignment operators? <gellyfish@gellyfish.com>
Re: perl on windows ? <gellyfish@gellyfish.com>
Regular Expression...to remove last Field!!!! <umungo01@shafika.vetri.com>
Request style comments (code included - longish) <jduffy@semcor.com>
Re: Returning a hashref (SOLVED) <dwb1@home.com>
To all: How to sell Perl Scripts <jesse@interfocus.net>
Re: Where do perl scripts get their environment from? <gellyfish@gellyfish.com>
why isn't my mod_perl working? <henryd@net-gong.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 23 Oct 1999 21:31:04 -0600
From: Russell Schulz <Russell_Schulz@locutus.ofB.ORG>
Subject: Re: _Please_ improve localtime!
Message-Id: <19991023.213104.5V6.rnr.w164w@locutus.ofB.ORG>
keithmur@mindspring.com (Keith G. Murphy) writes:
>> Nobody is confused by `1999' turning into `2000', yet so many
>> people have posted about `99' turning into `100' (and so many
>> more have written code that will fail). Imagine if the more
>> useful interface became the standard and the more ridiculous
>> interface became deprecated.
>
> (1) If you change the results of localtime(), and don't change the name,
This has not been suggested (by anyone that I have noticed).
> (2) If you create an interface with a different name, [...]
> The only folks you'd be helping are the ones that start coding date
> routines when the new interface comes out.
Correct. Those who start and those who maintain old code, too (since
the new interface would be much easier to check and Just Do Right).
> And they're not really the problem; it's all that screwed-up code that
> is already written and will break in the year 2000 or before.
I disagree; I think there's enough code being written incorrectly even
today that it would have been worthwhile; I think the sooner the change
is/had been made the better.
> In other words, at this late date, how many months worth of bad code
> would this avoid?
How many months is 10 minutes' of effort worth? Seriously, would it
take any longer than that to add it?
> Have I missed something here, Russell?
Only my view of the severity of the ongoing problem, contrasted with
my view of the simplicity of removing it (by using 4 digit years more
consistently).
(I've been away from news for a few months; I wouldn't have posted if
you hadn't phrased the question in that way.)
--
Russell_Schulz@locutus.ofB.ORG Shad 86c
------------------------------
Date: 23 Oct 1999 10:27:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Can't do "make" on perl module
Message-Id: <7us2j9$ece$1@gellyfish.btinternet.com>
On Fri, 22 Oct 1999 19:33:29 -0400 Dutch McElvy wrote:
> Subject: Can't do "make" on perl module
>
> I can run perl programs on my linuxppc distribution but for some reason when
> I try to install a perl module, I can do a "Makefile.PL" but when I try to
> do a make for the perl module I get a bash "make" command not recognized.
>
Install the development tools - if you installed Linux from a CD then I
would be very surprised if they werent included there. ASk in a Linux
newsgroup how you might do this ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 24 Oct 1999 00:45:46 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Check whether a string is numeric, mixed or only characters
Message-Id: <slrn81577j.fji.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCCXLII September MCMXCIII in
<URL:news:MPG.127918fcab671d9398a0ef@nntp.hpl.hp.com>:
** In article <MPG.12790abfdc91363098a0ee@nntp.hpl.hp.com> on Thu, 21 Oct
** 1999 12:35:04 -0700, Larry Rosler <lr@hpl.hp.com> says...
**
** Here is my suggestion:
**
** > Perhaps those regexes that use '$' as an end anchor should be changed to
** > use '\z' instead. The latter probably didn't exist when the FAQ was
** > written.
**
** Here is Tom's response:
**
** > Nor does it probably exist on most people's systems.
** >
** > As far as I'm concerned, '$' has always meant the end. These
** > fufi additions like \z and \Z are subintuitive and marginal.
** >
** > --tom
**
** That might influence our posting (and our coding?).
Not mine. I find '$' to mean "the end, sometimes, in certain cases when
the last character is a newline, it might not be the end, but just before
the end" at best convenient at times. It's far from intuitive. I've
problems calling something "intuitive" if I can't describe it without
the use of words like "but", "unless", "may not", "sometimes", etc.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 24 Oct 1999 00:50:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: CPAN modules in RPM format.
Message-Id: <slrn8157h3.fji.abigail@alexandra.delanet.com>
Stephen Carville (carville@cpl.net) wrote on MMCCXLIV September MCMXCIII
in <URL:news:3811DC9B.2A8BB84A@cpl.net>:
!!
!! Besides, RPM -- for better or worse -- is becoming the Linux
!! "standard" for package distribution.
Odd. I never use it, nor need it on my Linux system. I prefer building
things from source.
Of course, even if RPM because "the Linux standard" (perhaps you're
confused with a certain Linux distribution?) then that is still
irrelevant. Perl runs on quite a lot more platforms then Linux.
Abigail
--
$" = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%_ = (Just => another => Perl => Hacker); &{%_};
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 24 Oct 1999 00:59:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Date Addition
Message-Id: <slrn81581f.fji.abigail@alexandra.delanet.com>
Jeff Pinyan (jeffp@crusoe.net) wrote on MMCCXLI September MCMXCIII in
<URL:news:Pine.GSO.4.10.9910201950580.21020-100000@crusoe.crusoe.net>:
$$ =cut
Now, that's a funny way to start a pod.... According to perlpod, that
should signal the _end_ of a piece of pod.
Something else that's wrong:
Content-Type: TEXT/PLAIN; charset=US-ASCII
It is as much "text/plain" as HTML postings are. At least HTML posters
have the decency to mark them as HTML. It would be nice if POD posters
would do something similar.
Then I don't have to use the From field to kill the postings... ;-)
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 24 Oct 1999 01:02:23 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: E-Mail via script Perl ?
Message-Id: <slrn81586p.fji.abigail@alexandra.delanet.com>
Mark Bakker (ceesbakk@casema.nl) wrote on MMCCXLII September MCMXCIII in
<URL:news:380eec53$0$4048@reader1.casema.net>:
// Can you PLEASE repeat your questing in English???
// I think I know the answer, because I user email very much in perl scripts...
// But I dont understand french!
Well, don't you think it's likely the poster doesn't know English well
enough to post in English?
Don't forget that this is an international newsgroup. English newsgroups
can be found in uk.*, us.*, aus.* and the various hierarchies for US states.
Abigail
--
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 24 Oct 1999 01:03:46 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: E-Mail via script Perl ?
Message-Id: <slrn81589c.fji.abigail@alexandra.delanet.com>
Frederic TYNDIUK (tyndiuk@ftls.org) wrote on MMCCXLII September MCMXCIII
in <URL:news:380EF1C2.6F318031@ftls.org>:
==
== Please Use fr.comp.lang.perl to post in french....
Please use uk.comp.lang.perl to post in English.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 24 Oct 1999 05:59:28 GMT
From: "V.B." <spyder@pikesville.net>
Subject: Re: file sorting
Message-Id: <38129F1F.46BCDB4B@pikesville.net>
I appreciate all the answers. As I said , I am still in the green stages,,,I
read the faq, and the man,, the first response was straight from the faq,,,
I was confused as to the signifigance(spelling?) of $a and $b.
I did try that example, and after a few minor manipulations, it worked just
fine. The file in question may become large,, so i may also consider the
other responses I have recieved. Again, ThankYou, all who have responded.
And to anyone else who would like to respond, please do, I can use all the
help I can get!.....
Vince
Larry Rosler wrote:
> In article <7us8u8$eh7$1@gellyfish.btinternet.com> on 23 Oct 1999
> 12:16:08 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
> + On Fri, 22 Oct 1999 21:41:51 -0400 Bob Walton wrote:
> + > "V.B." wrote:
> + > ...
> + >> i have a file,,, myfile.ext, it contains multiple single line
> + >> entries, each entry contains 7 ";" delimited values,,, id like to
> + >> sort the file by the 5th value of each entry,,,. if read the sort
> + >> faq and perlman , but it only confused me ,,, if anyone
> + >> can point me in the direction of a good example, id be overjoyed!
> + > ...
> + > Try:
> + >
> + > open IN,"myfile.ext" or die "Oops, open trouble, $!\n";
> + > print for(sort {(split /;/,$a)[4] cmp (split /;/,$b)[4]} <IN>);
> + > close IN or die "Oops, close trouble, $!\n";
> +
> + There is that of course but for a larger file the overhead of calling
> + the splits in the comparison sub is going to drive the execution
> + time of this way up :
> +
> + print for ( map { $_->[1] }
> + sort { $a->[0] cmp $b->[0] }
> + map { [(split /;/)[4],$_ ] }
> + <IN> );
>
> Well, I've hung back watching you guys develop the sorting algorithm,
> probably past the needs of this poster (who said he couldn't grok the
> FAQ). But now that the Schwartz has appeared, I might as well show
> everyone else a GRP (Guttman-Rosler Packed) sort also. For the ultimate
> in performance at a reasonable price:
>
> print # for??? -- 'print' can handle the list directly!
> map substr($_, 1 + rindex $_, "\0") =>
> sort
> map +(split /;/)[4] . "\0$_" =>
> <IN>;
>
> <URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
------------------------------
Date: Sun, 24 Oct 1999 06:11:02 GMT
From: "V.B." <spyder@pikesville.net>
Subject: Re: file sorting
Message-Id: <3812A1D0.CF6A648B@pikesville.net>
ThankYou for your response. I do appreciate it. I had viewed your page
before, yet was still wondering about a few things. I had even seen that
same example..but, now that i look at it from a different point of, things
seem to be making a little more sense..
All Is Appreciated
The mind is but a crevice, waiting to become a mountain.
Larry Rosler wrote:
> In article <7us8u8$eh7$1@gellyfish.btinternet.com> on 23 Oct 1999
> 12:16:08 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
> + On Fri, 22 Oct 1999 21:41:51 -0400 Bob Walton wrote:
> + > "V.B." wrote:
> + > ...
> + >> i have a file,,, myfile.ext, it contains multiple single line
> + >> entries, each entry contains 7 ";" delimited values,,, id like to
> + >> sort the file by the 5th value of each entry,,,. if read the sort
> + >> faq and perlman , but it only confused me ,,, if anyone
> + >> can point me in the direction of a good example, id be overjoyed!
> + > ...
> + > Try:
> + >
> + > open IN,"myfile.ext" or die "Oops, open trouble, $!\n";
> + > print for(sort {(split /;/,$a)[4] cmp (split /;/,$b)[4]} <IN>);
> + > close IN or die "Oops, close trouble, $!\n";
> +
> + There is that of course but for a larger file the overhead of calling
> + the splits in the comparison sub is going to drive the execution
> + time of this way up :
> +
> + print for ( map { $_->[1] }
> + sort { $a->[0] cmp $b->[0] }
> + map { [(split /;/)[4],$_ ] }
> + <IN> );
>
> Well, I've hung back watching you guys develop the sorting algorithm,
> probably past the needs of this poster (who said he couldn't grok the
> FAQ). But now that the Schwartz has appeared, I might as well show
> everyone else a GRP (Guttman-Rosler Packed) sort also. For the ultimate
> in performance at a reasonable price:
>
> print # for??? -- 'print' can handle the list directly!
> map substr($_, 1 + rindex $_, "\0") =>
> sort
> map +(split /;/)[4] . "\0$_" =>
> <IN>;
>
> <URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
------------------------------
Date: 23 Oct 1999 19:40:28 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: file sorting
Message-Id: <7ut2vc$f5p$1@gellyfish.btinternet.com>
On Sat, 23 Oct 1999 08:51:31 -0700 Larry Rosler wrote:
> In article <7us8u8$eh7$1@gellyfish.btinternet.com> on 23 Oct 1999
> 12:16:08 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
> + On Fri, 22 Oct 1999 21:41:51 -0400 Bob Walton wrote:
> + > "V.B." wrote:
> + > ...
> + >> i have a file,,, myfile.ext, it contains multiple single line
> + >> entries, each entry contains 7 ";" delimited values,,, id like to
> + >> sort the file by the 5th value of each entry,,,. if read the sort
> + >> faq and perlman , but it only confused me ,,, if anyone
> + >> can point me in the direction of a good example, id be overjoyed!
> + > ...
> + > Try:
> + >
> + > open IN,"myfile.ext" or die "Oops, open trouble, $!\n";
> + > print for(sort {(split /;/,$a)[4] cmp (split /;/,$b)[4]} <IN>);
> + > close IN or die "Oops, close trouble, $!\n";
> +
> + There is that of course but for a larger file the overhead of calling
> + the splits in the comparison sub is going to drive the execution
> + time of this way up :
> +
> + print for ( map { $_->[1] }
> + sort { $a->[0] cmp $b->[0] }
> + map { [(split /;/)[4],$_ ] }
> + <IN> );
>
> Well, I've hung back watching you guys develop the sorting algorithm,
> probably past the needs of this poster (who said he couldn't grok the
> FAQ). But now that the Schwartz has appeared, I might as well show
> everyone else a GRP (Guttman-Rosler Packed) sort also. For the ultimate
> in performance at a reasonable price:
>
> print # for??? -- 'print' can handle the list directly!
> map substr($_, 1 + rindex $_, "\0") =>
> sort
> map +(split /;/)[4] . "\0$_" =>
> <IN>;
>
> <URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>
>
The price is of course that you have to buy into Larry's thing about the
=> ;-}
I'd forgot the URL Larry - I'll remember it next time ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 24 Oct 1999 01:16:33 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: finding date and time
Message-Id: <slrn81591b.fji.abigail@alexandra.delanet.com>
Aaron Walker (amwalker@gate.net) wrote on MMCCXLIV September MCMXCIII in
<URL:news:3811C4B2.275129B6@gate.net>:
..
.. I would think that this question would be a FAQ, but I did not come
.. across it in the comp.lang.perl.misc FAQ. I am trying to find the date
.. and time. I read somewhere to use the localtime() function. I found
.. out that this is not formatted for about, since it is just a series of
.. numbers. How would I format the output of localtime()? Is there a
.. better way to discover the data and time?
Did you actually _read_ the documentation of localtime? Or did you
simple do a 'print localtime'?
Abigail
--
perl -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
print chr 0x$& and q
qq}*excess********}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 21 Oct 1999 16:30:41 GMT
From: peterh@vk2kcf.stealth.com.au (Fleet Admiral Peter Hodder)
Subject: Re: Help................
Message-Id: <38133fa1.8902785@news.griffith.stealth.com.au>
In other words how do I let users run CGI/Perl scripts? Thats for
Apache on Linux.
Eg. http://www.blabla.com.au/~user/cgi-bin/script.
Fleet Admiral Peter Hodder.
CO
Theta Fleet and Starbase Theta.
E-mail- peterh@vk2kcf.stealth.com.au
ICQ- 35576199
web Page- http://www.vk2kcf.stealth.com.au/~peterh
------------------------------
Date: 24 Oct 1999 02:48:00 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How do you substitute '/' ?
Message-Id: <slrn815ecp.fji.abigail@alexandra.delanet.com>
shylock (junkNOjuSPAM@tfw.net.invalid) wrote on MMCCXLII September
MCMXCIII in <URL:news:17599f0b.70b34094@usw-ex0101-008.remarq.com>:
<> Having trouble getting perl to susbstitute / (forward slash)
<> using $line =~ s/\///;
<>
<> Any advice?
Yes. Don't post vague questions. I see no problem with s/\///.
But then, I don't know what you want. Perhaps you have to catch
roasted turkeys - and then s/\/// isn't going to work.
Abigail
--
package Z;use overload'""'=>sub{$b++?Hacker:Another};
sub TIESCALAR{bless\my$y=>Z}sub FETCH{$a++?Perl:Just}
$,=$";my$x=tie+my$y=>Z;print$y,$x,$y,$x,"\n";#Abigail
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 24 Oct 1999 01:12:13 -0500
From: Steve Chapel <schapel@cs.uiowa.edu>
Subject: Re: How to approach this Array problem?
Message-Id: <3812A33D.17FFE70A@cs.uiowa.edu>
dabbu_2000@my-deja.com wrote:
>
> Problem:
>
> time1 key1 start
> time2 key1 blah
> time3 key1 blah...
> time4 key1 stop
>
> This is the pattern of the file I want to parse. I am trying to store
> the time1 and time4 associated with "start" and "stop". Once successful,
> I will be doing a calc (time4-time1).
How about this, assuming input from standard input:
my (%start, %stop);
while (<STDIN>) {
my @field = split(' ', $_);
if ($field[2] eq 'start') {
$start{$field[1]} = $field[0];
} elsif ($field[2] eq 'stop') {
$stop{$field[1]} = $field[0];
}
}
my $key;
foreach $key (sort keys %start) {
print $key . " " . ($stop{$key} - $start{$key}) . "\n";
}
------------------------------
Date: 24 Oct 1999 02:50:03 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How to get file size?
Message-Id: <slrn815egl.fji.abigail@alexandra.delanet.com>
Acacia (acacia@online.no) wrote on MMCCXLI September MCMXCIII in
<URL:news:R7kP3.7340$7G2.39737@news1.online.no>:
'' I need a simple code for retrieving the file size (in bytes and kB,
'' prefferably put into 2 different variables, i.e. $bytes and $kb) of
'' a specified file.
Check the -X functions.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 23 Oct 1999 20:17:53 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: New short cut assignment operators?
Message-Id: <7ut55h$f60$1@gellyfish.btinternet.com>
On Fri, 22 Oct 1999 22:53:14 +0200 Alan J. Flavell wrote:
> On 22 Oct 1999, Jonathan Stowe wrote:
>
>> No thats stupid - of course the white spice is important
>
> Variety is the white spice of life, eh?
>
It could be worse it could be ginger spice ....
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 23 Oct 1999 11:56:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: perl on windows ?
Message-Id: <7us7pf$efq$1@gellyfish.btinternet.com>
On Sat, 23 Oct 1999 12:38:26 +0800 Fred Chan wrote:
> How can I install module into perl ?
> I can not make from windows ?
>
Generally if you have installed Activeperl from <http://www.activestate.com>
you will not want to use this method to install modules but will use
PPM (Perl Package Manager) instead - you will be able to read about PPM
in the documetation that is installed with ActivePerl - this documentation
can be accessed from the ActivePerl shortcut in your start menu. If there
is a particular module that you require that is not available from the
Activestate repository then you might find it in an alternative one - there
is a list available on the Activestate site somewhere ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 24 Oct 1999 08:30:24 GMT
From: Govindaraj <umungo01@shafika.vetri.com>
Subject: Regular Expression...to remove last Field!!!!
Message-Id: <s15gt07t85979@corp.supernews.com>
Hi,
I don't know how difficult/easy this question would be...!!!
I have input like below:
R:|6||3EB-04-24190||CLAMP||2||||||||2501
R:|6||3EB-04-24190||CLAMP||2||||||||test2501
How can I remove the last field (i.e |2501 and |test2501) from the above
line with the Reqular expression. I don't want to use
the Array/split options for this one... I really want to achieve this
with our great Regular Expersion.
I try to match like this below:
$_ =~ s/(.*?)\|(.*?)$/$1/;
It's removing the entire Line....Where I am going wrong...!!! Any
Light...!!
regards,
Govindaraj
Note: Last Field may be any text.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Sun, 24 Oct 1999 08:38:13 GMT
From: Carrie Duffy <jduffy@semcor.com>
Subject: Request style comments (code included - longish)
Message-Id: <38136D27.435DC328@semcor.com>
Hello,
I've been working on a program to do several ftp sessions and average
the throughput to test our LFN performance (this compiles fine, BTW). I
know it's in no way portable (only Linux), but I noticed that my
variable declaration list tends to get huge, and my coding style seems
rather, well, verbose. Can anyone offer some tips to help make my code
easier to parse (for humans, that is :P). Thanks!
#!/usr/bin/perl -w
use strict;
use diagnostics;
my ($session, $date, $iter, $current, $rate, $total, $average, $index,
@nums,
$rcvbufdef, $rcvbufmax, $xmtbufdef, $xmtbufmax, $through, $pingrun,
$ping,
$ms, $rtt, $host );
#log it all, or I don't get paid
open (LOG, ">>ftplog") or die "Can't open logfile: $!";
#log who we are
$host = `hostname`;
chomp ($host);
$current = 1;
#do 5 pings and average them to get the RTT
$pingrun = 5;
while ($pingrun < 6) {
$ping = `ping cairhien -c 1`;
#regex matches the # before decimal
$ping =~ /time=(\d+).+/;
$ms += $1;
++$pingrun;
}
$rtt = ($ms / 5);
#set timestamp once to mark session start
$date = `date '+%x %X'`;
chomp ($date);
#log our buffer sizes, so we know if window scaling will occur
$rcvbufdef= `cat /proc/sys/net/core/rmem_default`;
chomp ($rcvbufdef);
$rcvbufmax = `cat /proc/sys/net/core/rmem_max`;
chomp ($rcvbufmax);
$xmtbufdef = `cat /proc/sys/net/core/wmem_default`;
chomp ($xmtbufdef);
$xmtbufmax = `cat /proc/sys/net/core/wmem_max`;
chomp ($xmtbufmax);
# get number of test runs from the user
print "Number of iterations?: ";
$iter = (<STDIN>);
chomp ($iter);
# log date, all buffer sizes, and RTT
print LOG "\n\n############################################\n\n";
print LOG "New testing session begun on $date, $iter iterations
requested.\n\n";
print LOG "Hostname is $host.\n";
print LOG "Default receive buffer size is $rcvbufdef bytes.\n";
print LOG "Maximum receive buffer size is $rcvbufmax bytes.\n";
print LOG "Default transmit buffer size is $xmtbufdef bytes.\n";
print LOG "Maximum transmit buffer size is $xmtbufmax bytes.\n";
print LOG "Average RTT is $rtt milliseconds.\n\n";
print LOG "Results as follows:\n\n";
#loop through number of test runs, capture throughput
until ($current > $iter) {
$session = `ftp caemlyn`;
#regex matches the # ftp returns
$session =~ /(\d+)(\sKbytes\/sec)/;
$date = `date '+%x %X'`;
chomp ($date);
#multiply to get kbits
$through = ($1 * 8);
# log each run
print LOG "$date iteration $current: $through Kbps/sec\n";
#suck each throughput rate into an array for averaging
push (@nums, $through);
++$current;
}
# average and print the throughput
foreach $rate (@nums) {
$total += $rate;
}
$index = ($#nums +1);
$average = ($total / $index);
print LOG "\n$index iterations completed: average transfer rate is
$average Kbps.\n\n";
close (LOG) or die "Can't close logfile: $!";
Thanks again,
Jeff Duffy
jduffy@semcor.com
------------------------------
Date: Sun, 24 Oct 1999 05:27:08 GMT
From: "Daniel W. Burke" <dwb1@home.com>
Subject: Re: Returning a hashref (SOLVED)
Message-Id: <Pine.LNX.4.10.9910232356430.736-100000@cc569157-a.warn1.mi.home.com>
On Sat, 23 Oct 1999, Tad McClellan wrote:
> Daniel W. Burke (dwb1@home.com) wrote:
>
> : I seem to be having a problem with the function below. It is not acting
> : consistantly between versions of perl. I wrote it, and a few scripts that
> : use it pretty heavily on my home pc, which hash perl version 5.005_03. I
> : took the scripts to a PC at work (redhat 5.2, which I think has 5.003 on it),
> ^^^^^^^^^^ ^^^^^^^
> ^^^^^^^^^^ ^^^^^^^
>
> The perl that ships with redhat is from the _development_
> track, not the stable track.
Ok, I guess I need to clarify somewhat.
I did some more investigation. My pc is running 5.005_03. I found another
PC running the same version of perl, that doesn't behave the same way my pc
does. So I suspect that the build of perl 5.005_03 that ships with
Slackware 4.0 is bugged.
The function is supposed to return the whole hash, not the reference. The
problem I'm having is that 2 PC's with the same version of perl make me do
it 2 different ways. I was trying to see if this was expected behavior or
if it was a bug, or I was doing something incredibly stupid.
One version of perl shouldn't have the same function return differently on
different pc's.
Just to clarify so that people don't think I'm an idiot (although, as a solution
I'm going to just rebuild perl on my pc and hope that fixes it).
On my pc, my code originally did this:
my_fetchhash() returns "%$ret;" (I will make that change from an empty list
to empty hash btw, thanks).
$ret = &my_fetchhash($csr);
%data = %$ret;
That didn't seem right when I first wrote it, but I figured it just didn't have
enough of a grasp on how that should work. Unfortunatly when I copied my files
to another PC (the redhat pc), I got errors on execution. So when I changed it
to
%data = &my_fetchhash($csr);
the errors were gone, and my code works again.
Dan.
------------------------------
Date: Sun, 24 Oct 1999 04:40:00 GMT
From: "Jesse A" <jesse@interfocus.net>
Subject: To all: How to sell Perl Scripts
Message-Id: <A4wQ3.4862$24.63299@typhoon2.tampabay.rr.com>
Hi everyone,
After months of hard work, I've made very powerful CGI script that can
automate many parts of a web site. Well, now its up for sale but I haven't
gotten too many requests b/c of the steep pricetag.
Is there a more effective way I could sell it? I was thinking of making it
open source and accepting donations but I wouldn't get even close to what
its worth. I also thought about making a watered-down version for free or
maybe a semi-full version script with ads to my site in all of its output.
What do you think? (I'm asking everyone this question. Post as many
suggestions as possible, plz)
Thanks in advance.
-Jesse A
--
--------------------------------------------------------------
Jesse Alston ( jesse@interfocus.net )
Keep your site in focus with Focus Web Services
http://www.interfocus.net
--------------------------------------------------------------
------------------------------
Date: 23 Oct 1999 12:49:05 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Where do perl scripts get their environment from?
Message-Id: <7usas1$ert$1@gellyfish.btinternet.com>
On Fri, 22 Oct 1999 20:28:20 GMT David Henry wrote:
> For Apache::DBI to work, the environment variable GATEWAY_INTERFACE
> must be set, but how do I do this? Is it via the .cshrc or .bashrc of
> the userid designated in httpd.conf as the user under which httpd
> runs, usually 'nobody'.
No. The Apache manual discusses this - please ask in the group
comp.infosystems.www.servers.unix about getting Apache to set Environment
variables if you cant find the correct directive in the manual.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 24 Oct 1999 10:39:22 +0200
From: "David Henry" <henryd@net-gong.com>
Subject: why isn't my mod_perl working?
Message-Id: <7uugq0$cbt$1@news2.inter.net.il>
I built apache with mod_perl and added the following to my httpd.conf file
ScriptAlias /perl-bin/ "/usr/local/apache/perl-bin/"
PerlModule Apache::DBI
PerlSendHeader On
<Location "/usr/local/apache/perl-bin>
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
</Location>
Then I ran my first test script, http://hostname/perl-bin/test.pl, that
just prints
out the environment. What I get is a mixture of good and bad.
.......
"GATEWAY_INTERFACE" == "CGI/1.1"
"SERVER_SOFTWARE" == "Apache/1.3.9 (Unix) mod_perl/1.21"
......
SERVER_SOFTWARE shows that I am, indeed, running Apache with mod_perl, but
the absence of the MOD_PERL environment variable indicates that my perl
script doesn't know it. Also the GATEWAY_INTERFACE environment variable
shows that I'm not using Apache::DBI.
I've obviously made some simple configuration error but can't for the life
of me figure out what.
------------------------------
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 1163
**************************************