[13422] in Perl-Users-Digest
Perl-Users Digest, Issue: 832 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 17 15:28:08 1999
Date: Fri, 17 Sep 1999 12:05:17 -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: <937595115-v9-i832@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 17 Sep 1999 Volume: 9 Number: 832
Today's topics:
Re: /etc/passwd (Mark W. Schumann)
Re: /etc/passwd (Mark W. Schumann)
Author of Learning Perl/TK and Denver Perl Mongers (Chris Fedde)
Re: cgi help <makkulka@cisco.com>
CGI probs with long email domains spaul@gunnison.com
Re: CONTEST: Range Searching <ltl@rgsun5.viasystems.com>
Re: CONTEST: Range Searching <jamie@mccarthy.org>
Re: CONTEST: Range Searching (Ken Pizzini)
Re: CONTEST: Range Searching (Abigail)
Re: Creating a File with Username and password (Kragen Sitaker)
freelance program writer needed <pso@skydev.com>
Re: Is there any CTlib.pm documentation ? <alex@kawo2.rwth-aachen.de>
make install command fails <mikej@1185design.com>
making 'find' follow soft links (Peter Bismuti)
Re: making 'find' follow soft links (Kragen Sitaker)
Need to convert expressions <mrneil@my-deja.com>
Re: Need to convert expressions (Kragen Sitaker)
Re: need to write www search engine (Mark W. Schumann)
Re: optimizing execution speed (Graham Ashton)
Re: PERL (cgi) and Databases -> How To? (Kragen Sitaker)
Re: Perl HTTP Post issue (Kragen Sitaker)
perl5.005_0 Install problem HELP !! <naren.dasu@divatv.com>
Re: REQ: tell-a-friend script (Abigail)
Returning information from 'eval' <Helge.Fredriksen@sensewave.com>
Re: Returning information from 'eval' (Larry Rosler)
Re: Setting a directory (Kragen Sitaker)
Re: Setting a directory <nik@cheddarcheese.de>
Re: Telnet scripting in Perl? (Kragen Sitaker)
timed process (s. morgan friedman)
Re: trimming spaces from a string (Larry Rosler)
Re: What happens with this slice? <alex@kawo2.rwth-aachen.de>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 17 Sep 1999 14:43:51 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: /etc/passwd
Message-Id: <7ru257$hfj@junior.apk.net>
In article <7rgp50$4lo$1@nnrp1.deja.com>, Ubu <ubu@easynet.ca> wrote:
>Are either of you actually reading the posts? Dear Abby picked on the
>original poster, not me; she apparently didn't bother reading my answer,
>which I'd already posted. Come on guys, if you really want to be an ass
>to people, you need to pay closer attention.
Ubu, tell me what you know about NNTP. Talk to me about what order
news postings arrive at a given server. (That's rhetorical, okay?)
>Upside of this foolishness, I suppose, is that whois tells me
>delanet.com is in Delaware, which at leasts suggests I won't be too
>close when this nut job goes postal and grabs a gun. Thank God for small
>favours, etc.
I chanced to meet Abigail at YAPC this summer. In person I found
Abigail to be a perfectly pleasant and even-tempered individual.
I doubt Abigail will ever "go postal."
IAC, Abigail provides plenty of useful information besides pointing
people to the FAQs and perldoc entries. This newsgroup would be
much less interesting and useful without Abigail.
------------------------------
Date: 17 Sep 1999 14:48:42 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: /etc/passwd
Message-Id: <7ru2ea$itj@junior.apk.net>
In article <37DACC96.CFC2B0D8@chaos.wustl.edu>,
Elaine -HFB- Ashton <elaine@chaos.wustl.edu> wrote:
>Benjamin Schweizer wrote:
>> I´ve written a little user management in perl/html and need to check
>> passwords. Is there a method to encrypt a string like Linux´
>> /etc/passwd ist encrypted or even a complete method for checking
>> accounts?
>
>Much you English do speak you?
<nudge> You did notice he's posting from a .de domain, right? Betcha
he writes English better than you write German.
>Considering your .sig, I would assume that you are on the win32
>platform. I would suggest having a look at the win32 FAQ, and, if all
>else fails, just install BackOrifice or wait a day or so for the next MS
>hack on rootshell :)
<signal>
Or (for the original poster) check your Win32 API documentation. I
don't know for a fact, but I seem to recall there is a user
authentication API call in there somewhere. You might get to write
a Perl wrapper around that call.
</signal>
>User management and NT in the same breath...now _there_ is an oxymoron.
Testify!
------------------------------
Date: Fri, 17 Sep 1999 18:40:14 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Author of Learning Perl/TK and Denver Perl Mongers
Message-Id: <iWvE3.6596$Pt1.3599@wormhole.dimensional.com>
September 20
7:00pm
Nancy Walsh, Author of [2]Learning Perl/Tk , published by O'Reilly &
Associates will be speaking at the upcoming meeting. Bring your copy
of the book and maybe Nancy will sign it for you. By the time of our
meeting Nancy will have recovered from delivering her highly
anticipated tutorial at the [3]Perl Conference in Monterey.
Location
Advanced Computer Systems for Printers
6890 S. Tucson Way, Suite #205.
Englewood, CO 80112
Contact: Bruce Langlois
303-792-9779
Monday, August 16, 6:30pm
Directions
* I-25 (North from C-470 or South from anywhere else) to
* Arapahoe road.
* East on Apapahoe to Revere Parkway.
* South on Revere Parkway to Briarwood Ave.
* East (and south, it curves around and turns into Tucson Way) on
* Briarwood 1 building past the TCI building.
1. http://www.pm.org/
2. http://www.ora.com/catalog/lperltk/
3. http://conferences.oreilly.com/perl3/
4. mailto:chris@fedde.littleton.co.us
5. http://denver.pm.org
------------------------------
Date: Fri, 17 Sep 1999 11:52:18 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: cgi help
Message-Id: <37E28DE2.9A49E261@cisco.com>
[ Olli Aalto wrote:
> How do I make my script update the client browser
> every second?
Let me direct you to the page where the examples
from "official guide to programming with CGI.pm"
are kept online. This is an excellent book by
Lincoln Stein. You will find that the last example
on this page is what you are looking for. This
uses server push.
http://www.wiley.com/compbooks/stein/source.html
You can see this script in action here.
http://www.wiley.com/compbooks/stein/code/nph-push.cgi
and the source is here
http://www.wiley.com/compbooks/stein/text/nph-push.txt
Hope this helps.
==
Other methods like client pull can also be used.
------------------------------
Date: Fri, 17 Sep 1999 12:37:06 -0600
From: spaul@gunnison.com
Subject: CGI probs with long email domains
Message-Id: <37E28A52.1E82CA00@gunnison.com>
I am running Slackware 3.5, using sendmail and am having problems with a
script that emails some form info to a client. It seems that perl will
not allow an email address with a domain as long as
"meridianhuntclub.com" in our CGI-bin. I have created an alias that
works fine on our mail server, but I am looking for a way to make perl
accept the email address directly. If it will accept it directly, I
will not have problems with forwarded email when the mailserver is
rebuilt... Anyone have a suggestion?
Scott Paul
------------------------------
Date: 17 Sep 1999 17:57:30 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: CONTEST: Range Searching
Message-Id: <7rtvea$rk$1@rguxd.viasystems.com>
Sorry to follow up on myself, but it was only a few small changes
to make this into the patba program instead of just patfore.
#!/usr/lib/lprgs/perl -w
use strict;
# Program: patba
# Print a pattern and up to N lines of text before the pattern.
# and up to N lines of text after the pattern.
# Assumptions:
# 1) the pattern can match across a line boundary!
# 2) Memory is cheap. This is the barbarian "all memory should be free!"
# entry. Not some namby pamby space conservation algorithm.
# Seriously, memory is way too cheap to worry about like we used to do.
# 3) No reasonable way that I can see to get the bonus with the
# regexp approach.
# Interesting code moved to the top. Not normally how I would have
# layed this out.
my (%opts, $USAGE);
my $pattern = parse_args();
# Should I assume that when the user gives a space char that they
# really mean \s and that it includes newline? Assume so unless
# they are sophisticated enough to tell me to leave their sacred pattern
# alone. Otherwise, I'm going to expect unsophisticated users who
# provide the string "black ice" and expect it to match when one line
# ends with "black" and the next line starts with "ice". Therefore,
# I mangle the user supplied pattern by default.
$pattern =~ s/ +/\\s/g unless exists $opts{S};
$pattern = qr{
(
(?:.*\n){0,$opts{B}} # Match up to -B arbitrary lines
# Interesting that this does nothing if
# $opts{B} is 0!
(?m: # ^ and $ match on newline for this part
^.* # 0 or more chars begining of this line
(?s-x:$pattern) # Whatever they want to match
# where . and \s match newline too
# but space has meaning within $pattern
#HEY! Fix perlre to say that \s matches
#newline just like . does under /s!!!!
#That is expected, but not obvious!!!!
.*$ # Match to end of line containing $pattern
)
\n # Throw in final newline of line containing
# pattern -- m modifier dropped it.
(?:.*\n){0,$opts{A}} # Match up to -A arbitrary lines
)}xo;
sub find_pattern_in_file {
my ($fh, $file_name) = @_;
print "\n\n$file_name --\n" if (defined $file_name);
# Screw memory requirements. Memory is cheap and modern books aren't
# that long.
local $/;
my $string = <$fh>;
print $1, "\n--\n" while ($string =~ /$pattern/g) ;
}
# The rest of this just handles the argument processing and
# file manipulation.
if (@ARGV == 0) {
if (exists $opts{D}) {
# Specail test case
find_pattern_in_file(\*DATA);
} else {
# No file name provided as an argument
find_pattern_in_file(\*STDIN);
}
} else {
foreach my $file_name (@ARGV) {
# Rather than simply using magic <ARGV> processing,
# I want to print the file name.
local *FH;
open(FH, $file_name)
or die "Failed to open $file_name: $!\n\t$USAGE";
find_pattern_in_file(\*FH, $file_name);
}
}
exit 0;
sub parse_args {
$USAGE = "patfore [-A X] [-B T] [-C N] [-S] pattern [files ...| -D]
\twhere T is number of lines before pattern to display and
\twhere X is number of lines after pattern to display *OR*
\twhere N is number of lines both before and after pattern to display
\t-S indicates a strict pattern that should not be white space pampered
\tand -D says use the testing data at the bottom of the source";
use Getopt::Std;
die $USAGE unless getopts('DSA:B:C:', \%opts);
$opts{B} = 0 unless exists $opts{B}; # Number of lines before pat to print
$opts{A} = 0 unless exists $opts{A}; # Number of lines after pat to print
$opts{B} = $opts{A} = $opts{C} if (exists $opts{C}); # Overrides both A and B
# There must be at leat one pattern arg and at least A or B must be set
# I should probably check for reasonable values of A and B here, but if
# somebody wants to try "-2" lines before the pattern, that's there problem.
die $USAGE unless (@ARGV >= 1 && ($opts{A} > 0 || $opts{B} > 0));
shift @ARGV; # return pattern
}
__END__
This is line 1
and line 2
and line 3
and yet a line 4
and a line 5
and 6 don't you know
and a line 7
and 8 is the last.
--
// Lee.Lindley /// Programmer shortage? What programmer shortage?
// @bigfoot.com /// Only *cheap* programmers are in short supply.
//////////////////// 50 cent beers are in short supply too.
------------------------------
Date: Fri, 17 Sep 1999 11:20:08 -0400
From: Jamie McCarthy <jamie@mccarthy.org>
Subject: Re: CONTEST: Range Searching
Message-Id: <37E25C28.88BED886@mccarthy.org>
Since everyone else seems to be taking the "no frills" part of
the contest seriously, I might as well too. Here's my little
program minus its spiffy features, comments, and initialization.
This version doesn't have the "prelude" and "postlude" options,
nor does it truly run in minimal space.
while (defined($line = <>)) {
push @buff, $line;
$match = $. if $line =~ /$regex/o;
&dump if $match and $. - $match > $before+$after;
shift @buff if !$match and $#buff >= $before;
}
if ($match) {
push @buff, ("") x (1+$before+$after+$match-$.);
&dump;
}
sub dump {
print @buff[0..$#buff-$before-1];
@buff = ($before ? @buff[-$before, -1] : ());
$match = $skimmed = 0;
}
The "skimming" of the first version has been taken out to make the
code smaller. This makes only a minor difference in normal
operation but in pathological cases it can add up. I tried this
test case with both versions:
$ ./patba.pl -A 99999 '^Aa|^Zu|perl' /usr/dict/words
They both outputted the same 400K results file (the entire contents
of /usr/dict/words), but Linux reports a run size difference of
over 3 MB (9200K VmSize for the first version and 12940K for the
no-frills).
--
Jamie McCarthy
------------------------------
Date: 17 Sep 1999 08:20:45 GMT
From: ken@halcyon.com (Ken Pizzini)
Subject: Re: CONTEST: Range Searching
Message-Id: <slrn7u3u6r.3g5.ken@pulsar.halcyon.com>
On 16 Sep 1999 21:59:57 GMT, Ken Pizzini <ken@halcyon.com> wrote:
> push @lines, $_;
> if (($matched = /pattern/) || $. <= $end) {
> print @lines;
> @lines = ();
> $end = $matched && $. + $X;
> } else {
> shift @lines if !$end && @lines >= $T;
Oops --- last minute edit broke this script; this line should read:
shift @lines if $. > $end && @lines >= $T;
> }
--Ken Pizzini
------------------------------
Date: 17 Sep 1999 13:55:12 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: CONTEST: Range Searching
Message-Id: <slrn7u53pb.1j0.abigail@alexandra.delanet.com>
Tom Christiansen (tchrist@mox.perl.com) wrote on MMCCVII September
MCMXCIII in <URL:news:37e1043e@cs.colorado.edu>:
@@
@@ So here's the challenge: devise idiomatic solutions to the
@@ following problems.
For exercises 1) through 3), it is assumed we are only interested
in the first match; the specification isn't clear what to do when
multiple lines match. Furthermore, when given multiple files, it
is assumed you want them to look like one big file, so, for instance
for peraft, if there's a match on the last line of the first file,
lines of the second file will be printed. This is done in the spirit
of KISS, if you don't want this behaviour, just call the programs
multiple times.
@@ 1) Write a "patfore" program that prints out up to N lines
@@ before the match as well as the match itself. Here's
@@ the usage message:
@@
@@ patfore [-B N] pattern [files ...]
#!/opt/perl/bin/perl -w
use strict;
sub usage () {
die "$0 [-B N] pattern [files .... ]\n";
exit 1;
}
# Parse arguments.
my $lines = 0;
if (@ARGV && $ARGV [0] eq '-B') {
usage if @ARGV < 3;
$lines = $ARGV [1];
usage if !length $lines or $lines =~ /\D/;
splice @ARGV, 0, 2;
}
usage unless @ARGV; # Need a pattern.
my $pattern = shift;
my @buffer; # Circular buffer. push/shift would be inefficient.
$buffer [$lines - 1] = undef if $lines; # Preallocate.
while (<>) { # Should read from files if @ARGV, from stdin otherwise.
if (/$pattern/o) {
print grep {defined} @buffer [$. % $lines .. $lines - 1,
0 .. $. % $lines - 1] if $lines;
print;
last;
}
else {
$lines and $buffer [$. % $lines] = $_;
}
}
__END__
Once we've done one program, all others look remarkably the same.
No surprise that all others were made by copying and then changing
a few lines.
@@ 2) Write a "pataft" program that prints out up to N lines
@@ after the match as well as the match itself. Here's
@@ the usage message:
@@
@@ pataft [-A N] pattern [files ...]
#!/opt/perl/bin/perl -w
use strict;
sub usage () {
die "$0 [-A N] pattern [files .... ]\n";
exit 1;
}
# Parse arguments.
my $lines = 0;
if (@ARGV && $ARGV [0] eq '-A') {
usage if @ARGV < 3;
$lines = $ARGV [1];
usage if !length $lines or $lines =~ /\D/;
splice @ARGV, 0, 2;
}
usage unless @ARGV; # Need a pattern.
my $pattern = shift;
while (<>) { # Should read from files if @ARGV, from stdin otherwise.
if (/$pattern/o) {
print;
print while ($lines -- && defined ($_ = <>));
last;
}
}
__END__
@@ 3) Write a "patba" program that prints out up to
@@ X lines before the match and Y lines after the match.
@@
@@ patba [-A X] [-B T] pattern [files ...]
@@
@@ or both N before and after:
@@
@@ patba [-C N] pattern [files ...]
This of course is just combining patfore and pataft.
#!/opt/perl/bin/perl -w
use strict;
sub usage () {
die "$0 [[-A X] [-B Y] | -C Z] pattern [files .... ]\n";
exit 1;
}
# Parse arguments.
my $prelines = my $postlines = 0;
# This allows for repeted arguments, or -C mixed with -A or -B. Blah.
while (@ARGV && $ARGV [0] =~ /^-[ABC]$/) {
usage if @ARGV < 3;
if ($ARGV [1] ne '-B') {
$prelines = $ARGV [1];
usage if !length $prelines or $prelines =~ /\D/;
}
if ($ARGV [1] ne '-A') {
$postlines = $ARGV [1];
usage if !length $postlines or $postlines =~ /\D/;
}
splice @ARGV, 0, 2;
}
usage unless @ARGV; # Need a pattern.
my $pattern = shift;
my @buffer; # Circular buffer. push/shift would be inefficient.
$buffer [$prelines - 1] = undef if $prelines; # Preallocate.
while (<>) { # Should read from files if @ARGV, from stdin otherwise.
if (/$pattern/o) {
print grep {defined} @buffer [$. % $prelines .. $prelines - 1,
0 .. $. % $prelines - 1] if $prelines;
print;
print while $postlines -- && defined ($_ = <>);
last;
}
else {
$prelines and $buffer [$. % $prelines] = $_;
}
}
__END__
@@ For Extra Credit:
@@ Provide alternate solutions that also coalesce with overlapping
@@ ranges. For example, if you ask for 2 lines before and after, and
@@ lines 2, 4, and 5 all contain matches, the output should comprise
@@ lines [1-7] rather three separate output blocks showing lines.
@@ [1-4], [2-6], and [3-7].
This definition is a bit vague. In the following program, it is assumed
to be meant "print 2 lines from the first match, to 2 lines after the
last match".
#!/opt/perl/bin/perl -w
use strict;
sub usage () {
die "$0 [[-A X] [-B Y] | -C Z] pattern [files .... ]\n";
exit 1;
}
# Parse arguments.
my $prelines = my $postlines = 0;
# This allows for repeted arguments, or -C mixed with -A or -B. Blah.
while (@ARGV && $ARGV [0] =~ /^-[ABC]$/) {
usage if @ARGV < 3;
if ($ARGV [0] ne '-B') {
$prelines = $ARGV [1];
usage if !length $prelines or $prelines =~ /\D/;
}
if ($ARGV [0] ne '-A') {
$postlines = $ARGV [1];
usage if !length $postlines or $postlines =~ /\D/;
}
splice @ARGV, 0, 2;
}
usage unless @ARGV; # Need a pattern.
my $pattern = shift;
my @buffer; # Circular buffer. push/shift would be inefficient.
$buffer [$prelines - 1] = undef if $prelines; # Preallocate.
while (<>) { # Should read from files if @ARGV, from stdin otherwise.
if (/$pattern/o) {
print grep {defined} @buffer [$. % $prelines .. $prelines - 1,
0 .. $. % $prelines - 1] if $prelines;
print;
# Now we have to scan the rest of file(s) for god knows how
# many other matches. We have to remember everything, because
# there can be a match on the last line. *sigh*.
my @rest = <>;
my $i = @rest;
while (-- $i >= 0 && $rest [$i] !~ /$pattern/o) {}
# $i should now be index of last match, -1 if not present.
print grep {defined} @rest [0 .. $i + $postlines];
last;
}
else {
$prelines and $buffer [$. % $prelines] = $_;
}
}
__END__
@@ Solutions will be judged upon these overall criteria:
@@
@@ Objective:
@@
@@ * correctness: does it actually do the right thing? if not,
@@ nothing else matters. :-)
Well, I didn't write a correctness proof....
@@ * space efficiency: don't use more space than minimally needed
It uses a lot more space that it minimally needs. Any solution that reads
in a line and then prints it uses more space than it should. Using reads,
reading one character, and only keeping it while it's needed for the
pattern matching would be more efficient. Furthermore, the programs
that keep lines just in case they might be printed (patfore, patba)
don't check whether the input is seekable; if it is, remembering lines
is a waste of memory.
@@ * time efficiency: is your solution fast?
No. It's written in Perl. ;-) But with the right assumptions, it's linear
in the amount of lines.
@@ * test coverage: do you include test data to check all border cases?
None at all.
@@ Subjective:
@@
@@ * conciseness: keep it short. no frills. just a few lines.
Command line parsing takes up the few lines before getting to the meat.
@@ * clarity: is this understandable to a native perl speaker?
Well, it has comments....
@@ * idiom: does this look like natural perl? does it use cool
@@ perl features absent in other languages?
regexes, <>, grep {BLOCK}.
@@ * creativity: is your solution cleverly different from those
@@ of others?
Extremely doubtful. I cannot think of any significant other solution that
isn't inefficient or totally unclear.
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== 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: Fri, 17 Sep 1999 18:12:00 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Creating a File with Username and password
Message-Id: <QvvE3.16822$N77.1240286@typ11.nn.bcandid.com>
In article <7rlt0r$p41$1@nnrp1.deja.com>, <dmcp71@my-deja.com> wrote:
>> In article <7rji0b$39f$1@nnrp1.deja.com>, <dmcp71@my-deja.com> wrote:
>> >What I need
>> >to do is to create a login page with a username, email address and
>> >password. When the user enters their name, username and email
>address,
>> >a file is created for them using their username and password with
>> >either a unique id number or something similar that will allow them
>to
>> >enter additional information and retrieve it whenever they want.
>
>I have no problem creating the login page. My problem is creating the
>user accounts, storing the additional data for those accounts and
>verifying the information.
Well, you need to store the user accounts and additional data in a file
or a database. It's a little more work than I want to do for you at
the moment. Perhaps someone else could suggest where to find an
already-done version?
If you want to put it in files, you need open(), flock(), <>, and
close(), as well as possibly seek() and/or truncate().
If you want to put it in databases, you need DBI and DBD.
Much of the difficulty will have to do with learning to program, rather
than learning Perl.
> I am very new to perl, so this is not any
>easy task for me, I was hoping someone could inform me of where I could
>find the information to do this or provide me with some tips. Thanks
>in advance for your help.
I hope someone can.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 17 Sep 1999 11:47:09 -0700
From: "Peter S. Oser" <pso@skydev.com>
Subject: freelance program writer needed
Message-Id: <37E28CAA.45AF54A9@skydev.com>
We are in need of a freelance program writer ASAP. I've been told it is
simple but I am having a hard time finding someone. Please respond to
pso@skydev.com
Thanks,
Peter S. Oser
------------------------------
Date: Fri, 17 Sep 1999 20:41:55 +0200
From: Alex Farber <alex@kawo2.rwth-aachen.de>
To: c_j_marshall@my-deja.com
Subject: Re: Is there any CTlib.pm documentation ?
Message-Id: <37E28B73.78FC7682@kawo2.rwth-aachen.de>
Chris,
c_j_marshall@my-deja.com wrote:
> Hi - can anyone please point me in the direction of some
try http://www.mbay.net/~mpeppler/
Regards
Alex
--
óÏÂÉÒÁÀ ÓÔÁÔØÉ ÐÒÏ JavaScript, Perl É ÄÒ. ÎÁ http://simplex.ru/news.html
------------------------------
Date: Fri, 17 Sep 1999 11:00:14 -0700
From: mikej <mikej@1185design.com>
Subject: make install command fails
Message-Id: <37E2811B.2A48FAD@1185design.com>
Hi,
Im trying to install some perl modules, and I got the perl Makefile.PL
command to work by entering the full path to perl (BTW how do I set it
up so I can just type perl then the filename, and not the whole path, is
there some config
file in Apache?) but now I try to do the make test and make install
commands to finish installing the module but it gives me this error:
make: not found
am I missing something? Thanks for any help.
mike
------------------------------
Date: 17 Sep 1999 16:51:41 GMT
From: bismuti@cs.fsu.edu (Peter Bismuti)
Subject: making 'find' follow soft links
Message-Id: <7rtrit$fue$1@news.fsu.edu>
Hi, is it possible to make 'find' follow soft links??
The danger of an infinite loop is clear, but working
around this limitation does not seem easy. Detect
soft links to directories and fire off a new 'find'
command?! :0
Thanks as always.
------------------------------
Date: Fri, 17 Sep 1999 17:11:01 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: making 'find' follow soft links
Message-Id: <FCuE3.16723$N77.1234468@typ11.nn.bcandid.com>
In article <7rtrit$fue$1@news.fsu.edu>,
Peter Bismuti <bismuti@cs.fsu.edu> wrote:
>Hi, is it possible to make 'find' follow soft links??
>The danger of an infinite loop is clear, but working
>around this limitation does not seem easy.
This is off-topic for a Perl newsgroup. The answers are: -follow, use
GNU or SCO find.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 17 Sep 1999 17:04:43 GMT
From: MrNeil <mrneil@my-deja.com>
Subject: Need to convert expressions
Message-Id: <7rtsb2$hah$1@nnrp1.deja.com>
I am reading a file full of silly expressions. I need to have perl
convert each of them to their mathematical values. For example, the
script reads in such things as
(($dozen*2)+1)
I am setting the value of $dozen within the script that reads the file.
How do I make perl evaluate the string as an expression and return its
value (25 in this case)?
--
MrNeil
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 17 Sep 1999 17:12:01 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Need to convert expressions
Message-Id: <BDuE3.16724$N77.1234710@typ11.nn.bcandid.com>
In article <7rtsb2$hah$1@nnrp1.deja.com>, MrNeil <mrneil@my-deja.com> wrote:
>I am reading a file full of silly expressions. I need to have perl
>convert each of them to their mathematical values. For example, the
>script reads in such things as
> (($dozen*2)+1)
>
>I am setting the value of $dozen within the script that reads the file.
>How do I make perl evaluate the string as an expression and return its
>value (25 in this case)?
eval. Hope your file is guaranteed to not have "system('rm -rf
$HOME')" in it.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 17 Sep 1999 14:55:52 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: need to write www search engine
Message-Id: <7ru2ro$l64@junior.apk.net>
In article <Pine.GSO.4.05.9909161347330.26187-100000@titan.oit.unc.edu>,
Roger Jacques <channel@metalab.unc.edu> wrote:
>What I want is a massive database with all URLs and the contents of each
><title>, meta:title and first headers <h1/h2>. I have found a use for
>such a database that would definitely fill a needed gap, and that would be
>popular and profitable to my group.
>
>Also I could use your further recommendations and suggestions as to the
>best crawler (harvester agent?) to use or to write.
But don't you see by now that this is really not a Perl question at all?
>What sites should I browse for further guidance?
Ah. Good question. VERY good question.
I'm pretty sure that some of the regulars will have good ideas for
you on this. Let me add:
http://www.useit.com -- query the archives for "crawler"?
comp.infosystems.www.* newsgroups
Try any good search engine for terms like "crawler database dns"
or somesuch
Good luck, but this is not even close to being a Perl problem.
------------------------------
Date: 17 Sep 1999 17:27:34 GMT
From: graham@mirror.bt.co.uk (Graham Ashton)
Subject: Re: optimizing execution speed
Message-Id: <slrn7u4ufo.pke.graham@wing.mirror.bt.co.uk>
In article <obsE3.16435$N77.1218474@typ11.nn.bcandid.com>, Kragen Sitaker wrote:
>
>#!/usr/bin/perl -w
>use strict;
>use Benchmark;
>timethese (1000000,
> {'null' => sub { },
> 'openclose' => sub { open FOO, "<$0" or die "damn $!"; close FOO }
> }
>);
>
>Benchmark: timing 1000000 iterations of null, openclose...
> null: 12 wallclock secs ( 8.19 usr + 0.01 sys = 8.20 CPU)
> openclose: 59 wallclock secs (39.27 usr + 4.40 sys = 43.67 CPU)
>
>. . . so doing a million open/close system calls took 4.4 seconds. So
>on this machine (an ancient Sparc 20 running Solaris 2.6) an open/close
>takes 4.4 microseconds.
I tried it on my dual PII 400 with UW SCSI. Your system call speed beat mine
into the ground;
Benchmark: timing 1000000 iterations of null, openclose...
null: 2 wallclock secs ( 1.75 usr + 0.65 sys = 2.40 CPU)
openclose: 19 wallclock secs ( 9.73 usr + 8.53 sys = 18.26 CPU)
Debian Linux 2.2, kernel 2.2.10, Perl 5.005. (I'm not trying to start a
"my OS+hardware is faster than yours" war by the way, I just thought it
was interesting that my box got trounced on the system call stuff)
--
Graham
------------------------------
Date: Fri, 17 Sep 1999 17:07:30 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: PERL (cgi) and Databases -> How To?
Message-Id: <mzuE3.16715$N77.1233230@typ11.nn.bcandid.com>
In article <37e26cd5.8011546@news.earthlink.net>,
Jon S. <jonceramic@nospammiesno.earthlink.net> wrote:
>On 16 Sep 1999 15:50:35 -0500, abigail@delanet.com (Abigail) wrote:
>>[obnoxious stuff]
>
>Nope, I'm such a newbie that I haven't quite figured out how to get
>the perl manpage. I started reading O'Reilly's "Learning Perl" 1
>month ago before I had access to a computer with Perl installed, and
>it talks about the manpages right at the beginning. But, I haven't
>tried to get them out yet. Now I know the command.
>
>I assume I issue "man perlfaq" at the telnet prompt, right? (I don't
>have my copy of "learning Perl" on me at the moment, but I know it
>talks about the man pages in the front.)
man perlfaq at your shell prompt, if you have one; you might also try
perldoc perlfaq wherever you have Perl installed.
>Some newbies truly are newbies, not just coders and unix folks who've
>never tried perl before.
We know :)
> Thanks for the warm welcome.
We try.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 17 Sep 1999 18:13:27 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl HTTP Post issue
Message-Id: <bxvE3.16827$N77.1240430@typ11.nn.bcandid.com>
In article <7rtrft$gqf$1@nnrp1.deja.com>, <m_grady@my-deja.com> wrote:
>but not others. It generates a java exception in
>our code. What should I try to determine if it
>is Perl causing the exception or a bug in our
>code.
What's the Java exception, and what does that exception mean, according
to the documentation of [whatever generated it]?
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 17 Sep 1999 10:39:59 -0700
From: Naren Dasu <naren.dasu@divatv.com>
Subject: perl5.005_0 Install problem HELP !!
Message-Id: <37E27CEF.AF47B70B@divatv.com>
--------------AFD5A7FE7085E2DBC696A7A3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi ,
I get this error when I do the "make depend"
Has anyone else had this problem ?
sh ./makedepend MAKE=make
./makedepend: /dev/null: cannot execute
./makedepend: -f: execute permission denied
cp: Insufficient arguments (1)
Usage: cp [-f] [-i] [-p] f1 f2
cp [-f] [-i] [-p] f1 ... fn d1
cp -r|R [-f] [-i] [-p] d1 ... dn-1 dn
./makedepend: test: argument expected
make: *** [depend] Error 1
thanks in advance
naren
--------------AFD5A7FE7085E2DBC696A7A3
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi ,
<br>
I get this error when I do the "make depend"
<p> Has anyone else had this problem ?
<p><b>sh ./makedepend MAKE=make</b>
<br><b>./makedepend: /dev/null: cannot execute</b>
<br><b>./makedepend: -f: execute permission denied</b>
<br><b>cp: Insufficient arguments (1)</b>
<br><b>Usage: cp [-f] [-i] [-p] f1 f2</b>
<br><b> cp [-f] [-i] [-p] f1 ... fn
d1</b>
<br><b> cp -r|R [-f] [-i] [-p] d1 ...
dn-1 dn</b>
<br><b>./makedepend: test: argument expected</b>
<br><b>make: *** [depend] Error 1</b>
<br>
<p>thanks in advance
<p>naren
<br> </html>
--------------AFD5A7FE7085E2DBC696A7A3--
------------------------------
Date: 17 Sep 1999 14:03:00 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: REQ: tell-a-friend script
Message-Id: <slrn7u5481.1j0.abigail@alexandra.delanet.com>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMCCVIII September
MCMXCIII in <URL:news:m1d7vh33ou.fsf@halfdome.holdit.com>:
%% >>>>> "chetohevia" == chetohevia <chetohevia@my-deja.com> writes:
%%
%% chetohevia> (i agree-- odd that HTTP_REFERER is misspelled... same thing
%% chetohevia> with elsif, which tripped me up at first too)
%%
%% Ahh, but elsif is *not* misspelled, unless you happen to type it as
%% elseif... then *you* are the one mispelling it.
So, what makes "elsif" not misspelled, and "HTTP_REFERER" misspelled?
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-
-----------== 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: Fri, 17 Sep 1999 20:00:26 +0200
From: "Helge Fredriksen" <Helge.Fredriksen@sensewave.com>
Subject: Returning information from 'eval'
Message-Id: <7rtvhq$l5g$1@web.ost.eltele.no>
Hi!
I'm a newby to perl, lovely language by the way!
One of the trickyest things I came about with perl so far is to achieve
status from the eval function in perl.
To be able to mix perl variables and unix commands, i want
to evaluate a command built within a string like this
eval "$status = `cmp " . $file1 . " " . $file2 . "`";
and then be able to read out what the status string contains.
This does not work, and I have to substitue the real values
of $file1 and $file2, which is not a very elegant, and do the
statement without the use of eval.
Anyone have a suggestion on how to do this
(PS: I've allready thought about pasting standard error/output
to a file, and reading it from there...)
In beforehand,
Thanks.
Helge Fredriksen
------------------------------
Date: Fri, 17 Sep 1999 11:39:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Returning information from 'eval'
Message-Id: <MPG.124c2abc9eb8e4ca989f96@nntp.hpl.hp.com>
In article <7rtvhq$l5g$1@web.ost.eltele.no> on Fri, 17 Sep 1999 20:00:26
+0200, Helge Fredriksen <Helge.Fredriksen@sensewave.com> says...
> I'm a newby to perl, lovely language by the way!
> One of the trickyest things I came about with perl so far is to achieve
> status from the eval function in perl.
>
> To be able to mix perl variables and unix commands, i want
> to evaluate a command built within a string like this
>
> eval "$status = `cmp " . $file1 . " " . $file2 . "`";
>
> and then be able to read out what the status string contains.
> This does not work, and I have to substitue the real values
> of $file1 and $file2, which is not a very elegant, and do the
> statement without the use of eval.
>
> Anyone have a suggestion on how to do this
> (PS: I've allready thought about pasting standard error/output
> to a file, and reading it from there...)
Why not simply interpolate the values into the command string (which is
a double-quotish environment)?
$status = `cmp $file1 $file2`;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 17 Sep 1999 17:09:51 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Setting a directory
Message-Id: <zBuE3.16721$N77.1233528@typ11.nn.bcandid.com>
In article <49431020abnik@pop.onlinehome.de>,
Nik Gare <nik@cheddarcheese.de> wrote:
>opendir('SOH', "$soh") ;
>while (defined($menuitem = <$soh/*>)) {
readdir SOH
>this sort of works, but when I run it on the server it lists the files in the
>root directory.
What is $soh at this point?
> Is there anyway to make perl set the directory (ideally to the
>one where the scripts are run from)?
chdir. But you need to find the name of the directory first.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Fri, 17 Sep 1999 19:50:46 +0100
From: Nik Gare <nik@cheddarcheese.de>
Subject: Re: Setting a directory
Message-Id: <494318b282nik@pop.onlinehome.de>
In article <zBuE3.16721$N77.1233528@typ11.nn.bcandid.com>,
Kragen Sitaker <kragen@dnaco.net> wrote:
> In article <49431020abnik@pop.onlinehome.de>,
> Nik Gare <nik@cheddarcheese.de> wrote:
> >opendir('SOH', "$soh") ;
> >while (defined($menuitem = <$soh/*>)) {
> readdir SOH
Ok
> >this sort of works, but when I run it on the server it lists the files in
> >the root directory.
> What is $soh at this point?
It will either be 'hardware' or 'software' (without '')
> > Is there anyway to make perl set the directory (ideally to the
> >one where the scripts are run from)?
> chdir. But you need to find the name of the directory first.
Is their a way to find the name of the directory using perl?
TTFN
Nik
------------------------------
Date: Fri, 17 Sep 1999 18:16:15 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Telnet scripting in Perl?
Message-Id: <PzvE3.16831$N77.1241239@typ11.nn.bcandid.com>
In article <7rtrqm$lt4$1@cubacola.tninet.se>, WhilBone <no_mail@to.me> wrote:
I'm not going to respond to messages from people whose addresses are
"no_mail@to.me". Neither, I hope, is anyone else.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Fri Sep 17 1999
52 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 17 Sep 1999 18:57:20 GMT
From: morgan@dept.english.upenn.edu (s. morgan friedman)
Subject: timed process
Message-Id: <7ru2ug$j8o$1@netnews.upenn.edu>
hi all! i have a quick question: i'd like my script to
stop a subroutine that's goes for more than 5 seconds
or so. not knowing how to do this, i went first to the
o'reilly book and used their suggested method:
eval {
local $SIG{ALRM} = sub { die "alarm clock restart" };
alarm 5;
flock(FH, 2);
alarm 0;
};
if ($@ and $@ !~ /alarm clock restart/) { die }
&my_subroutine_here;
however, this doesn't seem to stop it, and i'm not
sure what i'm doing wrong. also (related) i'm not
sure what this subroutine is doing, how it works,
so i don't even know how to go about trying to
fix it. i then looked up the pod signal
documentation, but it didn't clarify much...
any ideas? thanks!
morgan
--
______________________
steven morgan friedman
http://www.westegg.com/morgan/
"I have always imagined that paradise will be a kind of library."
"Me figuraba el paraíso bajo la especie de una biblioteca."
------------------------------
Date: Fri, 17 Sep 1999 11:57:58 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: trimming spaces from a string
Message-Id: <MPG.124c2f0e49118341989f97@nntp.hpl.hp.com>
In article <7rti6f$ia7$2@info2.uah.edu> on 17 Sep 1999 14:11:27 GMT,
Greg Bacon <gbacon@itsc.uah.edu> says...
> In article <gaiE3.15578$N77.1165604@typ11.nn.bcandid.com>,
> kragen@dnaco.net (Kragen Sitaker) writes:
>
> : In article <7rrhb2$5g8$1@info2.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:
> :
> : >Such as?
> :
> : [...]
> :
> : Hope this is interesting :)
>
> Sheesh, sorry I asked. :-) I'd be interested in hearing Mr. Rosler's
> comments on the "inferiority" of C<s/\s+//g> in light of this evidence.
I already commented on this issue (though in regard to locale-specific
variations on the contents of /\s/, not Unicode), in
<URL:http://x26.deja.com/getdoc.xp?AN=507436265>. Here are excerpts.
Date: 1999/07/31
In article <slrn7q6m03.i94.abigail@alexandra.delanet.com> on 31 Jul 1999
15:10:12 -0500, Abigail <abigail@delanet.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MMCLX September MCMXCIII in
> <URL:news:MPG.120cec05788c1434989d86@nntp.hpl.hp.com>:
...
> $$ $var =~ tr/ \r\n\t\f/ /s;
> $$
> $$ efficiently converts any sequence of white-space characters into a
> $$ single space.
>
> It isn't "better" in my book, as that would require me to remember what
> characters are whitespace characters. There's a \s in regexes for a reason.
>
> $var =~ s/\s+/ /g;
...
Why not add '\s' (and the other five regex character-class shorthands)
to the SEARCHLIST of tr///? They could each match one character in the
REPLACEMENTLIST. The locale for '\w' and '\W' would be determined when
the tr/// was compiled.
This would certainly conform to the 'principle of least surprise'. And
backward compatibility isn't a problem, because "\X" where 'X' is an
arbitrary letter is *undefined* (not 'X', no matter what a particular
implementation produces). Otherwise new semantics could never be added,
yet they have been. For example, '\z' and others in 5.005 regexes.
> And if that isn't as efficient as tr///, Ilya can put something on his
> TODO list. ;-)
And be as efficient as all the '/cds' variants of tr///?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 17 Sep 1999 20:35:38 +0200
From: Alex Farber <alex@kawo2.rwth-aachen.de>
Subject: Re: What happens with this slice?
Message-Id: <37E289FA.1581BC3A@kawo2.rwth-aachen.de>
Hi Ala,
for some strange reason it works now. But I swear it wasn't
yesterday on my Linux Debian 2.1 PC with Perl 5.004_04.
Maybe it has something to do with DBD::MySQL? Unfortunately
I don't have time to dig deeper - I am glad my script is
working and have to move on. Many thanks for your help...
Regards
Alex
Ala Qumsieh wrote:
> It should work.
>
> % perl -wl
> my $rank = 0;
> my @l;
> srand;
> for my $i (0..15) {
> $l[$i] = { day => rand 100 };
> }
>
> for my $href ((sort { $a->{day} <=> $b->{day} } @l)[0..9]) {
> $href->{rank} = ++$rank;
> print "$href->{rank} $href->{day}";
> }
> __END__
> 1 1.043701171875
> 2 10.77880859375
> 3 12.48779296875
> 4 12.738037109375
> 5 13.5223388671875
> 6 23.08349609375
> 7 24.395751953125
> 8 29.4952392578125
> 9 31.524658203125
> 10 32.9345703125
>
> % perl -v
> This is perl, version 5.004_04 built for sun4-solaris
>
> What is your version of Perl?
------------------------------
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 832
*************************************