[28168] in Perl-Users-Digest
Perl-Users Digest, Issue: 9532 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 27 18:05:51 2006
Date: Thu, 27 Jul 2006 15:05:09 -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, 27 Jul 2006 Volume: 10 Number: 9532
Today's topics:
Bug in Perl Profiler? <simon.chao@fmr.com>
Re: Bug in Perl Profiler? <simon.chao@fmr.com>
Re: Bug in Perl Profiler? xhoster@gmail.com
Re: Bug in Perl Profiler? xhoster@gmail.com
Re: Bug in Perl Profiler? <simon.chao@fmr.com>
Re: Bug in Perl Profiler? xhoster@gmail.com
Re: DirHandle : the sort is different on Windows and on <m@remove.this.part.rtij.nl>
Re: garbage collector <bik.mido@tiscalinet.it>
getopts::std <nmrabinovich@gmail.com>
Re: getopts::std usenet@DavidFilmer.com
Re: getopts::std <mritty@gmail.com>
Re: getopts::std <mritty@gmail.com>
Re: getopts::std usenet@DavidFilmer.com
Re: Perl 6 <rvtol+news@isolution.nl>
Re: Text descriptions of signal codes? allenjo5@mail.northgrum.com
Re: Text descriptions of signal codes? <benmorrow@tiscali.co.uk>
The "proper name" for the series: foo, bar, etc usenet@DavidFilmer.com
Re: The "proper name" for the series: foo, bar, etc <xicheng@gmail.com>
Re: The "proper name" for the series: foo, bar, etc <bik.mido@tiscalinet.it>
Re: The "proper name" for the series: foo, bar, etc usenet@DavidFilmer.com
Re: The "proper name" for the series: foo, bar, etc <benmorrow@tiscali.co.uk>
Tricky regex (exclude some multiple characters) <tinthaut@hotmail.com>
Re: Tricky regex (exclude some multiple characters) <noreply@gunnar.cc>
Re: Tricky regex (exclude some multiple characters) <David.Squire@no.spam.from.here.au>
Re: Tricky regex (exclude some multiple characters) <David.Squire@no.spam.from.here.au>
Re: Tricky regex (exclude some multiple characters) usenet@DavidFilmer.com
Re: Tricky regex (exclude some multiple characters) usenet@DavidFilmer.com
Re: Tricky regex (exclude some multiple characters) <xicheng@gmail.com>
Re: Tricky regex (exclude some multiple characters) <syscjm@gwu.edu>
Re: Tricky regex (exclude some multiple characters) <tinthaut@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 27 Jul 2006 12:30:41 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Bug in Perl Profiler?
Message-Id: <1154028641.550477.59010@75g2000cwc.googlegroups.com>
It seems that something about the way the Perl profiler gathers
information from my script is breaking my code. The errors are
inconsistent, both in type, and location.:
bash-3.00$ alias
alias prof='perl -d:DProf'
alias tmon='dprofpp'
bash-3.00$
bash-3.00$ prof fork_titan.pl
Not a CODE reference at /export/home/a352626/titanapp/bin/fork_tools.pl
line 17, <$fh> line 755.
total processing time: 0.745739
## here is fork_tools.pl line 17
my $parsed_sHdr = parse_header( $shdr_ref, 'sHdr' );
...
sub parse_header {
my ( $header, $source ) = @_;
my $hdr = $$header;
# I think this may be the culprit, but why did it work without the
profiler
# and why does it die at different lines?
$hdr =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
...
# Success!! without Profiler
bash-3.00$ fork_titan.pl
total processing time: 173.586135
bash-3.00$ prof fork_titan.pl
Argument "main::get_facs" isn't numeric in subroutine entry at
fork_titan.pl line 66, <$fh> line 762.
Not a CODE reference at fork_titan.pl line 66, <$fh> line 762.
total processing time: 0.748186
## here is line 66
my $row_facs_ref = get_facs($FAC_FIELD,
$fields[$FAC_FIELD], \%index);
### and the sub
sub get_facs {
my ($field, $hdr, $index) = @_;
my $prefix = $field == $index->{chdr} ? 'CHDR: ' : 'SHDR: ';
if ($prefix eq 'CHDR') {
$hdr = substr($hdr, index($hdr, 'Cookie:%20'), index($hdr,
'%0d%0a%0d%0a'));
}
my %token;
# Grab the FC, SC, and MC from the header and store it in a hash
while ($hdr =~ m/(?<=%20)([FSM]C)=(?>([^;%\ ]+))(?:[;%\ ]|$)/g) {
$token{$1} = $2;
}
return \%token;
}
bash-3.00$ prof fork_titan.pl
Argument "main::get_fac_field_source" isn't numeric in subroutine entry
at fork_titan.pl line 63, <$fh> line 764.
Not a CODE reference at fork_titan.pl line 63, <$fh> line 764.
total processing time: 0.766146
bash-3.00$
## line 63
my $FAC_FIELD = get_fac_field_source(\%index,
$fields[$index{'shdr'}], $fields[$index{'chdr'}]);
### sub
sub get_fac_field_source {
my ($index, $sHdr, $cHdr) = @_;
# NOTE: assumption is that there will never be FC's or SC's without
an MC
return $index->{'shdr'} if index( $sHdr, '%20MC=' ) != -1;
return $index->{'chdr'} if index( $cHdr, '%20MC=' ) != -1;
return -1;
}
------------------------------
Date: 27 Jul 2006 12:59:03 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Re: Bug in Perl Profiler?
Message-Id: <1154030343.117292.165690@s13g2000cwa.googlegroups.com>
it_says_BALLS_on_your forehead wrote:
> It seems that something about the way the Perl profiler gathers
> information from my script is breaking my code. The errors are
> inconsistent, both in type, and location.:
>
> bash-3.00$ alias
> alias prof='perl -d:DProf'
> alias tmon='dprofpp'
> bash-3.00$
>
> bash-3.00$ prof fork_titan.pl
> Not a CODE reference at /export/home/a352626/titanapp/bin/fork_tools.pl
> line 17, <$fh> line 755.
> total processing time: 0.745739
>
> ## here is fork_tools.pl line 17
> my $parsed_sHdr = parse_header( $shdr_ref, 'sHdr' );
>
> ...
> sub parse_header {
> my ( $header, $source ) = @_;
>
> my $hdr = $$header;
>
> # I think this may be the culprit, but why did it work without the
> profiler
> # and why does it die at different lines?
> $hdr =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg;
>
> ...
>
> # Success!! without Profiler
> bash-3.00$ fork_titan.pl
> total processing time: 173.586135
>
> bash-3.00$ prof fork_titan.pl
> Argument "main::get_facs" isn't numeric in subroutine entry at
> fork_titan.pl line 66, <$fh> line 762.
> Not a CODE reference at fork_titan.pl line 66, <$fh> line 762.
> total processing time: 0.748186
>
> ## here is line 66
> my $row_facs_ref = get_facs($FAC_FIELD,
> $fields[$FAC_FIELD], \%index);
>
> ### and the sub
> sub get_facs {
> my ($field, $hdr, $index) = @_;
>
> my $prefix = $field == $index->{chdr} ? 'CHDR: ' : 'SHDR: ';
>
> if ($prefix eq 'CHDR') {
> $hdr = substr($hdr, index($hdr, 'Cookie:%20'), index($hdr,
> '%0d%0a%0d%0a'));
> }
>
> my %token;
>
> # Grab the FC, SC, and MC from the header and store it in a hash
> while ($hdr =~ m/(?<=%20)([FSM]C)=(?>([^;%\ ]+))(?:[;%\ ]|$)/g) {
> $token{$1} = $2;
> }
>
> return \%token;
> }
>
> bash-3.00$ prof fork_titan.pl
> Argument "main::get_fac_field_source" isn't numeric in subroutine entry
> at fork_titan.pl line 63, <$fh> line 764.
> Not a CODE reference at fork_titan.pl line 63, <$fh> line 764.
> total processing time: 0.766146
> bash-3.00$
>
> ## line 63
> my $FAC_FIELD = get_fac_field_source(\%index,
> $fields[$index{'shdr'}], $fields[$index{'chdr'}]);
>
> ### sub
> sub get_fac_field_source {
> my ($index, $sHdr, $cHdr) = @_;
>
> # NOTE: assumption is that there will never be FC's or SC's without
> an MC
> return $index->{'shdr'} if index( $sHdr, '%20MC=' ) != -1;
> return $index->{'chdr'} if index( $cHdr, '%20MC=' ) != -1;
>
> return -1;
> }
Here's the Perl build info:
bash-3.00$ perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0)
configuration:
Platform:
osname=aix, osvers=5.2.0.0, archname=aix-thread-multi
uname='aix rocky 2 5 000ad7df4c00 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc_r', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT
-q32 -D_LARGE_FILES -qlonglong',
optimize='-O',
cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT'
ccversion='', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='ld', ldflags =' -brtl -b32'
libpth=/lib /usr/lib /usr/ccs/lib
libs=-lbind -lnsl -ldbm -ldl -lld -lm -lpthreads -lc_r -lcrypt
-lbsd -lPW
perllibs=-lbind -lnsl -ldl -lld -lm -lpthreads -lc_r -lcrypt -lbsd
-lPW
libc=/lib/libc.a, so=a, useshrplib=true, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags='
-bE:/usr/opt/perl5/lib/5.8.0/aix-thread-multi/CORE/perl.exp'
cccdlflags=' ', lddlflags='-bhalt:4 -bM:SRE
-bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -bnoentry -lpthreads -lc_r'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Built under aix
Compiled at Jul 26 2002 13:48:15
------------------------------
Date: 27 Jul 2006 20:29:19 GMT
From: xhoster@gmail.com
Subject: Re: Bug in Perl Profiler?
Message-Id: <20060727163611.653$vG@newsreader.com>
"it_says_BALLS_on_your forehead" <simon.chao@fmr.com> wrote:
> It seems that something about the way the Perl profiler gathers
> information from my script is breaking my code. The errors are
> inconsistent, both in type, and location.:
>
> bash-3.00$ alias
> alias prof='perl -d:DProf'
> alias tmon='dprofpp'
> bash-3.00$
>
> bash-3.00$ prof fork_titan.pl
Based on the name of your program, I seems likely that it forks. It would
not suprise me at all if forking and DProf were incompatible and led
to bizarre behavior. Any chance you can create a dummy program without
forking and profile that?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 27 Jul 2006 20:41:34 GMT
From: xhoster@gmail.com
Subject: Re: Bug in Perl Profiler?
Message-Id: <20060727164826.965$va@newsreader.com>
"it_says_BALLS_on_your forehead" <simon.chao@fmr.com> wrote:
>
> Here's the Perl build info:
> bash-3.00$ perl -V
> Summary of my perl5 (revision 5.0 version 8 subversion 0)
I'd recommend testing on a newer subversion.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 27 Jul 2006 14:25:40 -0700
From: "it_says_BALLS_on_your forehead" <simon.chao@fmr.com>
Subject: Re: Bug in Perl Profiler?
Message-Id: <1154035540.108359.74370@h48g2000cwc.googlegroups.com>
xhoster@gmail.com wrote:
> "it_says_BALLS_on_your forehead" <simon.chao@fmr.com> wrote:
> > It seems that something about the way the Perl profiler gathers
> > information from my script is breaking my code. The errors are
> > inconsistent, both in type, and location.:
> >
> > bash-3.00$ alias
> > alias prof='perl -d:DProf'
> > alias tmon='dprofpp'
> > bash-3.00$
> >
> > bash-3.00$ prof fork_titan.pl
>
> Based on the name of your program, I seems likely that it forks. It would
> not suprise me at all if forking and DProf were incompatible and led
> to bizarre behavior. Any chance you can create a dummy program without
> forking and profile that?
Good suggestion, I hadn't thought of that. Will do it when time permits
and post the info. Thanks Xho.
------------------------------
Date: 27 Jul 2006 21:51:32 GMT
From: xhoster@gmail.com
Subject: Re: Bug in Perl Profiler?
Message-Id: <20060727175825.575$zm@newsreader.com>
"it_says_BALLS_on_your forehead" <simon.chao@fmr.com> wrote:
> xhoster@gmail.com wrote:
> > "it_says_BALLS_on_your forehead" <simon.chao@fmr.com> wrote:
> > > It seems that something about the way the Perl profiler gathers
> > > information from my script is breaking my code. The errors are
> > > inconsistent, both in type, and location.:
> > >
> > > bash-3.00$ alias
> > > alias prof='perl -d:DProf'
> > > alias tmon='dprofpp'
> > > bash-3.00$
> > >
> > > bash-3.00$ prof fork_titan.pl
> >
> > Based on the name of your program, I seems likely that it forks. It
> > would not suprise me at all if forking and DProf were incompatible and
> > led to bizarre behavior. Any chance you can create a dummy program
> > without forking and profile that?
>
> Good suggestion, I hadn't thought of that. Will do it when time permits
> and post the info. Thanks Xho.
I ran a simple forking program under 5.8.0 and 5.8.8, with and without
DProf. I never saw the "not a CODE ref" error, but I did see some instances
in which the *child* process seg-faulted. Segfaults only occured under
5.8.0 and then only in conjunction with DProf. (Could the error messages
you saw be coming from a child?) Anyway, I'd recommend an upgrade.
Xho
use Parallel::ForkManager;
my $p=Parallel::ForkManager->new(3);
## print if exit status, signal, or core dump are not zero.
$p->run_on_finish( sub { print "@_\n" if $_[1] or $_[3] or $_[4]});
sub foo {
my $x;
$x+=rand() foreach 1..1000;
return $x/1000
};
foreach (1..1_000_000) {
$p->start and next;
my $x=foo();
$p->finish;
};
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Thu, 27 Jul 2006 21:37:04 +0200
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: DirHandle : the sort is different on Windows and on Linux
Message-Id: <pan.2006.07.27.19.37.04.623810@remove.this.part.rtij.nl>
On Thu, 27 Jul 2006 13:13:06 +0000, John W. Krahn wrote:
> thierry.torret@st.com wrote:
>> I use a old Perl script using Dirhandle but the sort is different on
>> Windows and on Linux
>>
>> $dh = new DirHandle($test) || return;
>> while ($OneFile = $dh->read()) {
>>
>> In Windows the directory and files are sorted by name : it is OK
>> but on Linux there are sorted in order of directory
>> creation/modification date but we want it by name.
>
> The DirHandle module is just an OO wrapper around Perl's built-in
> opendir/readdir/rewinddir/closedir functions and these functions do not do any
> sorting. If you want the results sorted you will have to do it yourself.
>
> perldoc -f sort
Or use globbing.
for my $OneFile (glob($test)) {
M4
--
Redundancy is a great way to introduce more single points of failure.
------------------------------
Date: 27 Jul 2006 21:26:13 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: garbage collector
Message-Id: <ds2ic29q8aig3evsc27nc0cujge2ft6qga@4ax.com>
On Thu, 27 Jul 2006 15:44:28 GMT, "A. Sinan Unur"
<1usa@llenroc.ude.invalid> wrote:
>> Then, again looking at your code, it seems that there must be another
>> error other than the one on line 17.
>
>C'mon Michele, the error is always on line 42, even if there is no line
>42. Let's not break with tradition ;-))
I thought that *the answer* is always on line 42, and also happens to
be 42, even if there is no line 42.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 27 Jul 2006 11:38:42 -0700
From: "lnatz" <nmrabinovich@gmail.com>
Subject: getopts::std
Message-Id: <1154025522.187058.315850@p79g2000cwp.googlegroups.com>
I am trying to use Getopts::Std to make switches, some with arguments.
This is a piece of code from my overall script. UsageAndDie is a sub
created earlier in the script. If I don't use any switches, usageAndDie
is suppose to execute and print a warning. No matter what I do, even if
I don't use any switches UsageAndDie never works. And if I do use a
switch, lets say I use F to make a configuration file, $configFile is
not defined. I don't know what the problem is.
getopts('F:S:D:T:I:plen', \%OPTS);
$configFile = uc$OPTS{F};
$dbserver = uc$OPTS{S};
$database = uc$OPTS{D};
$table_name = uc$OPTS{T};
$purging_item = uc$OPTS{I};
$logical_delete = $OPTS{p};
$distinct_users = $OPTS{l};
$existing_users = $OPTS{e};
$nonexisting_users = $OPTS{n};
print "getting to use and die\n";
usageAndDie if (!defined $configFile
|| (!defined $dbserver
&& !defined $database
&& !defined $table_name
&& !defined $purging_item)) ;
------------------------------
Date: 27 Jul 2006 11:53:48 -0700
From: usenet@DavidFilmer.com
Subject: Re: getopts::std
Message-Id: <1154026428.570187.237130@h48g2000cwc.googlegroups.com>
lnatz wrote:
> $configFile = uc$OPTS{F};
> usageAndDie if (!defined $configFile ...
$configFile (and other variables) ARE defined. They might happen to be
null, though. A variable may be defined but null (false).
Just leave off the "defined" functions and it should work as you
expect.
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 27 Jul 2006 11:56:48 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: getopts::std
Message-Id: <1154026608.477802.43450@i42g2000cwa.googlegroups.com>
lnatz wrote:
> I am trying to use Getopts::Std to make switches, some with arguments.
> This is a piece of code from my overall script. UsageAndDie is a sub
> created earlier in the script. If I don't use any switches, usageAndDie
> is suppose to execute and print a warning. No matter what I do, even if
> I don't use any switches UsageAndDie never works
"never works" is a horrible error description. *How* does it --- oh
screw it. I've posted this rant more times than I can count. Google
search for my name plus "does not work", and you'll find it.
Here's a short-but-complete script (which, by the way, you didn't
bother to provide) which will show you why your subroutine will never
be called with your code:
$ perl -MData::Dumper -e'
$x = undef;
$X = uc $x;
print Dumper(\$x, \$X);
'
$VAR1 = \undef;
$VAR2 = \'';
>. And if I do use a
> switch, lets say I use F to make a configuration file, $configFile is
> not defined.
As shown above, that's simply not true, as $configFile can't *not* be
defined with the code you gave us. Unless you actually meant
"$configFile does not contain the value I expect." And if that's the
case, I instinctively question how you actually used this flag on the
command line. Of course, you didn't show us that, either...
> I don't know what the problem is.
I do. You haven't read or followed the posting guidelines for this
group.
[code retained for posterity]
> getopts('F:S:D:T:I:plen', \%OPTS);
>
> $configFile = uc$OPTS{F};
> $dbserver = uc$OPTS{S};
> $database = uc$OPTS{D};
> $table_name = uc$OPTS{T};
> $purging_item = uc$OPTS{I};
> $logical_delete = $OPTS{p};
> $distinct_users = $OPTS{l};
> $existing_users = $OPTS{e};
> $nonexisting_users = $OPTS{n};
> print "getting to use and die\n";
>
> usageAndDie if (!defined $configFile
> || (!defined $dbserver
> && !defined $database
> && !defined $table_name
> && !defined $purging_item)) ;
Paul Lalli
------------------------------
Date: 27 Jul 2006 12:00:08 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: getopts::std
Message-Id: <1154026808.603336.88290@i3g2000cwc.googlegroups.com>
use...@DavidFilmer.com wrote:
> lnatz wrote:
> > $configFile = uc$OPTS{F};
>
> > usageAndDie if (!defined $configFile ...
>
> $configFile (and other variables) ARE defined. They might happen to be
> null, though. A variable may be defined but null (false).
Please don't use the word "null" when talking about Perl to beginners.
"null" has no meaning in Perl. Variables are either defined or not
defined. If they are defined, they may be the empty string, or zero,
or the string containing zero. All of those three defined values, plus
the undefined value are false. Any other value is true.
Paul Lalli
------------------------------
Date: 27 Jul 2006 12:05:02 -0700
From: usenet@DavidFilmer.com
Subject: Re: getopts::std
Message-Id: <1154027102.483350.239750@75g2000cwc.googlegroups.com>
Paul Lalli wrote:
> Please don't use the word "null" when talking about Perl to beginners.
You're right. I should have said "empty." Or, maybe, "ain't got
nuthin' in it"
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Thu, 27 Jul 2006 20:15:49 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Perl 6
Message-Id: <eab6u2.ks.1@news.isolution.nl>
IanW schreef:
> How is this progressing - anyone know when it's due to be released?
Within 6 months from Christmas.
Perl 6 is here Today!
http://pugs.blogs.com/talks/yapcna-deploy-perl6.pdf
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 27 Jul 2006 11:17:42 -0700
From: allenjo5@mail.northgrum.com
Subject: Re: Text descriptions of signal codes?
Message-Id: <1154024262.187253.235940@m73g2000cwd.googlegroups.com>
A. Sinan Unur wrote:
> use Config;
> use List::MoreUtils 'first_index';
>
> my $sig_idx = first_index { $_ == 24 } split / /, $Config{sig_num};
> if ( $sig_idx >= 0 ) {
> my @sig_name = split / /, $Config{sig_name};
> print $sig_name[$sig_idx], "\n";
> }
Yes, that will get me "SIGXCPU" but I was looking for an english
description like "cpu time limit exceeded". Sorry if I wasn't clear
about that. I guess parsing signal.h isn't so bad...
------------------------------
Date: Thu, 27 Jul 2006 20:03:41 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: Text descriptions of signal codes?
Message-Id: <d9fnp3-ivs.ln1@osiris.mauzo.dyndns.org>
Quoth allenjo5@mail.northgrum.com:
>
> A. Sinan Unur wrote:
>
> > use Config;
> > use List::MoreUtils 'first_index';
> >
> > my $sig_idx = first_index { $_ == 24 } split / /, $Config{sig_num};
> > if ( $sig_idx >= 0 ) {
> > my @sig_name = split / /, $Config{sig_name};
> > print $sig_name[$sig_idx], "\n";
> > }
>
> Yes, that will get me "SIGXCPU" but I was looking for an english
> description like "cpu time limit exceeded". Sorry if I wasn't clear
> about that. I guess parsing signal.h isn't so bad...
At least on my system, this stuff isn't in signal.h. You need to read
the sys_siglist array. I wrote a tiny XS module to do just that, which I
guess I could upload to CPAN if that would help you...
A major problem (IMHO) is that there is no way of i18ning[0] these things.
Ben
--
I've seen things you people wouldn't believe: attack ships on fire off
the shoulder of Orion; I watched C-beams glitter in the dark near the
Tannhauser Gate. All these moments will be lost, in time, like tears in rain.
Time to die. benmorrow@tiscali.co.uk
------------------------------
Date: 27 Jul 2006 11:49:56 -0700
From: usenet@DavidFilmer.com
Subject: The "proper name" for the series: foo, bar, etc
Message-Id: <1154026196.718932.218000@h48g2000cwc.googlegroups.com>
Nathan Torkington (whose name should be familiar to those who own a
copy of The Perl Cookbook) was MC for the OSCON keynote addresses
yesterday morning. In one of his comments (as an aside, really), he
mentioned the familiar "throwaway" variable series foo, bar, etc, but
he identified this series by a name that I was not familiar with (and
he suggested there was a "proper" order for the series - I usually see
"baz" as the third term, but Nate said something else).
I can't remember the term he used (and I'm not even sure I heard it
correctly). Does someone know the name of this series? I'm curious...
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 27 Jul 2006 12:14:54 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: The "proper name" for the series: foo, bar, etc
Message-Id: <1154027694.070516.291590@75g2000cwc.googlegroups.com>
usenet@DavidFilmer.com wrote:
> Nathan Torkington (whose name should be familiar to those who own a
> copy of The Perl Cookbook) was MC for the OSCON keynote addresses
> yesterday morning. In one of his comments (as an aside, really), he
> mentioned the familiar "throwaway" variable series foo, bar, etc, but
> he identified this series by a name that I was not familiar with (and
> he suggested there was a "proper" order for the series - I usually see
> "baz" as the third term, but Nate said something else).
>
> I can't remember the term he used (and I'm not even sure I heard it
> correctly). Does someone know the name of this series? I'm curious...
check this out:
http://www.answers.com/topic/metasyntactic-variable
Xicheng
------------------------------
Date: 27 Jul 2006 21:42:18 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: The "proper name" for the series: foo, bar, etc
Message-Id: <tj5ic21tfcev4u5e8f9hlll0ia5kn57r1s@4ax.com>
On 27 Jul 2006 11:49:56 -0700, usenet@DavidFilmer.com wrote:
>yesterday morning. In one of his comments (as an aside, really), he
>mentioned the familiar "throwaway" variable series foo, bar, etc, but
>he identified this series by a name that I was not familiar with (and
A good starting point would be the jargon file. See:
http://catb.org/jargon/html/F/foo.html
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 27 Jul 2006 12:56:00 -0700
From: usenet@DavidFilmer.com
Subject: Re: The "proper name" for the series: foo, bar, etc
Message-Id: <1154030160.287001.68390@i3g2000cwc.googlegroups.com>
Xicheng Jia wrote:
> check this out:
>
> http://www.answers.com/topic/metasyntactic-variable
Yes, that is it, thanks (and thanks also, Michele). The term that
Nathan used was, indeed, "metasyntactic variable." Apparently (if I
understood correctly) our good Mr. Torkington also subscribes to the
MIT variation of the series which drops "baz" (making the third term
"quux" which I don't think I've ever seen before).
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: Thu, 27 Jul 2006 20:08:47 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: The "proper name" for the series: foo, bar, etc
Message-Id: <vifnp3-ivs.ln1@osiris.mauzo.dyndns.org>
Quoth usenet@DavidFilmer.com:
> Nathan Torkington (whose name should be familiar to those who own a
> copy of The Perl Cookbook) was MC for the OSCON keynote addresses
> yesterday morning. In one of his comments (as an aside, really), he
> mentioned the familiar "throwaway" variable series foo, bar, etc, but
> he identified this series by a name that I was not familiar with (and
> he suggested there was a "proper" order for the series - I usually see
> "baz" as the third term, but Nate said something else).
>
> I can't remember the term he used (and I'm not even sure I heard it
> correctly). Does someone know the name of this series? I'm curious...
They're generally called 'metasyntactic variables': see
http://catb.org/jargon/html/F/foo.html .
Ben
--
Giles: It's very common for Indian spirits to change to animal form.
Buffy: [...] and, 'Native American'. G: Sorry? B: We don't say 'Indian'.
G: Oh, right, yes; always behind on the terms... yes, still trying not to refer
to you lot as 'bloody colonials'. [Buffy, 'Pangs'] benmorrow@tiscali.co.uk
------------------------------
Date: 27 Jul 2006 13:44:37 -0700
From: "Uncle_Fester" <tinthaut@hotmail.com>
Subject: Tricky regex (exclude some multiple characters)
Message-Id: <1154033077.626906.77120@s13g2000cwa.googlegroups.com>
I want to test for "things that look more or less like real English
words" from parsed hypertext.
I know that
while ($text =~ /([A-Za-z0-9_\'\-]+)/g )
will catch most of what I want most of the time.
The tricky bit is this :
How might I allow 'oo' and 'ee' and not 'ff' or '--' ?
How might I exclude patterns like '_________' or '010101010101' ?
Any thoughts?
------------------------------
Date: Thu, 27 Jul 2006 22:48:06 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Tricky regex (exclude some multiple characters)
Message-Id: <4isn68F5bqisU1@individual.net>
Uncle_Fester wrote:
> How might I allow 'oo' and 'ee' and not 'ff' or '--' ?
What do you have against such stuff?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Thu, 27 Jul 2006 21:51:39 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Tricky regex (exclude some multiple characters)
Message-Id: <eab90r$soo$1@gemini.csx.cam.ac.uk>
Uncle_Fester wrote:
> I want to test for "things that look more or less like real English
> words" from parsed hypertext.
>
> I know that
>
> while ($text =~ /([A-Za-z0-9_\'\-]+)/g )
Why the capturing parens? Why + as well as g?
>
> will catch most of what I want most of the time.
>
> The tricky bit is this :
>
> How might I allow 'oo' and 'ee' and not 'ff' or '--' ?
> How might I exclude patterns like '_________' or '010101010101' ?
>
> Any thoughts?
>
I don't know that you can do this in one regex. One approach would be to
use a dictionary (and an interface such as Lingua::Ispell).
A quick and dirty approach would be to do a second test that rejects
anything that contains too many non-alphabetic characters (say 2?), e.g.
(non-tested):
my $num_non-alpha = () = $text =~ m/[0-9_'-]/g; # I don't think that '
or - are special in regexex
next if $num_non-alpha > 2;
DS
------------------------------
Date: Thu, 27 Jul 2006 21:52:45 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Tricky regex (exclude some multiple characters)
Message-Id: <eab92t$soo$2@gemini.csx.cam.ac.uk>
David Squire wrote:
> Uncle_Fester wrote:
>> I want to test for "things that look more or less like real English
>> words" from parsed hypertext.
>>
>> I know that
>>
>> while ($text =~ /([A-Za-z0-9_\'\-]+)/g )
>
> Why the capturing parens? Why + as well as g?
>>
>> will catch most of what I want most of the time.
>>
>> The tricky bit is this :
>>
>> How might I allow 'oo' and 'ee' and not 'ff' or '--' ?
>> How might I exclude patterns like '_________' or '010101010101' ?
>>
>> Any thoughts?
>>
>
> I don't know that you can do this in one regex. One approach would be to
> use a dictionary (and an interface such as Lingua::Ispell).
>
> A quick and dirty approach would be to do a second test that rejects
> anything that contains too many non-alphabetic characters (say 2?), e.g.
> (non-tested):
>
> my $num_non-alpha = () = $text =~ m/[0-9_'-]/g; # I don't think that '
> or - are special in regexex
> next if $num_non-alpha > 2;
... and of course you can do a similar thing to exclude things such as
invalid repeated chars...
------------------------------
Date: 27 Jul 2006 13:56:27 -0700
From: usenet@DavidFilmer.com
Subject: Re: Tricky regex (exclude some multiple characters)
Message-Id: <1154033787.733106.28000@i42g2000cwa.googlegroups.com>
Uncle_Fester wrote:
> How might I allow 'oo' and 'ee' and not 'ff' or '--' ?
That sounds somewhat arbitrary. Why would you want to exclude 'ff'?
Is it your intention to allow double vowels but not double consonants?
What specific ruleset determines what to keep and what to exclude? You
need to know the exact ruleset to write the regexp.
FWIW, you may wish to see the kind and helpful responses to a question
I posted earlier which has some things in common with your query:
http://tinyurl.com/of73s
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 27 Jul 2006 13:58:24 -0700
From: usenet@DavidFilmer.com
Subject: Re: Tricky regex (exclude some multiple characters)
Message-Id: <1154033904.371245.65630@i3g2000cwc.googlegroups.com>
use...@DavidFilmer.com wrote:
> FWIW, you may wish to see the kind and helpful responses to a question
> I posted earlier which has some things in common with your query:
>
> http://tinyurl.com/of73s
Oh, and this one as well: http://tinyurl.com/rk5cd
--
David Filmer (http://DavidFilmer.com)
------------------------------
Date: 27 Jul 2006 14:11:58 -0700
From: "Xicheng Jia" <xicheng@gmail.com>
Subject: Re: Tricky regex (exclude some multiple characters)
Message-Id: <1154034718.820961.242730@m73g2000cwd.googlegroups.com>
Uncle_Fester wrote:
> I want to test for "things that look more or less like real English
> words" from parsed hypertext.
>
> I know that
>
> while ($text =~ /([A-Za-z0-9_\'\-]+)/g )
>
> will catch most of what I want most of the time.
>
> The tricky bit is this :
>
> How might I allow 'oo' and 'ee' and not 'ff' or '--' ?
> How might I exclude patterns like '_________' or '010101010101' ?
>
> Any thoughts?
I supposed your words are separated by whitespaces:
while ($text =~ /
(?:^|(?<=\s))
# left boundary
(?![\w'-]*([^eo]|01)\1{1,})
# no repeating '01' and any non-[eo] characters
([\w'-]+)
# matched words in $2
(?=$|\s)/gx)
# right boundary
{
print $2;
}
will filter out '0101', 'f__d', 'fxxd','f--d'.... and validate 'food',
'feed', '01', 'f_d'
Xicheng
------------------------------
Date: Thu, 27 Jul 2006 17:21:42 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: Tricky regex (exclude some multiple characters)
Message-Id: <44C92E66.7060300@gwu.edu>
Uncle_Fester wrote:
>
> How might I allow 'oo' and 'ee' and not 'ff' or '--' ?
I fear if you did that, your filter would be just so much fluff.
Chris Mattern
------------------------------
Date: 27 Jul 2006 14:35:37 -0700
From: "Uncle_Fester" <tinthaut@hotmail.com>
Subject: Re: Tricky regex (exclude some multiple characters)
Message-Id: <1154036137.185511.278250@i3g2000cwc.googlegroups.com>
Gunnar Hjalmarsson wrote:
> Uncle_Fester wrote:
> > How might I allow 'oo' and 'ee' and not 'ff' or '--' ?
>
> What do you have against such stuff?
>
Haa! Good attitude about my fluff!
Still -- it's an interesting excercise.
I suspect the best approach is to simply ignore repeats of three or
more non alphas or three repeated alphas. It's bound to work _most_ of
the time :-)
------------------------------
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 9532
***************************************