[10419] in Perl-Users-Digest
Perl-Users Digest, Issue: 4012 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 19 18:02:47 1998
Date: Mon, 19 Oct 98 15:00:53 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 19 Oct 1998 Volume: 8 Number: 4012
Today's topics:
Re: Back button/reference (Abigail)
Re: Can someone help me with the following for a friend (David Alan Black)
Re: count files.... (Abigail)
Re: count files.... <jdporter@min.net>
Re: Counting URLs (Abigail)
Re: Glob Prob <murrayb@vansel.alcatel.com>
Re: Glob Prob (Greg Bacon)
Re: Glob Prob (Tad McClellan)
Re: grep in perl (Greg Bacon)
Re: I'm new, but know what I need (Tad McClellan)
Importing text files into Sybase <marx@idiom.com>
Re: Installing modules on Win'95 <due@murray.fordham.edu>
Re: None <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Off topic: is he that Larry Wall? <jdporter@min.net>
Oracle Longs - Malloc Problem <paul.odriscoll@anitesystems.be>
Overloaded '.' wreaking havoc (Lee Jones)
Re: Overloaded '.' wreaking havoc <uri@camel.fastserv.com>
printing array elements <marx@idiom.com>
Re: Q: Simple parsing of string (Bart Lateur)
Re: Q: Simple parsing of string (Greg Bacon)
Quota Support in Perl? <aahmed@cs.uml.edu>
Re: Quota Support in Perl? <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: Quota Support in Perl? (Greg Bacon)
Re: Quota Support in Perl? <eashton@bbnplanet.com>
Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has regi <jdporter@min.net>
Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has regi <jdporter@min.net>
Re: Recover ref from string <jdporter@min.net>
Re: Replacing multiply ":" with a string. <rbridal@bcl.net>
Re: serial port IO? module? (Thomas)
Re: Shell commands eugene@vertical.net
Re: Shell commands <jdporter@min.net>
Sherlock module to search www.perl.com (Clinton Wong)
Show files for download <joop@software-desk.nl>
Re: Slow Sort (complex hashes sub-thread) <jdporter@min.net>
Re: Slow Sort? <jdporter@min.net>
Re: Slow Sort? <jdporter@min.net>
Re: Slow Sort? <jdporter@min.net>
Re: Slow Sort? <uri@camel.fastserv.com>
Re: Statistics for comp.lang.perl.misc (Andrew M. Langmead)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 19 Oct 1998 21:07:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Back button/reference
Message-Id: <70g9mr$muq$2@client3.news.psi.net>
Yasir Khalifa (khalifa@blitz.cs.pitt.edu) wrote on MDCCCLXXIV September
MCMXCIII in <URL:news:70c3m5$h7d$1@usenet01.srv.cis.pitt.edu>:
++
++ Any help on how I can refer to a previous page (in a multiple
++ page application) without getting the data cleared?
<P>Please use your browsers back function to return to the previous page!</P>
You can't simulate a back function reliably. See
http://cthulhu.mandrake.net/%7Eabigail/HTML/Misc/back_button.html
Followups set.
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=>()'
------------------------------
Date: 19 Oct 1998 17:03:39 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: Can someone help me with the following for a friend I know?
Message-Id: <70g9fb$n7t$1@pilot.njin.net>
Hello -
richardhutnik@hotmail.com writes:
>I had a friend send me the following request via email, for a PERL class they
>are taking. I was wondering if you could help me out here. Thanks.
>- Richard Hutnik.
Say hi to Lisa for us.
David Black
dblack@pilot.njin.net
------------------------------
Date: 19 Oct 1998 20:52:36 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: count files....
Message-Id: <70g8qk$muq$1@client3.news.psi.net>
Larry Rosler (lr@hpl.hp.com) wrote on MDCCCLXXIII September MCMXCIII in
<URL:news:MPG.1091e8fc34eb23a19898be@nntp.hpl.hp.com>:
++ [Posted to comp.lang.perl.misc and copy mailed.]
++
++ In article <m3k91zd7z4.fsf@perrin.dimensional.com> on Sat, 17 Oct 1998
++ 06:30:48 GMT, Daniel Grisinger <dgris@perrin.dimensional.com> says...
++
++ > On the other hand, this may be a bug in perl, as the result
++ > changes depending upon whether you use single or double quotes
++ > around the -f.
++ >
++ > $ perl -e 'opendir (DIR, q|.|);
++ > $num = grep '-f', readdir DIR;
++ > print qq.$num\n.;'
++ > 95
++ >
++ > $perl -e 'opendir (DIR, q|.|);
++ > $num = grep "-f", readdir DIR;
++ > print qq.$num\n.;'
++ > 130
++ >
++ > I'm not sure if this is a bug, but it certainly violates
++ > the Principle of Least Surprise :-).
++
++ Amazing. Each of those strings is TRUE, no?
No. You're forgetting the ' is meaningful to the shell.
What happens is that
opendir (DIR, q|.|);
$num = grep
is passed unmodified by the shell to perl, then the shell does variable
substitution on -f, passes the result (-f) to perl, and then passes
, readdir DIR;
print qq.$num\n.;
unmodified. So, perl sees
opendir (DIR, q|.|);
$num = grep -f, readdir DIR;
print qq.$num\n.;
which gives the "correct" answer.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
------------------------------
Date: Mon, 19 Oct 1998 17:26:16 -0400
From: John Porter <jdporter@min.net>
Subject: Re: count files....
Message-Id: <362BAE78.8F0248A6@min.net>
Daniel Grisinger wrote:
>
> On the other hand, this may be a bug in perl, as the result
> changes depending upon whether you use single or double quotes
> around the -f.
>
> $ perl -e 'opendir (DIR, q|.|);
> $num = grep '-f', readdir DIR;
> print qq.$num\n.;'
> 95
>
> $perl -e 'opendir (DIR, q|.|);
> $num = grep "-f", readdir DIR;
> print qq.$num\n.;'
> 130
Maybe it's because you also quoted the whole script to the shell
using single-quotes. The first one prolly comes out looking like
$ perl -e 'opendir (DIR, q|.|); $num = grep '
-f ', readdir DIR; print qq.$num\n.;'
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: 19 Oct 1998 21:12:02 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Counting URLs
Message-Id: <70g9v2$muq$3@client3.news.psi.net>
bill davidsen (davidsen@tmr.com) wrote on MDCCCLXXII September MCMXCIII
in <URL:news:707oll$12qu$1@newssvr03-int.news.prodigy.com>:
++ I want to count URLs in a (long) string. I thought that the easy way
++ would be to use the split() function and look at the return count, but
++ that doesn't quite do what I want. I'm doing:
++ $N_URL = split(m#\W(http|news|mail|ftp)://\S*#o);
# Assume $string contains the long string.
my $count = 0;
$count ++ while $string =~ m#
(?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.
)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:\.(?:\d+)
){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F
\d]{2}))|[;:@&=])*)(?:/(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
2}))|[;:@&=])*))*)(?:\?(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-fA-F\d]{
2}))|[;:@&=])*))?)?)|(?:ftp://(?:(?:(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?
:%[a-fA-F\d]{2}))|[;?&=])*)(?::(?:(?:(?:[a-zA-Z\d$\-_.+!*'(),]|(?:%[a-
fA-F\d]{2}))|[;?&=])*))?@)?(?:(?:(?:(?:(?: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)?)|(?:nfs:(?:(?://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-
Z\d])?)\.)*(?:[a-zA-Z](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?))|(?:(?:\d+)(?:
\.(?:\d+)){3}))(?::(?:\d+))?)(?:(?:/(?:(?:(?:(?:(?:[a-zA-Z\d\$\-_.!~*'
(),])|(?:%[a-fA-F\d]{2})|[:@&=+])*)(?:/(?:(?:(?:[a-zA-Z\d\$\-_.!~*'(),
])|(?:%[a-fA-F\d]{2})|[:@&=+])*))*)?)))?)|(?:/(?:(?:(?:(?:(?:[a-zA-Z\d
\$\-_.!~*'(),])|(?:%[a-fA-F\d]{2})|[:@&=+])*)(?:/(?:(?:(?:[a-zA-Z\d\$\
-_.!~*'(),])|(?:%[a-fA-F\d]{2})|[:@&=+])*))*)?))|(?:(?:(?:(?:(?:[a-zA-
Z\d\$\-_.!~*'(),])|(?:%[a-fA-F\d]{2})|[:@&=+])*)(?:/(?:(?:(?:[a-zA-Z\d
\$\-_.!~*'(),])|(?:%[a-fA-F\d]{2})|[:@&=+])*))*)?)))#gx;
Abigail
--
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-
------------------------------
Date: 19 Oct 1998 12:50:40 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: Glob Prob
Message-Id: <ulnmc5o1b.fsf@vansel.alcatel.com>
Eric Bohlman <ebohlman@netcom.com> writes:
> What OS is your script running under? Under Unix, that glob means "all
> files with a '.' in their names," since "extensions" have no inherent
> meaning to the filesystem. Just a plain "*" will do (but of course, that
> will only match extensionless files under Win32. If you need to be
> platform-independent, you should ditch globbing and use readdir() and its
> cousins).
Under NT:
perl -e "while (<*>) { print $_ . qq!\n!; }"
Gives me a complete directory listing, including files with and without
extensions. I suspect by Win32 you mean Windows 95, whose command
processor is even more defective than NT's, and may return incorrect
results for this glob. Windows 98 may also still be broken in this
regard.
--
Brad Murray "Every normal man must be tempted at times to spit on
Software Analyst his hands, hoist the black flag, and begin slitting
Alcatel Canada throats." --H.L. Mencken
------------------------------
Date: 19 Oct 1998 20:28:21 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Glob Prob
Message-Id: <70g7d5$ops$2@info.uah.edu>
In article <ebohlmanF138oB.3z2@netcom.com>,
Eric Bohlman <ebohlman@netcom.com> writes:
: What OS is your script running under? Under Unix, that glob means "all
: files with a '.' in their names," since "extensions" have no inherent
: meaning to the filesystem. Just a plain "*" will do (but of course, that
: will only match extensionless files under Win32. If you need to be
: platform-independent, you should ditch globbing and use readdir() and its
: cousins).
...or have a look at
<URL:http://www.cs.uah.edu/~gbacon/perl/File-BSDGlob-0.94.tar.gz>
Greg
--
We have enough youth, how about a fountain of SMART?
------------------------------
Date: Mon, 19 Oct 1998 15:32:54 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Glob Prob
Message-Id: <ml7g07.n73.ln@flash.net>
Martin (minich@globalnet.co.uk) wrote:
: I have the following:
: @threads = <*.*>;
: which won't include in the array files with no extension. Is there anyway to
: modify the glob to let it do that?
Yes.
Perl globs like Unix, not like DOS.
In Unix * alone matches all files, *.* matches only files with
a dot in their filename.
@threads = <*>;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 19 Oct 1998 20:37:49 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: grep in perl
Message-Id: <70g7ut$ops$3@info.uah.edu>
Meenu <meenu@ms.washington.edu> writes:
: if ($mon = 9)
: {
: $month = Oct;
: }
: so on ... for all the months.
Why not something like
my @month = qw(
January February March April May June
July August September October November December
);
[...]
$month = $month[$mon];
: and then what I'm tryin' to day is ..grep "month/day" from some accesslog
: file
:
: grep "$month/$day" accesslog > Prev_DayLOG;
It's not clear to me whether you intend to use your system's grep(1)
or Perl's grep. Judging from your syntax, I'm assuming you want to
execute grep(1). Do that with
system qq{grep "$month/$day" accesslog >Prev_DayLOG};
Does your access log really have dates like October/19?
Greg
--
Nothing inspires forgiveness quite like revenge.
-- Dogbert
------------------------------
Date: Mon, 19 Oct 1998 15:17:02 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: I'm new, but know what I need
Message-Id: <un6g07.a53.ln@flash.net>
William D. Reardon (wdr1@pobox.com) wrote:
: Or, if
: you're going to be getting into Perl seriously, I'd highly recommend
: picking up a copy of _Perl Programming_.
I think you meant to say "Programming Perl", or is there a new
book with your title?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 19 Oct 1998 16:14:34 -0500
From: "Marcus J. Foody" <marx@idiom.com>
Subject: Importing text files into Sybase
Message-Id: <362BABBA.5BDA@idiom.com>
Hello, I have been parsing a text file into smaller text files. These
smaller text files I would like bring into Sybase. What is the best way
to do this?
thanks
marcus
------------------------------
Date: 19 Oct 1998 21:37:13 GMT
From: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: Installing modules on Win'95
Message-Id: <70gbe9$9u7$0@206.165.167.223>
I am sure I am missing something but why not just use dmake which comes with
the activestate distribution? It works fine for me.
AmD
[copy cc'd to author]
olrcc@scisun.sci.ccny.cuny.edu wrote in message
<70g1qm$rbf$1@nnrp1.dejanews.com>...
>Hi everybody,
>
>I'm having a problem with installing Perl Modules on Windows 95.
>I've got ActiveState Perl 5.005002 built and Cygwin port of make
>(latest release).
>
>Doing the standard routine
>
>1. perl Makefile.PL <-- fine
>2. make <-- produces an error
------------------------------
Date: 19 Oct 1998 22:19:46 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: None
Message-Id: <83zpaspan1.fsf@vcpc.univie.ac.at>
Re: None, Piet <pietb@nic.mil> said:
Piet> Hmm. the htpasswd program that comes with Apache
Piet> doesn't like to take stuff from STDIN, for some
Piet> reason. In the past, I have tried in vain to get it
Gotta hide those passwords!
Piet> What I eventually settled with was the htdigest
Piet> command, you can send pipes to it quite easily.
WADR, you're solving the wrong problem...
Piet> If you don't want to use the htdigest method (which
Piet> basically uses DBM and crypt and salt), you can make
Piet> your own htpasswd file by smart use of crypt and salt
There's a luvverly little module for this, HTTPD::UserAdmin.
htpasswd is an abstraction (in this case, a user-interface)
of an underlying mechanism. And this is what a good perl
solution should build upon.
tony
------------------------------
Date: Mon, 19 Oct 1998 17:20:54 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Off topic: is he that Larry Wall?
Message-Id: <362BAD36.B0785F18@min.net>
Joergen W. Lang wrote:
>
> Who might be the mother ?
> Or did Perl come into this world by something like "sprouting" ?
More like Athenogenesis.
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 22:46:22 +0200
From: Paul O'Driscoll <paul.odriscoll@anitesystems.be>
Subject: Oracle Longs - Malloc Problem
Message-Id: <362BA51E.2C39105D@anitesystems.be>
Does anyone have any experience selecting LONGS
from an Oracle database with PERL.
I get a malloc panic error !!
regards
pod
------------------------------
Date: 19 Oct 1998 21:40:29 GMT
From: leej@diver.engr.sgi.com (Lee Jones)
Subject: Overloaded '.' wreaking havoc
Message-Id: <70gbkd$57mks@fido.engr.sgi.com>
I've got a class that I'm building for a hardware simulator language, and
in it, I've overloaded many of the operators to do multiple state
arithmetic. All was going well until I overloaded the '.' operator.
Now, code such as:
print("objA = $objA\n");
(where $objA has been blessed into the class) causes a call to my
concatentation operator, for no apparent reason. I haven't had this
problem with (e.g.) the '+' overload. I expect the above code to call my
stringify() function, but it doesn't (or hasn't by the time it calls the
concatentation operator, with fatal results).
What am I doing wrong?
Thanks, Lee
--
Lee Jones | "Forget all about that macho sh*t
leej@sgi.com | And learn how to play guitar."
650-933-3356 | -John Mellencamp
http://reality.sgi.com/leej_engr
------------------------------
Date: 19 Oct 1998 17:53:55 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Overloaded '.' wreaking havoc
Message-Id: <sarpvbonrpo.fsf@camel.fastserv.com>
>>>>> "LJ" == Lee Jones <leej@diver.engr.sgi.com> writes:
LJ> I've got a class that I'm building for a hardware simulator
LJ> language, and in it, I've overloaded many of the operators to do
LJ> multiple state arithmetic. All was going well until I overloaded
LJ> the '.' operator. Now, code such as:
LJ> print("objA = $objA\n");
LJ> (where $objA has been blessed into the class) causes a call to my
LJ> concatentation operator, for no apparent reason. I haven't had
LJ> this problem with (e.g.) the '+' overload. I expect the above
LJ> code to call my stringify() function, but it doesn't (or hasn't by
LJ> the time it calls the concatentation operator, with fatal
LJ> results).
LJ> What am I doing wrong?
not much. but you don't realize that interpolation in perl5 is just done
with a compilation conversion to a series of . operations. you can work
around it by doing:
print( "objA = ", $objA, "\n");
or if you want to force stringify:
print( "objA = ", "$objA", "\n");
it's an obscure concept that reared its ugly head for you. i don't know
of another way to stop the call to your overloaded .
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Mon, 19 Oct 1998 15:48:02 -0500
From: "Marcus J. Foody" <marx@idiom.com>
Subject: printing array elements
Message-Id: <362BA582.5A60@idiom.com>
Hello, what I'm attempting to do is combine records. Basically, I have
a record header that has one or many items that correspond with it. I
need to print out the record header along with the its appropriate
items. If anyone can help it would be much appreceiated. I've also
included my code at the bottom.
My output so far is as follows:
|709 15:41:45|709|1000|1000.00|1|
|REC ITEMS|1|2|2|EACH|500.00|0|1000.00|
|709 15:41:45|709|2500|2500.00|2|
|REC ITEMS|1|1|1|EACH|1500.00||1500.00|
|REC ITEMS|2|4|4|EACH|250.00||1000.00|
|709 15:41:45|709|2000|2000.00|3|
|REC ITEMS|1|1|1|EACH|2000.00||2000.00|
Possible solution(spacing for clarity):
|709 15:41:45|709|1000|1000.00|1||REC ITEMS|1|2|2|EACH|500.00|0|1000.00|
|709 15:41:45|709|2500|2500.00|2||REC ITEMS|1|1|1|EACH|1500.00||1500.00|
|709 15:41:45|709|2500|2500.00|2||REC ITEMS|2|4|4|EACH|250.00||1000.00|
|709 15:41:45|709|2000|2000.00|3||REC ITEMS|1|1|1|EACH|2000.00||2000.00|
thanks
marcus
open(FH25, "<./join/test.txt") || die "could not open '25.db' $!";
open(FH51, ">./join/REC_HEAD.txt") || die "could not open '25.db' $!";
while ($line=<FH25>) {
chomp;
$line =~ m,^\|REC FILE(\|[^|]+)\|,;
$prefix = $1 if $1;
if ($line =~ /REC BATCH/) {
$line = $prefix . $line;
@record = split(/\|/, $line);
$field = "|$record[4] $thetime";
while (<FH25>){
chomp;
@data = split(/\|/);
$rec_amt1 = @data[14];
$rec_amt2 = @data[15];
$rec_amt3 = @data[16];
$sum = $rec_amt1+$rec_amt2+$rec_amt3;
if(/REC HEAD/){
$cnt++}
print "$field|".join('|',@data[4]),"|$sum|"
.join('|',@data[16]),"|$cnt|","\n" if(/REC HEAD/);
if(/REC ITEMS/){
print "$_";
}
}
}
}
close(FH25);
close(FH51);
------------------------------
Date: Mon, 19 Oct 1998 21:00:10 GMT
From: bart.mediamind@ping.be (Bart Lateur)
Subject: Re: Q: Simple parsing of string
Message-Id: <362ca796.1207086@news.ping.be>
Greg wrote:
>I'm trying to take a string and run it through two simple steps :
>1) Change all + characters to spaces.
tr/+/ /;
or
s/\+/ /g;
>2) If the first 6 chars of the string <> "Posted" then (do something).
if(/^Posted/ { ... do something }
or
if (substr($_,0,6) eq 'Posted') { ... }
>(Is there a good, simple, resource available to learn the syntax parsing
>operators ? I've searched high and low, but can't find anything helpful.
>I'm sure I'm overlooking something.)
Yup. It s hould be on your harddisk. It's called the POD files, and they
are the documentation, in some sort of plain text files. In particular,
PERLFUNC.POD and PERLRE.POD are worth skimming through.
Bart.
------------------------------
Date: 19 Oct 1998 20:42:50 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Q: Simple parsing of string
Message-Id: <70g88a$ops$4@info.uah.edu>
In article <362ca796.1207086@news.ping.be>,
bart.mediamind@ping.be (Bart Lateur) writes:
: Greg wrote:
: >2) If the first 6 chars of the string <> "Posted" then (do something).
:
: if(/^Posted/ { ... do something }
: or
: if (substr($_,0,6) eq 'Posted') { ... }
<> is how one spells != in BASIC. Those should be
if (!/^Posted/) { ... } # or
if (not /^Posted/) { ... } # or
unless (/^Posted/) { ... } # or
if (!!!/^Posted/) { ... } # :-)
Greg
--
A Freudian slip is when you say one thing when you're thinking about a mother.
-- Cliff Clavin
------------------------------
Date: Mon, 19 Oct 1998 16:10:57 -0400
From: Adnan Ahmed <aahmed@cs.uml.edu>
Subject: Quota Support in Perl?
Message-Id: <362B9CD1.FAA6C244@cs.uml.edu>
Hi,
I'm not sure which or if module I need to do the following:
Let a user enter user/passwd to get their quota stats. Whenever I try to
run:
system ("./quota eddy >/temp/tmp");
open(TMP,'/temp/tmp');
while(<TMP>){
chop;
$out="$_\n";
}
close(TMP);
For a fictitious user eddy my apache server logs:
quota: eddy (uid 508): permission denied. I have set the directory and
file permissions.
Any help via E-Mail would be greatly appreciated. Thanks...
------------------------------
Date: 19 Oct 1998 22:23:42 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Quota Support in Perl?
Message-Id: <83yaqcpagh.fsf@vcpc.univie.ac.at>
Re: Quota Support in Perl?, Adnan <aahmed@cs.uml.edu> said:
Adnan> Let a user enter user/passwd to get their quota
Adnan> stats. Whenever I try to
No problem there.
Adnan> run:
Adnan> system ("./quota eddy >/temp/tmp");
What's wrong with a pipe?
Adnan> open(TMP,'/temp/tmp'); while(<TMP>){ chop;
Adnan> $out="$_\n"; } close(TMP);
Unchecked open() !!
You've also got a race-condition if 2 perl scripts run
simultaneously. eddy could thus get bertie's quota details!
Adnan> For a fictitious user eddy my apache server logs:
Adnan> quota: eddy (uid 508): permission denied. I have set
Adnan> the directory and file permissions.
Aaahhh, all is clear. CGI programs run at the behest of a
WWW server are normally not owned by a "normal" user, but
rather by "nobody" or similar.
And that is your problem. Any simple solution is almost
certainly going to be horribly insecure.
tony
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: 19 Oct 1998 20:46:55 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Quota Support in Perl?
Message-Id: <70g8fv$ops$5@info.uah.edu>
[Posted and mailed]
In article <362B9CD1.FAA6C244@cs.uml.edu>,
Adnan Ahmed <aahmed@cs.uml.edu> writes:
: Let a user enter user/passwd to get their quota stats. Whenever I try to
: run:
:
: system ("./quota eddy >/temp/tmp");
[...]
: For a fictitious user eddy my apache server logs:
:
: quota: eddy (uid 508): permission denied. I have set the directory and
: file permissions.
To view a particular user's quota information, you need to be the
superuser or the user in question.
Please read the perlsec manpage.
Greg
--
Bluto: My advice to you is to start drinking heavily.
Otter: Better listen to him, Flounder. He's pre-med.
------------------------------
Date: Mon, 19 Oct 1998 21:00:01 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Quota Support in Perl?
Message-Id: <362BA5CB.D25AFECE@bbnplanet.com>
Tony Curtis wrote:
> Aaahhh, all is clear. CGI programs run at the behest of a
> WWW server are normally not owned by a "normal" user, but
> rather by "nobody" or similar.
> And that is your problem. Any simple solution is almost
> certainly going to be horribly insecure.
One way to do it would be to run this with SSL and have the user
authenticate/log-in to the web server and have the cgi suid to that
user. Quota will allow the user to check their own, but only root can
look at all of the users quota. Running anything as root on a web server
is never a good thing (tm). I have done something more elaborate to
achieve the same sort of application, but security must be your first
and last thought when you start using system administration via the web.
e.
After all, the cultivated person's first duty is to
always be prepared to rewrite the encyclopedia. - U. Eco -
------------------------------
Date: Mon, 19 Oct 1998 16:49:20 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has registered
Message-Id: <362BA5D0.99FDDA00@min.net>
Joergen W. Lang wrote:
>
> And the menu is written in Perl, of course.
I was thinking that it ought to be written in PDL (or perhaps
Data::Dumper)... but it occured to me that Many are welcome at the
O'Reilly critter feast; so the menu should be written in XML.
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 16:51:01 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Raleigh.pm (Raleigh, NC, USA perl mongers) has registered
Message-Id: <362BA635.6E3E473A@min.net>
Joergen W. Lang wrote:
>
> Which means you are expected to know how to use a fork().
> (RTFM = "read the forking manual" ?)
And why are we talking about feeding people, anyway?
Aren't we the ones most vociferously promoting the
"teach a man to fish" philosophy?
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 17:27:47 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Recover ref from string
Message-Id: <362BAED3.243D81F8@min.net>
Larry Rosler wrote:
>
> Thomas Rock <thomas@x-tekcorp.com> says...
> > my $a = [10, 11, 12];
> > my $b = sprintf("%s", $a);
> >
> > Is there any way to recover the reference to the
> > array from the string contained in $b?
>
> No.
Of course, if this is a capability one really really needs,
one can turn to the Tie::RefHash module for relief.
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 16:17:00 -0500
From: Rob Bridal <rbridal@bcl.net>
Subject: Re: Replacing multiply ":" with a string.
Message-Id: <362BAC4C.C884EB8D@bcl.net>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
#!/usr/bin/perl5.00404
<BR>$expr = "_";
<BR>$_ = "1:2:3:4:5";
<BR>s/:/$expr/eg;
<BR>print;
<P>Outputs: 1_2_3_4_5
<P>is that what you mean?
<P>"Alexei V. Alexandrov" wrote:
<BLOCKQUOTE TYPE=CITE>Hello everyone,
<P>i`ve ran into a problem.
<BR>suppose there is a string 1:2:3:4:5
<BR>and there is an expression $expr = " or id = ";
<BR>i have to replace every instance of symbol ":" with $expr;
<BR>standard perl substitute replaces onle the first instance,
<BR>what should i do with other?
<P>Thanks in advance.
<P>--
<BR> Best regards,
<BR> Alexei V. Alexandrov
<BR> Mail: ava@softclub.net
<BR> WWW: www.softclub.net</BLOCKQUOTE>
</HTML>
------------------------------
Date: 19 Oct 1998 13:26:49 -0700
From: nouser@nohost.nodomain (Thomas)
Subject: Re: serial port IO? module?
Message-Id: <tz8d87o70xi.fsf@aimnet.com>
In article <lau310oci7.fsf@erh.ericsson.se> Michal Rutka <erhmiru@erh.ericsson.se> writes:
Jonathan Feinberg <jdf@pobox.com> writes:
> Peter Griessl <griessl@ihs.ac.at> writes:
>
> > I need to talk to an external device connected to the serial
> > port using XON/XOFF flow control and I want to do this out
> > of perl
>
> perlfaq8: "How do I read and write the serial port?"
Not very helpfull. Specially if somebody is trying this on Win32 machine.
But "somebody" didn't ask about Win32...
Moreover, ther is nothing in the FAQ about flow controll. How can you
do hardware flow control?
Same way you do with any serial device on UNIX. The easiest is
to use the "stty" command with appropriate redirections, altough
you can make the system call directly from Perl if you must.
Thomas.
------------------------------
Date: Mon, 19 Oct 1998 20:41:21 GMT
From: eugene@vertical.net
Subject: Re: Shell commands
Message-Id: <70g85h$47c$1@nnrp1.dejanews.com>
http://x6.dejanews.com/getdoc.xp?AN=322827858
http://x6.dejanews.com/getdoc.xp?AN=347578924
http://x6.dejanews.com/getdoc.xp?AN=322827859
Though people who have the call/function nomenclature wrong are unlikely to
mess with syscall(). Of them it might be said: "What You Don't Know Won't
Hurt You (Much)". ;------------------------------)
Eugene
In article <70fr6r$8ju$1@csnews.cs.colorado.edu>,
tchrist@mox.perl.com (Tom Christiansen) wrote:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc, eugene@vertical.net writes:
> :I think he nitpicked the wrong word. People (read Tom Christiansen) like to
> :insist on the difference between a UNIX system call and Perl system()
> :command: "chech the system() call" would be wrong, though "Check the
> :system() command" is OK.
>
> system() is a function that runs a shell command. syscall()
> is a function that runs a system call. Utterly different beasts.
>
> --tom
> --
> The use of COBOL criples the mind; its teaching should, therefore, be
> regarded as a criminal offense. -- E. W. Dijkstra
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Mon, 19 Oct 1998 17:48:21 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Shell commands
Message-Id: <362BB3A5.2CD73EEA@min.net>
Mark-Jason Dominus wrote:
>
> It used to drive me nuts when the Pascal programmers would say primly
> `That is not a function. It is a subroutine.'
I'm sorry, M-J, but it is a "procedure", not a "subroutine".
As a Pascal programmer, I can aver that "subroutine" is not in my
vocabulary.
:-)
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 21:15:47 GMT
From: clintdw@netcom.com (Clinton Wong)
Subject: Sherlock module to search www.perl.com
Message-Id: <clintdwF13F2B.Hyw@netcom.com>
A MacOS 8.5 Sherlock module for searching www.perl.com is available at:
http://postmaster.net/~clintdw/cpan-sherlock.html
Cheers,
Clinton
------------------------------
Date: 19 Oct 1998 21:38:04 GMT
From: "Joop van der Linden" <joop@software-desk.nl>
Subject: Show files for download
Message-Id: <01bdfba8$3116d7a0$297086c2@tsd>
Hi,
I am new here, can someone help me???
I want to make a script. The script has to read all the file-names in the
"download/" directory. In the "download/" directory are files with a total
of 2 per type. For example, Version10.zip, Verzion10.txt. I want the ".Zip"
files to be downloadable and the ".Txt" files to be vissible.Is it simple
to make such a script and can you give me some guidelines??
Thanks,
Joop van der Linden
------------------------------
Date: Mon, 19 Oct 1998 17:14:38 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Slow Sort (complex hashes sub-thread)
Message-Id: <362BABBE.BB8447A3@min.net>
Alexis Huxley wrote:
>
> What I actually wanted to do (a long time ago), was make the
> variables %names and %attribs "file static" (a la "C") *WITHOUT*
> turning the file into a package. But I couldn't work out how to do
> that in Perl, so I wound up making them global. perl's "-w" option
> then complained that a package name was missing, so I just prefixed
> them with "main::" and it was happy.
>
> I'm sure there is a better way do to it. What's the neatest way to
> make a variable "file static" without turning the file into a
> package? -
Being a package or not has nothing to do with it.
If you did "turn the file into a package", you would have changed
nothing except the namespace in which those variables reside.
Variables are either global (and can therefore be qualified with
a package name "path"), or lexically scoped.
Clearly you want the latter.
To get lexical variables, declare them with 'my' before you first
use them. In this case, near the top of the file.
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 17:03:11 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Slow Sort?
Message-Id: <362BA90F.EDC5AD48@min.net>
Uri Guttman wrote:
>
> AH> Having built the hashes, I then output the attributes for each
> AH> filename with this bit of code:
>
> i can't say for sure why you sort is slow but i have some ideas to speed
> up you code. i notice you are using the old perl4 convention of hashes
> with comma separated lists of keys being made into pseudo array. this
> should be done with multilevel hashes as they won't have any problems
> with potential data use of $;
>
> also you use main:: which incurs an extra symbol table lookup (i am not
> sure if this is runtime or compile time).
Are you one of those people that says goto is never valid?
This is a perfect example of when to use a single joined hash key.
Nested data structures, especially hashes, add significant overhead.
> AH> foreach $key (sort {$main::names{$a} cmp $main::names{$b}} (keys %main::names)) {
>
> maybe use a temp variable for the keys and then sort that and then do
> the loop. perl my have to allocate large temp arrays and not knowing the
> size in advance may cause extra overhead.
Blind alley for sure, my friend.
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 17:09:39 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Slow Sort?
Message-Id: <362BAA93.4A4148CB@min.net>
Alexis Huxley wrote:
>
> printf $out_handle > "%s$main::field_separator%s$main::field_separator%d
> $main::field_separator%d$main::field_separator%o
> $main::field_separator%d$main::field_separator%s",
> $main::names{$key},
> $main::attribs{$dev,$inode}->{type},
> $main::attribs{$dev,$inode}->{uid},
> $main::attribs{$dev,$inode}->{gid},
> $main::attribs{$dev,$inode}->{mode},
> $main::attribs{$dev,$inode}->{nlink},
> $main::attribs{$dev,$inode}->{contents};
Make the format string like this, and do it before the loop:
my $fmt = join $field_separator, qw( %s %s %d %d %o %d %s );
Then, before the printf, get a nice simple reference to the record:
my $r = $attribs{$dev,$inode};
Then each printf looks like this:
printf $out_handle $fmt,
$names{$key}, @{$r}{ qw( type uid gid mode nlink contents ) };
Much neater, eh?
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: Mon, 19 Oct 1998 17:19:27 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Slow Sort?
Message-Id: <362BACDF.29E13731@min.net>
Steve Monson wrote:
>
> That is, given a grammar, I first compute the frequencies of the words used
> in all sentences. Then I compute a weighted sentence "length", where the
> weights are the frequencies of the words used in each sentence. These
> are then sorted, and the quantiles listed (each with about 28000
> sentences), showing what portion of the total words belong in each
> quantile. So, duplicate values don't bother me; they just weight
> their part of the list more heavily.
Well then clearly you want a smarter routine.
my %counts;
for ( my $i = 0; $i < $#s; $i++ ) {
$counts{ $s[$i] }++;
}
@s = ();
for ( sort keys %counts ) {
push @s, ( $_ ) x $counts{$_};
}
--
John "Gashlycrumb" Porter
"A fugitive and lurid gleam
Obliquely gilds the gliding stream." -- EG
------------------------------
Date: 19 Oct 1998 17:41:31 -0400
From: Uri Guttman <uri@camel.fastserv.com>
Subject: Re: Slow Sort?
Message-Id: <sarr9w4nsac.fsf@camel.fastserv.com>
>>>>> "JP" == John Porter <jdporter@min.net> writes:
JP> Uri Guttman wrote:
>> also you use main:: which incurs an extra symbol table lookup (i am
>> not sure if this is runtime or compile time).
i also replied to him to use my for file globals.
JP> Are you one of those people that says goto is never valid? This
never say never!
i haven't neede to use a goto since my assembler days! i even learned my
first language (PL/I) without gotos. it was a structured programming
course vs. the others which used gotos. my luck i guess.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Mon, 19 Oct 1998 20:34:38 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <F13D5q.CH3@world.std.com>
rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
>I just try to stay out of the list of Bottom Ten Posters by OCR. :-)
In some ways, thats just an observation too. I remember at one point
the "minimum 5 posts" rule caused people to appear on both the top and
the bottom OCR list. There were fewer than twenty people who posted
above the threshold.
--
Andrew Langmead
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 4012
**************************************