[24766] in Perl-Users-Digest
Perl-Users Digest, Issue: 6919 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 27 00:06:11 2004
Date: Thu, 26 Aug 2004 21:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 26 Aug 2004 Volume: 10 Number: 6919
Today's topics:
Can't locate object method ... utf8_heavy.pl <bmb@ginger.libs.uga.edu>
Re: exit(), die, ?? (Tony McGuire)
Re: exit(), die, ?? (Tony McGuire)
Re: HTML::Parser <zebee@zip.com.au>
Re: HTML::Parser <zebee@zip.com.au>
Re: Larry Wall & Cults <justme@fakedomain.net>
Re: Larry Wall & Cults <reynirhs@mi.is>
Re: Larry Wall & Cults <reynirhs@mi.is>
Mystery with Files with loop (Rob L)
Net::Ping::External doesn't honor timeout or count (Stuart Kendrick)
Re: no re 'eval' not secure enough <mb@uq.net.au.invalid>
Re: Parsing FileName for upload (Tony McGuire)
Re: Parsing FileName for upload <tore@aursand.no>
Re: performance surprise -- why? ctcgag@hotmail.com
Re: performance surprise -- why? <abigail@abigail.nl>
Re: performance surprise -- why? <uri@stemsystems.com>
Re: performance surprise -- why? <haltingNOSPAM@comcast.net>
seeking Perl hackers to contribute to CGI Calendar (Jay Eckles)
Re: seeking Perl hackers to contribute to CGI Calendar <nospam@bigpond.com>
Re: Xah Lee's Unixism <spam@mouse-potato.com>
Re: Xah Lee's Unixism (Otto Wyss)
Re: Xah Lee's Unixism <ktilton@nyc.rr.com>
Re: XML::Parser error <ebohlman@omsdev.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 26 Aug 2004 18:27:16 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Can't locate object method ... utf8_heavy.pl
Message-Id: <Pine.A41.4.58.0408261751230.49076@ginger.libs.uga.edu>
Hello,
This is perl, v5.6.1 built for sun4-solaris.
I'm getting the following error:
Can't locate object method "ToLower" via package "main" (perhaps you
forgot to load "main"?) at /usr/local/lib/perl5/5.6.1/utf8_heavy.pl line
30.
I've narrowed it down to this line (in a much longer program):
lc $term;
where $term eq 'id aarl001-003 ' (as far as I've been able to determine).
I'm not able to duplicate this error with a short program, so I feel it
must have to do with modules I've used. But I'm having a heck of a time
tracking it down. I'll show more code if it will help, but I'm wondering
if this is a familiar situation and might have a simple explanation.
I've looked at perldoc -f lc, the perllocale manpage, the utf8 manpage,
and google groups, and I've done various experiments, but I've gotten to
where I'm just shooting in the dark, I'm afraid.
Can anyone provide some hints how I might track this down?
Thanks,
Brad
------------------------------
Date: 26 Aug 2004 15:51:46 -0700
From: tony@paradoxcommunity.com (Tony McGuire)
Subject: Re: exit(), die, ??
Message-Id: <f896a829.0408261451.417547bd@posting.google.com>
"Paul Lalli" <mritty@gmail.com> wrote in message news:<1RpXc.15136
> You should always make an attempt before asking if it's possible. You clearly
> already know that the way to end a script is with either exit() or die() (based
> on the subject of your post). So what happened when you tried putting exit() or
> die() inside an if block?
>
> Paul Lalli
I tried 'die' several times based on example code I found.
I always got 'premature end of script headers' as a error. Looking at
the logs the error pointed to the 'die' section.
I came to the conclusion that the examples were incomplete, and so I
needed to ask about 'die'.
However, if 'exit(1)' will return the contents of previous 'print'
statements, it would be much preferred.
I'll give both another go.
------------------------------
Date: 26 Aug 2004 15:54:57 -0700
From: tony@paradoxcommunity.com (Tony McGuire)
Subject: Re: exit(), die, ??
Message-Id: <f896a829.0408261454.57e649db@posting.google.com>
"Paul Lalli" <mritty@gmail.com> wrote in message news:<1RpXc.15136$IO1.1808@trndny03>...
>
> You should always make an attempt before asking if it's possible. You clearly
> already know that the way to end a script is with either exit() or die() (based
> on the subject of your post). So what happened when you tried putting exit() or
> die() inside an if block?
>
> Paul Lalli
I went back and set up a print statement followed by exit(1);
And it worked exactly as I hoped. Haven't tried die again, but I
assume I had some other error in those previous attempts. I should
have tested exit, yes, but nothing I read indicated you could use it
in the main script to stop and return to the user.
Thanks, Paul. At least your post indicated that it should work. :)
------------------------------
Date: Fri, 27 Aug 2004 01:38:53 GMT
From: Zebee Johnstone <zebee@zip.com.au>
Subject: Re: HTML::Parser
Message-Id: <slrncit3qt.vll.zebee@zeus.zipworld.com.au>
In comp.lang.perl.misc on Thu, 26 Aug 2004 07:46:55 +0200
Tassilo v. Parseval <tassilo.von.parseval@rwth-aachen.de> wrote:
>
>
> <http://www.unisolve.com.au/perlmeme/tutorials/html_parser.html>
>
> will help you. It deals with the old interface (subclassing) which I
> find more convenient and easier to use.
Thanks!
Zebee
------------------------------
Date: Fri, 27 Aug 2004 02:47:23 GMT
From: Zebee Johnstone <zebee@zip.com.au>
Subject: Re: HTML::Parser
Message-Id: <slrncit7rb.2nn.zebee@zeus.zipworld.com.au>
In comp.lang.perl.misc on Thu, 26 Aug 2004 07:46:55 +0200
Tassilo v. Parseval <tassilo.von.parseval@rwth-aachen.de> wrote:
>
> <http://www.unisolve.com.au/perlmeme/tutorials/html_parser.html>
I understand more now about it, but your tutorial doesn't cover the
text, which I need.
If I print out all the text elements:
sub text {
my($self, $origtext, $is_cdata) = @_;
print "text [$origtext] \n";
}
then I get the text associated with the tags I'm after, but I get a lot
of other text as well.
Is there a way to associate the tag text with the tag, and only
use that?
So a bit of HTML
<a href="http://www.google.com"> Google </a> would have "Google"
associated with "http://www.google.com"?
ideally, I'd like to call the text subroutine from the start subroutine,
and pass it a hash to put the text value in. And have it return that
hash.
It isn't clear to me what items the start subroutine knows about that
it can pass to the text subroutine. IN the examples, it seems to use
(text => [], '@{dtext}' ) as args to the text handler, but I've no
idea where those come from at all, or what they are, or how to use them.
I have the "$self" object, which I can pass to a subroutine but no idea
how to get the things I need from it.
Zebee
------------------------------
Date: Thu, 26 Aug 2004 23:47:39 GMT
From: MPB <justme@fakedomain.net>
Subject: Re: Larry Wall & Cults
Message-Id: <opsdc5ppi854150k@pls026981.mw.nos.boeing.com>
Who let that idiot back in?
On 25 Aug 2004 14:56:06 -0700, Xah Lee <xah@xahlee.org> wrote:
> Larry Wall and Cults
> (Lazyness, Impatience and Hubris)
...
> Xah
> xah@xahlee.org
> http://xahlee.org/PageTwo_dir/more.html
------------------------------
Date: Fri, 27 Aug 2004 02:11:04 +0000
From: Reynir Stefánsson <reynirhs@mi.is>
Subject: Re: Larry Wall & Cults
Message-Id: <jh5ti01keef8ov2kjpdg0hp9nfi0oj45ma@4ax.com>
So spake Rich Teer:
>On Wed, 25 Aug 2004, Xah Lee wrote:
>
>> Did you know that throughout history there's this thing called cult?
>
>I think you're getting confused with the Blue Öyster Cult.
>Don't Fear the Reaper - great song.
And then there's this crazy little thing called love...
--
Reynir Stefánsson (reynirhs@mi.is)
------------------------------
Date: Fri, 27 Aug 2004 02:11:05 +0000
From: Reynir Stefánsson <reynirhs@mi.is>
Subject: Re: Larry Wall & Cults
Message-Id: <oo5ti0t2cq6j7hflie1al5pals2c2tpr7d@4ax.com>
So spake R Baumann:
>
>"Xah Lee" <xah@xahlee.org> wrote in message
>news:7fe97cc4.0408251356.34f2102a@posting.google.com...
>> Larry Wall and Cults
>> (Lazyness, Impatience and Hubris)
>> 200012
>>
><BIG SNIP>
>
>In this context --- This is the STUPIDEST thing I've ever heard. What a
>maroon! What a Trollup!
Well, wasn't it lwall that said: "All language designers are arrogant.
Comes with the territory."?
--
Reynir Stefánsson (reynirhs@mi.is)
------------------------------
Date: 26 Aug 2004 19:43:02 -0700
From: lindsey_rob@hotmail.com (Rob L)
Subject: Mystery with Files with loop
Message-Id: <e9c11771.0408261843.1de902c2@posting.google.com>
I have a program that I have written to read a few files for
information and then takes some of that information and puts the data
into arrays based on certain things. What I did was to run this
program out of CRON on a Unix system every few mins. I figured out
today that I needed this job to almost continuously so I added a while
loop to the code and was testing it to see how it would work. Well
what I found out is that after the arrays are created I write the data
to a "temp" file and then copy/move the data file to the real name the
data is appending to the "real" file instead of replacing it.
Psuodeo code...
while ( !-e $stopfile) {
read data file
read other data file
get info from data
check and put data into correct array
close other data file
close data file
write array data to temp file
copy or move temp file to real file
end while
The copy or move temp file is appending the data to the real file. If
I just run it once it works great it is on the second go around (and
so on) that it is appending the data. I have been kicking this thing
around for a while. Its not the prettiest code but its what I have.
The reason for the copy/move is because there is other processes that
read the "real" file and I do not want those other processes to miss
any data if they read the file while its building.
Below is my real code...
use POSIX qw(setsid);
use POSIX; #For date format function.
use File::Copy;
use File::Find;
use Shell qw(ps netstat grep);
$IMPACT = $ENV{"IMPACT"}
$OWBASE = $ENV{"OWBASE"}; #Path to /cnet
$DATA = $ENV{"DATA"};
$BSMworkDir = "$OWBASE" . "/Ofwr.sys";
$workDir = "$OWBASE";
# $workoutdir = "/opt/" . "$DATA" . "/misc/intranet_data/";
$workoutdir = "$OWBASE" . "intranet_data/";
$u = "~";
$stopfile = "$OWBASE" .
"Ofwr.sys/get_conn_status_daemon.stop";
$runningfile = "$OWBASE" .
"Ofwr.sys/get_conn_status_daemon.running";
$daemonLogFile = "$OWBASE" .
"Ofwr.sys/get_conn_status_daemon.LOG";
while ( !-e $stopfile ) {
&doIt();
print "sleeping...\n";
sleep 60;
}
if ( -e $runningfile ) {
unlink $runningfile;
}
exit;
sub doIt {
open(RUNFILE, "> $runningfile");
print RUNFILE "$$\n";
close RUNFILE;
getpendings(); # get a listing of pending transactions for each
AIM
# from the hash fileHash
open(BSMTAB, "< $BSMworkDir" . "/bsmtab") or
die "\nCan\'t open BSMTAB: $!\n";
while ($line = <BSMTAB>) { #Read and output each line of
bsmtab.
# get first character
($firchar,$aimname) = split(/:/, $line);
if ( $firchar eq "R" ) {
$firthree = substr($aimname, 0, 3);
if ( $firthree eq "sfm" ) { next }
if ( ! -e "$workDir" . "$aimname" ) { next }
$grepdm = "\"dm \"";
$grepmsgsrv = "\"msgsrv \"";
$dmoutput = ps("-fu $aimname -x | grep $grepdm");
if ( $dmoutput ne "" ) {
$aimstatus = "Up"
} else {
$aimstatus = "Down"
}
$msgoutput = ps("-fu $aimname -x | grep $grepmsgsrv");
$aimprefix = substr($aimname, 0, 1); #Get the 'a' or 'd'
from aimnam
e
@flist = ("dgsfmaim.cfg", "aaconfig.cfg", "agswpaim.cfg",
"daconfig.
cfg");
foreach $file (@flist) {
$pathToOpen = "$workDir" . "$aimname" . "/desktop/" .
"$file";
if ( -e $pathToOpen ) {
$fileToOpen = $pathToOpen;
}
}
open(CONFIG, "< $fileToOpen") or die "\nCan\'t open
CONFIG: $!\n";
$port = "";
$ref = "";
while ($cline = <CONFIG>) {
@pieces = split(/=/,$cline);
$cline = lc($cline); ;# make sure the line is
lowercase
$firfour = substr($cline, 0, 4);
if ( $firfour eq 'port') {
$port = $pieces[1];
$port =~ s/^\s+//; #Get rid of leading spaces.
$port =~ s/\n//; #Get rid of newline chars.
}
if ( $firfour eq "refe" ) {
$ref = $pieces[1];
$ref =~ s/^\s+//; #Get rid of leading spaces.
$ref =~ s/\n//; #Get rid of newline chars.
}
if ( $firfour eq "regi" ) {
$aimreg = lc($pieces[1]);
$aimreg =~ s/^\s+//; #Get rid of leading
spaces.
$aimreg =~ s/\n//; #Get rid of newline chars.
$aimreg =~ s/\r//; #Get rid of carriage return
chars.
}
}
close CONFIG;
if ( $ref =~ /SFM/ ) { next }
$xlogpath = "$workDir" . "$aimname" . "/desktop/xlog*";
$xlogfile = "$workDir" . "$aimname" . "/desktop/xlog";
if ( $aimprefix eq "a" ) {
$xsearch = "Data received";
$aimtype = "Acq.";
$lastsnd = "N/A";
$lastrec = "Unknown";
} elsif ( $aimprefix eq "d" ) {
$xsearch = "Sending this data";
$aimtype = "Del.";
$lastsnd = "Unknown";
$lastrec = "N/A";
} else {
$xsearch = "";
$aimtype = "";
}
if ( $xsearch ne "" && -e $xlogfile ) {
$xcmd = "grep -h \"$xsearch\" $xlogpath \| sort |";
open(XGREP, $xcmd);
@xgrep = <XGREP>;
close(XGREP);
$xlast = $xgrep[$#xgrep];
if ( $xlast ne "" ) {
($xdate,$xhr,$xmin,$xsec) = split(/:/,$xlast);
($xyr,$xmth,$xday) = split(/\//,$xdate);
$xdate = "$xmth\/$xday";
($xsec,$xmill) = split(/\./,$xsec);
if ( $aimprefix eq "a" ) {
$lastrec = "$xdate $xhr:$xmin:$xsec";
} elsif ( $aimprefix eq "d" ) {
$lastsnd = "$xdate $xhr:$xmin:$xsec";
} else {
}
}
}
if ( $aimprefix eq "d" && $lastsnd eq "Unknown" ) {
$lastidPath = "$workDir" . "$aimname" . "/desktop/";
$foundfile = "";
find(\&Wanted, $lastidPath);
if ( $foundfile ne "" ) {
$lastidfile = $lastidPath . $foundfile;
if ( -e $lastidfile ) {
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mt
ime,$ctime,$blksize,$blocks) = stat($lastidfile);
($sec,$min,$hour,$mday,$mon,$year,$weekday,$yearday,$isd
st) = localtime($mtime);
$mon = ($mon+1); # Month starts from 0, e.g.
Jan is 0
$year = ($year + 1900);
$year = substr($year,2,2);
$time =
sprintf("%02d:%02d:%02d",$hour,$min,$sec);
$fmmddyy = "$mon/$mday $time";
$lastsnd = $fmmddyy;
}
}
}
%cstatus = (
'ESTABLISHED','Up',
'LISTEN','Opening'
);
if ($port ne "") {
$type = "Port";
# $port = "\" $port\"";
$connline = netstat("-an | grep $port");
@conpieces = split(/\s+/,$connline);
$connstatus = $conpieces[5];
$connstatus = $cstatus{$connstatus};
if ( $connstatus eq "" ) {
$connstatus = "Sleeping";
}
} else {
$type = "File";
$connstatus = "Up";
}
$aimpending = $fileHash{$aimname}[1];
if ( $aimpending eq "" ) {
$aimpending = 0;
}
if ( $aimpending > 0 && $msgoutput ne "" ) {
$connstatus = "Refused";
$xsearch = "wrong dest";
if ( $xsearch ne "" && -e $xlogfile ) {
$xcmd = "grep -h \"$xsearch\" $xlogpath\| sort |";
open(XGREP, $xcmd);
@xgrep = <XGREP>;
close(XGREP);
$xlast = $xgrep[$#xgrep];
if ( $xlast ne "" ) {
$connstatus = "BadFlavor";
}
}
}
if ( $aimstatus =~ "Down" ) {
$connstatus = "Down";
}
$outline = "$aimname$u$aimstatus$u$ref$u$type$u$connstatus$u$lastrec$u$lasts
nd$u$aimpending$u$aimreg$u$aimtype$u";
$outData{"$aimname"} = $outline;
if ( $aimreg eq "central" ) {
push(@central, $aimname);
} elsif ( $aimreg eq "east" ) {
push(@east, $aimname);
} elsif ( $aimreg eq "west" ) {
push(@west, $aimname);
} else {
push(@unknown, $aimname);
}
if ( $aimpending > 0 || ($connstatus ne "Sleeping" &&
$connstatus ne
"Opening" && $connstatus ne "Up") ) {
if ( $aimreg eq "central" ) {
push(@prob_central, $aimname);
} elsif ( $aimreg eq "east" ) {
push(@prob_east, $aimname);
} elsif ( $aimreg eq "west" ) {
push(@prob_west, $aimname);
} else {
push(@prob_unk, $aimname);
}
}
} ;# end of if ( $firchar eq "R" )
} ;# end of while ($line = <BSMTAB>)
close BSMTAB;
$source = "$workoutdir" . "conn_status_data.beforecopy";
$dest = "$workoutdir" . "conn_status_data.txt";
open(CONNFILE, "> $source") or
die "\nCan\'t open the output file: $!\n";
foreach $aim (@east) {
print CONNFILE "$outData{$aim}\n";
}
foreach $aim (@central) {
print CONNFILE "$outData{$aim}\n";
}
foreach $aim (@west) {
print CONNFILE "$outData{$aim}\n";
}
foreach $aim (@unknown) {
print CONNFILE "$outData{$aim}\n";
}
close CONNFILE;
# @args = ("mv", "$source", "$dest");
# system(@args) == 0 or die "system @args failed: $?";
# $mvCmd="mv $source $dest";
# print "mvCmd == $mvCmd\n";
# unlink $source;
# move("$source","$dest");
$output = `mv $source $dest`;
print "output == $output\n";
$psource = "$workoutdir" . "problem_conn_status_data.beforecopy";
$pdest = "$workoutdir" . "problem_conn_status_data.txt";
open(PROBFILE, "> $psource") or
die "\nCan\'t open the output file: $!\n";
foreach $aim (@prob_east) {
print PROBFILE "$outData{$aim}\n";
}
foreach $aim (@prob_central) {
print PROBFILE "$outData{$aim}\n";
}
foreach $aim (@prob_west) {
print PROBFILE "$outData{$aim}\n";
}
foreach $aim (@prob_unk) {
print PROBFILE "$outData{$aim}\n";
}
close PROBFILE;
# @args = ("mv", "$psource", "$pdest");
# system(@args) == 0 or die "system @args failed: $?";
# $mvCmd="mv $psource $pdest";
# print "mvCmd == $mvCmd\n";
# system("$mvCmd");
# unlink $psource;
# move("$psource","$pdest");
$output = `mv $psource $pdest`;
print "output == $output\n";
}
sub Wanted {
/archive/ and $File::Find::prune = 1;
next if ( $_ !~ /lastid/);
$foundfile = $_;
}
Thanks in advance for any help.
------------------------------
Date: 26 Aug 2004 19:53:13 -0700
From: skendric@fhcrc.org (Stuart Kendrick)
Subject: Net::Ping::External doesn't honor timeout or count
Message-Id: <62dbf7f1.0408261853.6ecf59bb@posting.google.com>
hi,
i'm using Net::Ping::External to do my pings. i would like to fiddle
with its 'timeout' and 'count' parameters ... but i don't seem to be
able to. no matter how i set them, i get the same results: a timeout
of 10 seconds and a count of 1.
#!/usr/bin/perl
use strict;
use warnings;
use Net::Ping::External qw(ping);
my @hosts = qw/140.107.200.250 140.107.200.251 140.107.200.252/;
for my $host (@hosts) {
if (ping ( hostname => $host,
timeout => '1',
count => '1'
)
) {
print "$host is alive\n";
}
else {
print "$host is dead\n";
}
}
i've replicated this issue in the following environments:
perl-5.8.5, Net-Ping-External-v0.11, SuSE 9.1
perl-5.8.3, Net-Ping-External-v0.11, SuSE 8.2
has anyone else seen this issue?
--sk
stuart kendrick
fhcrc
------------------------------
Date: Fri, 27 Aug 2004 13:38:49 +1000
From: Matthew Braid <mb@uq.net.au.invalid>
Subject: Re: no re 'eval' not secure enough
Message-Id: <cgmacc$82$1@bunyip.cc.uq.edu.au>
Matthew Braid wrote:
> Not really a question, more of a pointer....
>
> Now that RE's can contain executable code (via the experimental (?{...}) and a few others) it is no longer safe to accept an RE as an argument (either to a program or to a subroutine), since it could, for instance, have:
>
> (?{system("rm -rf /")})
>
> buried in it.
<snip>
Oh crap, sorry about that - when I'm thinking about a problem I'll often write
up a message as if I was trying to explain it to someone else (I've found this
often leads me to the answer) and then, if I've figured it out myself (or I've
figured out I'm wrong - as was the case here) I hit cancel, and if I'm still
lost I hit send. I must have accidentally hit send for this one.... whoops.
In this case I was looking for holes in the idea of 'securing' an object's data
through a my'd hash inside the package keyed on an instance's stringification
(eg Object::Child=SCALAR(0x813221c)) and I thought that maybe an eval inside an
RE might be able to access that. After testing I found they can't. That's when I
was supposed to hit cancel instead of send :)
Sorry again,
MB
------------------------------
Date: 26 Aug 2004 15:39:42 -0700
From: tony@paradoxcommunity.com (Tony McGuire)
Subject: Re: Parsing FileName for upload
Message-Id: <f896a829.0408261439.48259f2a@posting.google.com>
Tore Aursand <tore@aursand.no> wrote in message
> No. Please don't thank me, as I was severely wrong. :) I think I must
Well, I've had people post from Linux using Opera.
Using the previous methodology the filename got parsed out.
Using File::Basename everything worked as I would hope.
And it still works from IE and Mozilla on Windows.
The stuff I was able to find about fileparse() stated:
"If you haven't called fileparse_set_fstype(), the syntax is chosen by
examining the osname entry from the Config package according to these
rules."
So it appears that fileparse() is correctly identifying at least
Windows and Linux.
I don't know the % of other systems that are likely to use this
utility, but it will be VERY small. The only one that might be worth
identifying specifically is 'Mac'.
And if what I am saying is wrong, I am more than willing to hear why
and adjust things if I can.
------------------------------
Date: Fri, 27 Aug 2004 03:27:56 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: Parsing FileName for upload
Message-Id: <pan.2004.08.27.01.27.55.716980@aursand.no>
On Thu, 26 Aug 2004 20:20:00 +0000, ctcgag wrote:
>> No. Please don't thank me, as I was severely wrong. :) I think I must
>> have been thinking "backwards" or something, 'cause File::Basename will
>> only work (correctly) for the server OS (ie. not the client's OS, which
>> is the important part here).
> I'm not sure that that is so important. I assume that he is using the
> basename as the basis of a filename to store the file locally. In that
> case, the most important thing is probably that the basename that you
> obtain doesn't contain things that are directory separators on the
> server's filesystem. Whether or not they are separators on the client's
> filesystem is probably of lesser importance.
I guess the OP want to preserve only the filename part of the (eventual)
full path sent from the client.
Thus, one have to know what OS (and maybe browser) the client is using, as
far as I can understand from the OP's post.
Does anyone have - or know of - a list of OS'es and their path separators?
I'm only familiar with '/', '\' and ':'.
With thst in mind, one could try something (...) like this:
if ( $filename =~ m,(.+[/|\\|:])?(.+)$, ) {
$filename = $2;
}
else {
die "'$filename' doesn't seem to be a valid filename!\n";
}
--
Tore Aursand <tore@aursand.no>
"What we do is never understood, but only praised and blamed."
(Friedrich Nietzsche)
------------------------------
Date: 26 Aug 2004 22:13:41 GMT
From: ctcgag@hotmail.com
Subject: Re: performance surprise -- why?
Message-Id: <20040826181341.114$gO@newsreader.com>
Joe Davison <haltingNOSPAM@comcast.net> wrote:
> Here's one weirdness!
>
> use English;
aha!
perldoc English
...
PERFORMANCE
This module can provoke sizeable inefficiencies for regular expres-
sions, due to unfortunate implementation details. If performance
matters in your application and you don't need $PREMATCH, $MATCH,
or $POSTMATCH, try doing
use English qw( -no_match_vars ) ;
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 26 Aug 2004 23:00:29 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: performance surprise -- why?
Message-Id: <slrncisqsd.q3p.abigail@alexandra.abigail.nl>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMXIII
September MCMXCIII in <URL:news:cglkg8$bmd$1@mamenchi.zrz.TU-Berlin.DE>:
~~ Joe Davison <haltingNOSPAM@comcast.net> wrote in comp.lang.perl.misc:
~~
~~ [shortened]
~~
~~ > Here's one weirdness!
~~ >
~~ > use English;
~~ >
~~ > I created a file with 400_000 chars from the big file I use, to ease
~~ > comparison with Anno's original.
~~ >
~~ > Here's the output form Anno's script on my system:
~~ > globmatch 204/s
~~ >
~~ > Here's the output from my current version, without "Use English;"
~~ > globmatch 184/s
~~ >
~~ > And here's the output from my current versin, with "Use English;"
~~ > globmatch 8.00/s
~~
~~ "Performance surprise" indeed. Something is dreadfully wrong there.
~~ The only reason that hasn't come up earlier is because nobody uses
~~ the English module. Well, sorry, almost nobody :)
~~
~~ Time for a serious bug fix. Or to deprecate "English" officially.
Or one could just read the manual page. From 'man English':
PERFORMANCE
This module can provoke sizeable inefficiencies for regu
lar expressions, due to unfortunate implementation
details. If performance matters in your application and
you don't need $PREMATCH, $MATCH, or $POSTMATCH, try doing
use English qw( -no_match_vars ) ;
Abigail
--
perl -wle'print"Êõóô áîïôèåò Ðåòì Èáãëåò"^"\x80"x24'
------------------------------
Date: Thu, 26 Aug 2004 23:51:18 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: performance surprise -- why?
Message-Id: <x7sma9qx11.fsf@mail.sysarch.com>
>>>>> "A" == Abigail <abigail@abigail.nl> writes:
A> Or one could just read the manual page. From 'man English':
A> PERFORMANCE
A> This module can provoke sizeable inefficiencies for regu
A> lar expressions, due to unfortunate implementation
A> details. If performance matters in your application and
A> you don't need $PREMATCH, $MATCH, or $POSTMATCH, try doing
A> use English qw( -no_match_vars ) ;
and as damian conway says (and i agree) they chose the wrong default for
that option. it should have been -use_match_vars and the default for
english should be to not alias them.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Fri, 27 Aug 2004 02:57:32 GMT
From: Joe Davison <haltingNOSPAM@comcast.net>
Subject: Re: performance surprise -- why?
Message-Id: <m2oekxi8yv.fsf@Jupiter.local>
On Thu, 26 Aug 2004, Uri Guttman wrote:
> >>>>> "A" == Abigail <abigail@abigail.nl> writes:
>
> A> Or one could just read the manual page. From 'man English':
>
> A> PERFORMANCE
> A> This module can provoke sizeable inefficiencies for
> A> regu lar expressions, due to unfortunate
> A> implementation details. If performance matters in
> A> your application and you don't need $PREMATCH,
> A> $MATCH, or $POSTMATCH, try doing
>
> A> use English qw( -no_match_vars ) ;
>
> and as damian conway says (and i agree) they chose the wrong default
> for that option. it should have been -use_match_vars and the default
> for english should be to not alias them.
>
> uri
Certainly true; mea culpa. I suppose one could spend all ones time
RTFMing and never run into such problems :-)
So, say I do use English qw( -no_match_vars). I presume I'd still be
able to use the non-english versions to access the match variables,
should the need arise? RTFM, aye.
I wonder, is it even possible to read all the documentation in a single
lifetime, assuming, say, one were to be paid to read it, so it didn't
interfere with earning a living. Maybe today, but as we work to
improve the documentation, it will surely become impossible.
Not surprisingly, modifying Anno's original program to use English, and again
to use English qw( -no_match_vars ) successfully demonstrates the point.
Thanks for the help. I think I'll spend some time understanding
Benchmark better -- it certainly seems to be useful.
joe
------------------------------
Date: 26 Aug 2004 18:12:52 -0700
From: j.eckles@computer.org (Jay Eckles)
Subject: seeking Perl hackers to contribute to CGI Calendar
Message-Id: <f98fc400.0408261712.384ef2@posting.google.com>
Seven years ago I introduced a program called CGI Calendar, an
open-source Perl/CGI calendar program (licensed under GPL). Since
then I have maintained it mostly myself, with a few enhancements added
here and there by interested users.
I am looking to make a major push to expand the functionality and ease
of use of CGI Calendar, so I have established it as a project on
SourceForge.Net. I am looking for any Perl programmers who might be
interested in contributing their talents to the project.
To learn more about CGI Calendar and view a demo, go to
http://www.jayeckles.com/calendar/cgicalendar.html. To view the
SourceForge.Net summary for the project, go to
http://sourceforge.net/projects/cgicalendar.
This is a good opportunity for experienced programmers who want to
join a project where they can make major contributions. This is also
a good opportunity for less experienced programmers who would like to
learn more about Perl and hone their skills.
Some of the features that I'd like to see developed include:
- Installation and Configuration programs for specific OS/web server
platforms
- Advanced scheduling features like repeating events, multiple
calendars merged into a single view, two-day, week, two-week, and year
views, etc.
- A number of UI "skins" or "themes" that take advantage of the
existing HTML and CSS template structure.
- Support for various SQL databases
- Synchronization with other scheduling systems like Palm Datebook,
Lotus Notes, and MS Outlook
If you're interested in joining the project, please email me. Better
yet, head over to the SourceForge.Net project summary page
(http://sourceforge.net/projects/cgicalendar), view the "Help Wanted"
ads, and send me a message through SourceForge.
I look forward to working with you!
Thanks,
Jay
www.jayeckles.com
------------------------------
Date: Fri, 27 Aug 2004 11:46:43 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: seeking Perl hackers to contribute to CGI Calendar
Message-Id: <2p7i46Fi3jpoU1@uni-berlin.de>
Jay Eckles wrote:
> Seven years ago I introduced a program called CGI Calendar, an
> open-source Perl/CGI calendar program (licensed under GPL). Since
> then I have maintained it mostly myself, with a few enhancements added
> here and there by interested users.
>
> I am looking to make a major push to expand the functionality and ease
> of use of CGI Calendar, so I have established it as a project on
> SourceForge.Net. I am looking for any Perl programmers who might be
> interested in contributing their talents to the project.
>
<snip>
It looks good. You might want to look at how I've implemented the mouseover
"popups" on this site I'm developing:
http://www.ipo-australia.com/scgi-bin/beta/calendar.cgi
To go off at a tangent, I've been thinking about developing a Perl cgi based
"life planning tool", incorporating strategies (life goals) and tactics
(todo" list). It needs a cgi calendar component as well.
gtoomey
------------------------------
Date: 27 Aug 2004 03:36:37 +0200
From: Pascal Bourguignon <spam@mouse-potato.com>
Subject: Re: Xah Lee's Unixism
Message-Id: <87hdqptl96.fsf_-_@thalassa.informatimago.com>
otto.wyss@orpatec.ch (Otto Wyss) writes:
> Xah Lee <xah@xahlee.org> wrote:
>
> > this earth. Two things are on the top of my agenda: Unixism and Perl.
> >
> What you mean with Unixism?
It's always funny to observe people's contradictions:
Last week i bought a chain saw with a
twisted handle. Perhaps i wasn't
careful, but by accident it chopped one
of my arm off, then i thought to myself
"gosh, this is POWERFUL!". This seems to
be the fashionable mode of thinking
among the unixers or unixer-to-be, who
would equate power and flexibility with
rawness and complexity; disciplined by
repeated accidents. Such a tool would
first chop off the user's brain, molding
a mass of brainless imbeciles and
microcephalic charlatans the likes of
Larry Wall and Linus Torvald jolly
asses. --Xah Lee
$ telnet xahlee.org 80;
Trying 208.186.130.4...
Connected to xahlee.org.
Escape character is '^]'.
GET / HTTP/1.1
HTTP/1.1 400 Bad Request
Date: Fri, 27 Aug 2004 01:35:52 GMT
Server: Apache/2.0.50 (Fedora)
^^^^^^^^^^^^^^^^^^^^^^
--
__Pascal Bourguignon__ http://www.informatimago.com/
Our enemies are innovative and resourceful, and so are we. They never
stop thinking about new ways to harm our country and our people, and
neither do we.
------------------------------
Date: Fri, 27 Aug 2004 04:05:00 +0200
From: otto.wyss@orpatec.ch (Otto Wyss)
Subject: Re: Xah Lee's Unixism
Message-Id: <1gj5s4z.f922mx140xaiiN%otto.wyss@orpatec.ch>
Pascal Bourguignon <spam@mouse-potato.com> wrote:
> > What you mean with Unixism?
>
> It's always funny to observe people's contradictions:
>
>
> Last week i bought a chain saw with a
> twisted handle. Perhaps i wasn't
> careful, but by accident it chopped one
> of my arm off, then i thought to myself
> "gosh, this is POWERFUL!". This seems to
> be the fashionable mode of thinking
> among the unixers or unixer-to-be, who
Thanks, for the clarification. For a none native English it's sometimes
difficult to grasp the underlying meaning. And do I understand it right
that Xah Lee _speaks_ against "Unixism" instead of producing code?
Well then I may point at "wyoism", the cult of the code producer.
;-)
O. Wyss
--
How to enhance your code, see "http://freshmeat.net/projects/wxguide/"
------------------------------
Date: Fri, 27 Aug 2004 03:51:28 GMT
From: Kenny Tilton <ktilton@nyc.rr.com>
Subject: Re: Xah Lee's Unixism
Message-Id: <4dyXc.25792$Ot3.22106@twister.nyc.rr.com>
Pascal Bourguignon wrote:
> otto.wyss@orpatec.ch (Otto Wyss) writes:
>
>
>>Xah Lee <xah@xahlee.org> wrote:
>>
>>
>>>this earth. Two things are on the top of my agenda: Unixism and Perl.
>>>
>>
>>What you mean with Unixism?
>
>
> It's always funny to observe people's contradictions:
>
>
> Last week i bought a chain saw with a
> twisted handle. Perhaps i wasn't
> careful, but by accident it chopped one
> of my arm off, then i thought to myself
> "gosh, this is POWERFUL!". This seems to
> be the fashionable mode of thinking
> among the unixers or unixer-to-be, who
> would equate power and flexibility with
> rawness and complexity; disciplined by
> repeated accidents. Such a tool would
> first chop off the user's brain, molding
> a mass of brainless imbeciles and
> microcephalic charlatans the likes of
> Larry Wall and Linus Torvald jolly
> asses. --Xah Lee
>
>
> $ telnet xahlee.org 80;
> Trying 208.186.130.4...
> Connected to xahlee.org.
> Escape character is '^]'.
> GET / HTTP/1.1
>
> HTTP/1.1 400 Bad Request
> Date: Fri, 27 Aug 2004 01:35:52 GMT
> Server: Apache/2.0.50 (Fedora)
> ^^^^^^^^^^^^^^^^^^^^^^
So you like my approach, which is to condemn things they have never used?
:)
kenny
--
Cells? Cello? Celtik?: http://www.common-lisp.net/project/cells/
Why Lisp? http://alu.cliki.net/RtL%20Highlight%20Film
------------------------------
Date: 26 Aug 2004 22:34:30 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: XML::Parser error
Message-Id: <Xns9551B39FAB7EFebohlmanomsdevcom@130.133.1.4>
nsf470@yahoo.com (pj) wrote in
news:11711ebf.0408261248.46d5f1c5@posting.google.com:
> Hi, I am getting the following error
> ----------------------------------------------------------------
> not well-formed (invalid token) at line 1, column 0, byte 0 at
> /vdt/perl/lib/i386-linux-thread-multi/XML/Parser.pm line 187
> ----------------------------------------------------------------
> when I tried to parse the XML file using XML::Parse::EasyTree
>
> The xml file I am trying to parse looks like
"Looks like" or "is"?
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <!DOCTYPE GANGLIA_XML [
> <GANGLIA_XML VERSION="2.5.5" SOURCE="gmetad">
> ....
>
> and I have no idea why it's complaining about the line 1, which is
> <?xml version="1.0" encoding="ISO-8859-1"?>
No it isn't; that's line 0. What comes after isn't well-formed, since a
plain start tag isn't allowed inside an internal DTD subset.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 6919
***************************************