[29985] in Perl-Users-Digest
Perl-Users Digest, Issue: 1228 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 24 09:09:43 2008
Date: Thu, 24 Jan 2008 06:09:05 -0800 (PST)
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, 24 Jan 2008 Volume: 11 Number: 1228
Today's topics:
A "deep" hash to/from a file? <none@none.none>
Re: A "deep" hash to/from a file? <damian@tvk.rwth-aachen.de>
Re: A "deep" hash to/from a file? <none@none.none>
Re: A "deep" hash to/from a file? <damian@tvk.rwth-aachen.de>
Re: A "deep" hash to/from a file? <abigail@abigail.be>
Re: A "deep" hash to/from a file? <damian@tvk.rwth-aachen.de>
Re: A "deep" hash to/from a file? <tadmc@seesig.invalid>
Re: Can't Install Perl as Non-Root <ben@morrow.me.uk>
Re: File Monitoring modules nagandla@gmail.com
new CPAN modules on Thu Jan 24 2008 (Randal Schwartz)
Re: Newbie Perl Question <joe@inwap.com>
Problem with Parallel::ForkManager on Windows Vista <jacobcdf@yahoo.com>
Re: Problem with Parallel::ForkManager on Windows Vista <jacobcdf@yahoo.com>
Re: RegEx, how to seperate word from digits? <rvtol+news@isolution.nl>
Re: sorting a list of objects using one of their method <john@castleamber.com>
Re: sorting a list of objects using one of their method <uri@stemsystems.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 24 Jan 2008 07:31:56 GMT
From: Pat <none@none.none>
Subject: A "deep" hash to/from a file?
Message-Id: <Xns9A2F58E4B80Fnone@140.99.99.130>
Hi,
This seems like something that would be a FAQ, but I couldn't find an
answer there.
I would like to build a hash from an input text file. The hash can
contain other hashes, and so on, to any depth. The format of the input
file can be anything that is convenient, e.g.:
---------------------------------
root
{
branch_1
{
sub_branch_1
{
leaf_1 = "This is leaf_1"
leaf_2 = "This is leaf_2"
}
}
branch_2
{
leaf_3 = "This is leaf_3"
}
leaf_4 = "This is leaf_4"
}
---------------------------------
I would like for that input file to generate a hash equivalent to what
this perl code would:
%tree{'root'}{'branch_1'}{'sub_branch_1'}{'leaf_1'} = "This is leaf_1";
%tree{'root'}{'branch_1'}{'sub_branch_1'}{'leaf_2'} = "This is leaf_2";
%tree{'root'}{'branch_2'}{'leaf_3'} = "This is leaf_3";
%tree{'root'}{'leaf_4'} = "This is leaf_4";
As a first attempt, I tried writing a recursive subroutine that would try
to match pairs of open/close curly braces, then call itself on everything
between the braces. But I couldn't get the right amount of "greediness"
in the matching.
Any help appreciated.
Pat
------------------------------
Date: Thu, 24 Jan 2008 09:29:36 +0100
From: Damian Lukowski <damian@tvk.rwth-aachen.de>
Subject: Re: A "deep" hash to/from a file?
Message-Id: <5vr0jhF1nhs5sU1@mid.dfncis.de>
> As a first attempt, I tried writing a recursive subroutine that would try
> to match pairs of open/close curly braces, then call itself on everything
> between the braces. But I couldn't get the right amount of "greediness"
> in the matching.
I think, a recursive descent parser will be the best and easiest way to
do it.
------------------------------
Date: Thu, 24 Jan 2008 08:38:27 GMT
From: Pat <none@none.none>
Subject: Re: A "deep" hash to/from a file?
Message-Id: <Xns9A2F10D6B721Fnone@140.99.99.130>
Damian Lukowski wrote:
> I think, a recursive descent parser will be the best and easiest way
> to do it.
Yeah, I hoped to come up with something like that, but failed to do the job
with a regular expression. The problem is with the nested curly braces.
For example, for the following input string...
a { b { c } d { e } }
If you use non-greedy matching, you get this as your first match:
a { b { c }
... and that is clearly incorrect. But if you use normal greedy matching,
you get this as your first match:
a { b { c } d { e } }
... which is correct, so you recurse on the string between the outermost
braces, which is:
b { c } d { e }
and there, greedy matching fails, because it thinks that you want to parse
this:
c } d { e
... because that is what is inside the outermost braces.
------------------------------
Date: Thu, 24 Jan 2008 10:56:59 +0100
From: Damian Lukowski <damian@tvk.rwth-aachen.de>
Subject: Re: A "deep" hash to/from a file?
Message-Id: <5vr5ncF1movrlU1@mid.dfncis.de>
Pat schrieb:
> Damian Lukowski wrote:
>
>> I think, a recursive descent parser will be the best and easiest way
>> to do it.
>
> Yeah, I hoped to come up with something like that, but failed to do the job
> with a regular expression. The problem is with the nested curly braces.
> For example, for the following input string...
Thats not, how a descent parser works. Simply speaking, if you want to
parse a branch with all subbranches and leafes, you have to check, if
the string begins with "BRANCHNAME {". If so, call a subroutine, which
parses a branch. This subroutine has to check for other branches and
leafes, and finally it has to chop off the closing curly branch.
This may look like as following:
sub parse_branch
{
my $stringref = shift;
my $name;
my @branches = ();
my @leafes = ();
if ($$stringref begins_with "BRANCHNAME {") # Parse "itself"
{
$name = BRANCHNAME;
cut_off_BRANCHNAME_and_curly($$stringref);
} else
{
die "Parse Error";
};
while ($$stringref begins_with(LVALUE_or_BRANCHNAME)
{
if ($$stringref begins_with "LVALUE =") # Parse Leaf.
{
push @leafes, parse_assignment($stringref);
}
elsif ($$stringref begins_with "BRANCHNAME {") # Parse subbranch
{
push @branches, parse_branch($stringref);
}
};
if ($string begins_with "}") # Chop closing brace.
{
cut_off_curly($$stringref);
return new Branch($name, \@branches, \@leafes);
} else
{
die "Parse Error";
}
}
sub parse_assignment { ... }
------------------------------
Date: 24 Jan 2008 10:03:27 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: A "deep" hash to/from a file?
Message-Id: <slrnfpgojf.pb5.abigail@alexandra.abigail.be>
_
Pat (none@none.none) wrote on VCCLIX September MCMXCIII in
<URL:news:Xns9A2F58E4B80Fnone@140.99.99.130>:
:: Hi,
::
:: This seems like something that would be a FAQ, but I couldn't find an
:: answer there.
::
:: I would like to build a hash from an input text file. The hash can
:: contain other hashes, and so on, to any depth. The format of the input
:: file can be anything that is convenient, e.g.:
If it can be anything that is convenient, why not pick a format that
can already be parsed by a module? You might want to store it in the
format of a serializer (for instance YAML or Data::Dumper), a format
used in configuration (Config::General or one of the many other
Config::* modules), or a generic format (for instance XML).
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=>$==-2449231+gm_julian_day+time);do{until($=<$#r){$_.=$r[$#r];$=-=$#r}for(;
!$r[--$#r];){}}while$=;$,="\x20";print+$_=>September=>MCMXCIII=>=>=>=>=>=>=>=>'
------------------------------
Date: Thu, 24 Jan 2008 11:04:11 +0100
From: Damian Lukowski <damian@tvk.rwth-aachen.de>
Subject: Re: A "deep" hash to/from a file?
Message-Id: <5vr64rF1ns8m0U1@mid.dfncis.de>
Sorry, I mixed up return types and the shift. Forget the stringref shift
at the beginning and think of it as a global variable.
> # my $stringref = shift;
> my $name;
> my @branches = ();
> my @leafes = ();
> ...
------------------------------
Date: Thu, 24 Jan 2008 06:03:57 -0600
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: A "deep" hash to/from a file?
Message-Id: <slrnfpgvld.109.tadmc@tadmc30.sbcglobal.net>
Abigail <abigail@abigail.be> wrote:
> _
> Pat (none@none.none) wrote on VCCLIX September MCMXCIII in
><URL:news:Xns9A2F58E4B80Fnone@140.99.99.130>:
>:: Hi,
>::
>:: This seems like something that would be a FAQ, but I couldn't find an
>:: answer there.
>::
>:: I would like to build a hash from an input text file. The hash can
>:: contain other hashes, and so on, to any depth. The format of the input
>:: file can be anything that is convenient, e.g.:
>
> If it can be anything that is convenient, why not pick a format that
> can already be parsed by a module? You might want to store it in the
> format of a serializer (for instance YAML or Data::Dumper),
If the data is really as consistent as the example data, then
running it through these gets it nearly into Data::Dumper format:
s/=/=>/;
s/\{/=> {/;
s/}(\s+)/},$1/;
s/"(\s+)/",$1/;
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Thu, 24 Jan 2008 12:39:14 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Can't Install Perl as Non-Root
Message-Id: <igdm65-hvp.ln1@osiris.mauzo.dyndns.org>
Quoth dawmail333 <Dawmail333@gmail.com>:
> On Jan 24, 2:45 pm, dawmail333 <Dawmail...@gmail.com> wrote:
> > On Jan 24, 2:22 pm, Ben Morrow <b...@morrow.me.uk> wrote:
> > >
> > > --- lib/File/Spec/Unix.pm Thu Jan 24 04:18:08 2008
> > > +++ lib/File/Spec/Unix.pm.cwd Thu Jan 24 04:19:40 2008
> > > @@ -475,7 +475,7 @@
> > > # File::Spec subclasses use this.
> > > sub _cwd {
> > > require Cwd;
> > > - Cwd::getcwd();
> > > + Cwd::cwd();
> > > }
> >
> > That patch didn't work, so I manually changed the line in question.
It applied when it left here (I checked), so your newsreader made a mess
of it somehow.
<snip>
> Sorry, I fixed this problem as well. I have hit another one:
>
> make[1]: Leaving directory `/home/.bazooka/dawliam/perl-5.10.0/ext/
> Digest/SHA'
>
> Making Encode (dynamic)
> opendir(../../lib/../../../..): Permission denied at ../../lib/
> ExtUtils/MakeMake
> r.pm line 182
OK, this is getting silly... one more try, then I'm giving up :).
Ben
--- lib/Cwd.pm Tue Dec 18 10:47:07 2007
+++ lib/Cwd.pm.cwd Thu Jan 24 12:33:29 2008
@@ -501,6 +501,11 @@
sub _perl_abs_path
{
my $start = @_ ? shift : '.';
+
+ # this just returns a path down from /, without attempting to
+ # resolve .. or symlinks. It *may* be sufficient to build perl.
+ return $start =~ m!^/! ? $start : cwd() . '/' . $start;
+
my($dotdots, $cwd, @pst, @cst, $dir, @tst);
unless (@cst = stat( $start ))
------------------------------
Date: Thu, 24 Jan 2008 01:22:57 -0800 (PST)
From: nagandla@gmail.com
Subject: Re: File Monitoring modules
Message-Id: <9f099763-21e4-4656-af6b-174fc3ec429a@l32g2000hse.googlegroups.com>
On Jan 23, 1:59 am, Ted Zlatanov <t...@lifelogs.com> wrote:
> On Mon, 21 Jan 2008 23:29:20 -0800 (PST) nagan...@gmail.com wrote:
>
> n> For monitoring files in directories i am using SGI::FAM module...
> n> this module is monitoring perfectlt but taking more 90% CPU usage
> n> while monitoring ... so any one can suggest me the better module to
> n> monitor the files in directoties....here one more thing i want to
> n> monitor more than a single directory at a time...
>
> It could be a bug in your code. Can you show the code?
>
> Use `top' or something similar to see what's actually using the CPU. Is
> it the FAM daemon or your code? You could be in a busy loop...
>
> Ted
Here is the code to monitor directories using Fam....
use strict;
use warnings;
use SGI::FAM;
my $fam;
my $terminate = 0;
my $path = '/data';
my %interested_dirs = ();
sub today_datetime
{
my($ss,$mi,$hh,$day,$mon,$year) = localtime();
$mon++;
$year+=1900;
my $now = "$year-$mon-$day:$hh:$mi:$ss";
return($now);
}
opendir(DIR,$path);
my @file_s = readdir(DIR);
foreach(@file_s)
{
if ($_ !~ /\.$/)
{
if(-d "$path/$_")
{
# print "$_ <-> $path/$_ \n ";
$interested_dirs{$_} = $path."/".$_ ;
}
}
}
closedir(DIR);
until ($terminate)
{
unless (defined($fam))
{
eval { $fam = new SGI::FAM; };
if ($@)
{
print "Failed to connect to FAMd - starting forcibly...\n\n\n";
system("/usr/local/sbin/famd");
next;
}
die "FAM Failed: $!\n" unless (defined($fam));
foreach (values %interested_dirs)
{
$fam->monitor($_);
#print "$_\n";
}
}
# check for FAM events
if ($fam->pending)
{
my $event;
eval { $event = $fam->next_event; };
if ($@)
{
print "FAM error: rebuilding cache...\n\n\n";
$fam = undef;
next;
}
#print "Received: " . $event->type . " for " . $event->filename .
"\n";
&process_fam_event($event);
}
}
sub process_fam_event
{
my $event = shift;
my $filename = $event->filename;
my $dir = $fam->which($event);
my $now = &today_datetime;
if($event->type eq 'create')
{
if($filename ne $dir)
{
my $subdir = "$dir/$filename";
while(`/usr/sbin/lsof +d $dir | grep "$filename"`)
{
next;
}
if(-d $subdir)
{
print "Creating $subdir \n";
eval { $fam->monitor($subdir); };
if($@)
{
print "Fam Error : Failed to monitor $subdir : $@ \n";
}
}
}
print "Createed--------NewFile : $filename , Dir : $dir $now\n";
}elsif($event->type eq 'delete')
{
if($filename ne $dir)
{
my $subdir = "$dir/$filename";
while(`/usr/sbin/lsof +d $dir | grep "$filename"`)
{
next;
}
if(-d $subdir)
{
print "Deleting $subdir \n";
eval { $fam->cancel($subdir); };
if($@)
{
print "Fam Error : Failed to monitor $subdir : $@ \n";
}
}
}
print "Delete : $filename , Dir : $dir $now\n";
}
}
Nagandla
------------------------------
Date: Thu, 24 Jan 2008 05:42:16 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Jan 24 2008
Message-Id: <Jv4vuG.wK6@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Algorithm-LBFGS-0.10
http://search.cpan.org/~laye/Algorithm-LBFGS-0.10/
Perl extension for L-BFGS
----
Amazon-SimpleDB-0.02
http://search.cpan.org/~tima/Amazon-SimpleDB-0.02/
----
Amazon-SimpleDB-0.03
http://search.cpan.org/~tima/Amazon-SimpleDB-0.03/
a low-level perlish interface for working with Amazon's SimpleDB service.
----
App-TimeTracker-0.07
http://search.cpan.org/~domm/App-TimeTracker-0.07/
Track time spend on projects from the commandline
----
Asterisk-config-0.9
http://search.cpan.org/~hoowa/Asterisk-config-0.9/
the Asterisk config read and write module.
----
Bio-GenBankParser-0.01
http://search.cpan.org/~kclark/Bio-GenBankParser-0.01/
Parse::RecDescent parser for a GenBank record
----
CHI-0.03
http://search.cpan.org/~jswartz/CHI-0.03/
Unified cache interface
----
Cache-Historical-0.02
http://search.cpan.org/~mschilli/Cache-Historical-0.02/
Cache historical values
----
Catalyst-Plugin-Log-Dispatch-0.08
http://search.cpan.org/~shot/Catalyst-Plugin-Log-Dispatch-0.08/
Log module of Catalyst that uses Log::Dispatch
----
CatalystX-CRUD-0.24
http://search.cpan.org/~karman/CatalystX-CRUD-0.24/
CRUD framework for Catalyst applications
----
Class-Autouse-1.99_02
http://search.cpan.org/~adamk/Class-Autouse-1.99_02/
Run-time load a class the first time you call a method in it.
----
Compress-LZMA-External-0.34
http://search.cpan.org/~lbrocard/Compress-LZMA-External-0.34/
Compress and decompress using LZMA
----
DBD-Pg-2.0.0_6
http://search.cpan.org/~turnstep/DBD-Pg-2.0.0_6/
PostgreSQL database driver for the DBI module
----
Data-Rand-Obscure-0.021
http://search.cpan.org/~rkrimen/Data-Rand-Obscure-0.021/
Generate (fairly) random strings easily.
----
HTML-Entities-ConvertPictogramMobileJp-0.01
http://search.cpan.org/~tokuhirom/HTML-Entities-ConvertPictogramMobileJp-0.01/
convert pictogram entities
----
HTML-Entities-ConvertPictogramMobileJp-0.03
http://search.cpan.org/~tokuhirom/HTML-Entities-ConvertPictogramMobileJp-0.03/
convert pictogram entities
----
Hatena-Star-Mobile-0.01
http://search.cpan.org/~jkondo/Hatena-Star-Mobile-0.01/
Perl extension for embedding Hatena Star into mobile sites.
----
Language-Kemuri-0.05
http://search.cpan.org/~tokuhirom/Language-Kemuri-0.05/
Kemuri Interpreter.
----
Lingua-DE-Wortschatz-1.24
http://search.cpan.org/~schroeer/Lingua-DE-Wortschatz-1.24/
wortschatz.uni-leipzig.de webservice client
----
Memcached-libmemcached-0.1309
http://search.cpan.org/~timb/Memcached-libmemcached-0.1309/
Thin fast full interface to the libmemcached client API
----
Memcached-libmemcached-0.1401
http://search.cpan.org/~timb/Memcached-libmemcached-0.1401/
Thin fast full interface to the libmemcached client API
----
MojoMojo-0.999011
http://search.cpan.org/~mramberg/MojoMojo-0.999011/
A Catalyst & DBIx::Class powered Wiki.
----
MooseX-ConfigFromFile-0.02
http://search.cpan.org/~blblack/MooseX-ConfigFromFile-0.02/
An abstract Moose role for setting attributes from a configfile
----
MooseX-Getopt-0.10
http://search.cpan.org/~blblack/MooseX-Getopt-0.10/
A Moose role for processing command line options
----
MooseX-POE-0.05
http://search.cpan.org/~perigrin/MooseX-POE-0.05/
The Illicit Love Child of Moose and POE
----
MooseX-SimpleConfig-0.03
http://search.cpan.org/~blblack/MooseX-SimpleConfig-0.03/
A Moose role for setting attributes from a simple configfile
----
ObjectDBI-0.09
http://search.cpan.org/~kjh/ObjectDBI-0.09/
Perl Object Persistence in an RDBMS using DBI
----
POE-Component-Generic-0.1100
http://search.cpan.org/~gwyn/POE-Component-Generic-0.1100/
A POE component that provides non-blocking access to a blocking object.
----
POE-Component-Server-SimpleSMTP-1.12
http://search.cpan.org/~bingos/POE-Component-Server-SimpleSMTP-1.12/
A simple to use POE SMTP Server.
----
POEIKCdaemon-0.00_04
http://search.cpan.org/~suzuki/POEIKCdaemon-0.00_04/
POE IKC daemon
----
Parley-0.58_17
http://search.cpan.org/~chisel/Parley-0.58_17/
Message board / forum application
----
Perl6-Doc-0.34_2
http://search.cpan.org/~lichtkind/Perl6-Doc-0.34_2/
all useful Perl 6 Docs in your command line
----
Pod-Extract-URI-0.2
http://search.cpan.org/~imalpass/Pod-Extract-URI-0.2/
Extract URIs from POD
----
RRDTool-OO-0.20
http://search.cpan.org/~mschilli/RRDTool-OO-0.20/
Object-oriented interface to RRDTool
----
RRDTool-OO-0.21
http://search.cpan.org/~mschilli/RRDTool-OO-0.21/
Object-oriented interface to RRDTool
----
Sledge-Plugin-PictogramEntities-0.01
http://search.cpan.org/~tokuhirom/Sledge-Plugin-PictogramEntities-0.01/
Pictogram entities filter
----
StateMachine-Statemap-0.01
http://search.cpan.org/~perrad/StateMachine-Statemap-0.01/
----
Swarmage-0.01005
http://search.cpan.org/~dmaki/Swarmage-0.01005/
A Distributed Job Queue
----
Text-MultiMarkdown-1.0.10
http://search.cpan.org/~bobtfish/Text-MultiMarkdown-1.0.10/
Convert MultiMarkdown syntax to (X)HTML
----
Text-MultiMarkdown-1.0.11
http://search.cpan.org/~bobtfish/Text-MultiMarkdown-1.0.11/
Convert MultiMarkdown syntax to (X)HTML
----
Text-Quoted-2.04
http://search.cpan.org/~ruz/Text-Quoted-2.04/
Extract the structure of a quoted mail message
----
Text-Scws-0.01
http://search.cpan.org/~xueron/Text-Scws-0.01/
Perl interface to libscws
----
Tk-WidgetDump-1.37
http://search.cpan.org/~srezic/Tk-WidgetDump-1.37/
dump the widget hierarchie
----
Tk-Wizard-2.135
http://search.cpan.org/~lgoddard/Tk-Wizard-2.135/
GUI for step-by-step interactive logical process
----
WWW-MobileCarrierJP-0.11
http://search.cpan.org/~tokuhirom/WWW-MobileCarrierJP-0.11/
scrape mobile carrier information
----
WebService-CIA-1.4
http://search.cpan.org/~imalpass/WebService-CIA-1.4/
Get information from the CIA World Factbook.
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 23 Jan 2008 22:02:51 -0800
From: Joe Smith <joe@inwap.com>
Subject: Re: Newbie Perl Question
Message-Id: <6audnYOxdbiUtwXanZ2dnUVZ_oytnZ2d@comcast.com>
Bryce wrote:
> if ($destination !eq '' && $origin =~ /mysite\.com\/thisurl\.php/) {
That is not valid perl code.
> I like helping myself and tried my best using tutorials to do this on my own.
> Alas, my attempts have failed. Nothing but 500 server errors. E.g.:
The first thing in getting rid of "500 Server Error": you _MUST_ make sure
the code compiles correctly. Use perl's "-cw" command-line option to test that.
linux% cat test.cgi
if ($destination !eq '' && $origin =~ /mysite\.com\/thisurl\.php/) {
print "OK\n";
}
linux% perl -cw test.cgi
syntax error at test.cgi line 1, near "$destination !"
test.cgi had compilation errors.
linux%
The string inequality operator is "ne" (and also "not $string1 eq $string2").
> was non-existent or null, or if ... didn't contain the case insensitive substring
Case insensitivity is done with "i" after the regex. Since "0" is not a valid URL,
the test for non-null can be done in a more simple fashion.
if ($destination and $origin =~ /\bmysite\.com\/thisurl\.php/i) { ... }
The \b ensures that "foobar123mysite.com/thisurl.php" won't match.
-Joe
------------------------------
Date: Thu, 24 Jan 2008 01:23:46 -0800 (PST)
From: Jacob JKW <jacobcdf@yahoo.com>
Subject: Problem with Parallel::ForkManager on Windows Vista
Message-Id: <bbf53076-9f86-431d-818b-467882d25604@v17g2000hsa.googlegroups.com>
I'm using Parallel::ForkManager to periodically run a number of tasks
in parallel. It seems to work about 90% of the time. What I'm finding
the remaining 10% of the time, however, is that the while the forked
off process disappears from the windows process list, it never seems
to register as completed with the waitpid ()within Perl nor does it
decrement the parent process's thread count in the process list.
I'm aware that fork isn't fully supported really on Windows but maybe
someone's familiar with this issue or is aware of a workaround.
Thanks in advance,
Jacob.
------------------------------
Date: Thu, 24 Jan 2008 04:20:00 -0800 (PST)
From: Jacob JKW <jacobcdf@yahoo.com>
Subject: Re: Problem with Parallel::ForkManager on Windows Vista
Message-Id: <377fb290-6ad5-4d35-b2f3-c250aa24514e@i72g2000hsd.googlegroups.com>
On Jan 24, 4:23 am, Jacob JKW <jacob...@yahoo.com> wrote:
> I'm using Parallel::ForkManager to periodically run a number of tasks
> in parallel. It seems to work about 90% of the time. What I'm finding
> the remaining 10% of the time, however, is that the while the forked
> off process disappears from the windows process list, it never seems
> to register as completed with the waitpid ()within Perl nor does it
> decrement the parent process's thread count in the process list.
I described this poorly.
I should have mentioned that each forked child runs a system command
from which the standard out is being captured. These are the PIDs I'm
seeing on the process list and that are then (correctly)
disappearing. It's the child processes that call them that aren't
terminating (about 10% of the time).
It would appear that if the children don't capture any stdout the
problem I goes away -- the system commands terminate as do the child
processes that called them.
Whatever caused this problem it seems to have something to do with
multiple children all reading from the STDOUT of opened pipes. I can
only assume that this is a known issue with the Windows implementation
of fork.
------------------------------
Date: Thu, 24 Jan 2008 11:28:07 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: RegEx, how to seperate word from digits?
Message-Id: <fn9su0.1co.1@news.isolution.nl>
smallpond schreef:
> kirknew2Reg:
>> I have a column that contains "suite 111" and "suite222"I need a $
>> variable containing the word part and aother $ variable containing
>> the digit part. I have tried variations on this syntax:
>> (\w*)(\d*)(.*)
>> (\w*)(\s?)(\d*)(.*)
>> But nothig I have tried seperates the word from the digits when
>> there is no space. How do i get 'suite222' to brake in to seperate
>> variables?
>
> How about: /([[:alpha:]]*)\s*(\d*)/
To keep up the POSIX-style:
/([[:alpha:]]+)[[:blank:]]*([[:digit:]]+)/
And [[:blank:]] contains less characters that \s.
And [[:alpha:]] can of course be obscured as [^\W\d_].
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 24 Jan 2008 06:10:47 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: sorting a list of objects using one of their methods?
Message-Id: <Xns9A2F1D539D7Acastleamber@130.133.1.4>
Uri Guttman <uri@stemsystems.com> wrote:
>>>>>> "JB" == John Bokma <john@castleamber.com> writes:
>
> JB> Uri Guttman <uri@stemsystems.com> wrote:
> >>>>>>> "FK" == Florian Kaufmann <sensorflo@gmail.com> writes:
> >>
> FK> I can't help you with the error message. I only have an
> >> optimization FK> hint once it is running: If the method call is
> >> not cheap (in terms of FK> runtime) and if its result (per object)
> >> is const during the sort, FK> consider the Schwartzian Transform:
> >> http://en.wikipedia.org/wiki/Schwartzian_transform#History.
> >>
> FK> It only calls the name subroutine once per object, whereas the
> FK> naive approach calls it many many times per object. To be more
> FK> precise, assuming that the complexity of perl's sort is
> >> n*log(n), FK> name would be called log(n) per object.
> >>
> >> nope. name is called once per object and cached which makes it
> >> O(N). it doesn't change the growth curve of sort but factors out
> >> the method call so it is O(N) and not O(N * log N).
>
> JB> I read FK as: naive requires O( log N) get_name calls per
> object. Each JB> comparison does 2 calls, so in total O( N * 2 * log
> N ) = O( N log N).
>
> JB> A simple test I wrote shows for:
>
> JB> 10240 objects, shuffled, naive ~ 248, 086 calls, which is close
> to 10240 JB> x 2 x log 10240.
>
> JB> Of course ST results in 10240 calls exactly.
>
> not to be annoying, what is your point?
Uhm, your reply was unclear to me, it looked (to me) like you and FK
disagreed.
> you generated numbers that
> agreed with my analysis.
Heh, and what I thought all along, but your reply to FK was (again to
me) vague, especially since FK seemed to talk about the naive method in
the end, and you started with "nope. name is called once per object and
cached).
> remember that O() math is about growth rates
> and not about absolute counts.
Heh, teach your grandmother to suck eggs. I have a MSc.
> yes you can save a ton of real world
> work with caching of sort keys but it still won't change the growth
> rate.
That depends on what's going on in the comparison routine, of course
(e.g. imagine get_name being O(N)).
--
John
http://johnbokma.com/mexit/
------------------------------
Date: Thu, 24 Jan 2008 07:27:52 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: sorting a list of objects using one of their methods?
Message-Id: <x7tzl31y4q.fsf@mail.sysarch.com>
>>>>> "JB" == John Bokma <john@castleamber.com> writes:
JB> Uri Guttman <uri@stemsystems.com> wrote:
>>>>>>> "JB" == John Bokma <john@castleamber.com> writes:
>>
JB> Uri Guttman <uri@stemsystems.com> wrote:
>> >>>>>>> "FK" == Florian Kaufmann <sensorflo@gmail.com> writes:
>> >>
FK> I can't help you with the error message. I only have an
>> >> optimization FK> hint once it is running: If the method call is
>> >> not cheap (in terms of FK> runtime) and if its result (per object)
>> >> is const during the sort, FK> consider the Schwartzian Transform:
>> >> http://en.wikipedia.org/wiki/Schwartzian_transform#History.
>> >>
FK> It only calls the name subroutine once per object, whereas the
FK> naive approach calls it many many times per object. To be more
FK> precise, assuming that the complexity of perl's sort is
>> >> n*log(n), FK> name would be called log(n) per object.
^^^^^^^^^^^^^^^^^
>> not to be annoying, what is your point?
JB> Uhm, your reply was unclear to me, it looked (to me) like you and FK
JB> disagreed.
look at the underlined comment from FK. that is what i didn't understand
or agree with. actually looking at it now i think he meant in the normal
sort. his wording wasn't the best IMO.
>> remember that O() math is about growth rates
>> and not about absolute counts.
JB> Heh, teach your grandmother to suck eggs. I have a MSc.
so? you know how many people screw up O() numbers? and i was taught
algorithms by the R of RSA :). and my grandmother made great chicken
soup!
JB> That depends on what's going on in the comparison routine, of course
JB> (e.g. imagine get_name being O(N)).
that of course is not a issue as the higher level sort O(N log N) will swamp
out the work in each method call. you have to consider name() to be a
constant factor for the analysis. sure if the compare is ridiculously
slow (as in something like -M on a file) it could ruin a real world
sort. but this is now way off topic and i will stop. we are not
disagreeing about anything.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Architecture, Development, Training, Support, Code Review ------
----------- Search or Offer Perl Jobs ----- http://jobs.perl.org ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
------------------------------
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 V11 Issue 1228
***************************************