[29996] in Perl-Users-Digest
Perl-Users Digest, Issue: 1239 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 29 03:09:40 2008
Date: Tue, 29 Jan 2008 00: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 Tue, 29 Jan 2008 Volume: 11 Number: 1239
Today's topics:
Re: Get an arbitrary hash key, quickly. <ced@blv-sam-01.ca.boeing.com>
Re: Get an arbitrary hash key, quickly. <simon.chao@gmail.com>
Re: Get an arbitrary hash key, quickly. <ced@blv-sam-01.ca.boeing.com>
Re: Get an arbitrary hash key, quickly. <simon.chao@gmail.com>
Re: Get an arbitrary hash key, quickly. <ced@blv-sam-01.ca.boeing.com>
Re: Get an arbitrary hash key, quickly. <ben@morrow.me.uk>
Re: line wrapping <jimsgibson@gmail.com>
new CPAN modules on Tue Jan 29 2008 (Randal Schwartz)
Perl bug for use strict - be forewarned!! <kinnar.dattani@gmail.com>
Re: Perl bug for use strict - be forewarned!! <noreply@gunnar.cc>
Re: Perl bug for use strict - be forewarned!! <peter@makholm.net>
Re: Perl bug for use strict - be forewarned!! <rkb@i.frys.com>
Re: Perl bug for use strict - be forewarned!! <kinnar.dattani@gmail.com>
Re: regular expression negate a word (not character) <rvtol+news@isolution.nl>
Re: regular expression negate a word (not character) <ptmcg@austin.rr.com>
Re: Version 5.8.8.8 html docs are shifted over (hidden) <nospam@somewhere.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 28 Jan 2008 14:52:25 -0800 (PST)
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Get an arbitrary hash key, quickly.
Message-Id: <d4fb57c9-17b4-422d-bcd2-b55504ecae4a@m34g2000hsb.googlegroups.com>
On Jan 24, 9:25 am, xhos...@gmail.com wrote:
> I need a work queue, but I don't really care about the order (LIFO, FIFO,
> random) in which things come out of it. Either is pretty simple and
> efficient with a Perl array, and either would suffice. But I want the
> queue to not hold duplicate entries. I could use an array as a stack or
> queue, with a parallel hash to be checked to prevent duplicates from being
> entered. But why keep parallel data structures? Just use the hash as the
> queue:
>
> while (key %hash) {
> my $to_do=each %hash;
> delete $hash{$to_do};
> ## do stuff with $to_do, which might make new entries in %hash
>
> };
>
> Well, except that this gets really slow on large hashes.
>
> I suspect the each operator does a linear scan of all the buckets until it
> finds an occupied one. With a hash that used to be big but now isn't (and
> so has lots of empty buckets), this behaves poorly, essentially being N^2
> to empty a large hash.
>
> If I just use scalar %hash instead of scalar keys %hash, then the slow down
> doesn't occur because "each" scans the buckets from where it left off last
> time, instead of from the beginning each time. (At first I thought it was
> scalar keys %hash that was being slow and was going to post about *that*,
> but then I realized that keys' reseting of the iterator was causing "each"
> to be slow). But you shouldn't change a hash at the same time you iterate
> over it because things might get missed. Presumably, anything missed will
> be found on the next time through the iterator, so this might work without
> the slowdown:
>
> while (%hash) { # does not reset iterator
> my $to_do=each %hash;
> next unless defined $to_do; # not a real hash key,
> # signals end of iterator
> ## do stuff with $to_do, which might make new entries in %hash
>
> };
>
> If my speculation on the internals is right, then this would still
> perform poorly if the hash first grows very large, then shrinks to
> be only a few elements, but those last few elements keep triggering
> the addition of just one more element each time. In my case, that
> shouldn't be a problem.
>
> Any comments on this code? Is there some less quirky way to do this
> efficiently? Is there a simple (as simple as perl's internals can get)
> way to fix "each" so that it doesn't have this degenerate case?
Do you need 'each' since values don't seem
to be retrieved...Some simple benchmarks
suggest just looping over the keys would
be quite a bit faster if that's the case:
QUEUE: {
foreach my $to_do (keys %hash) {
delete $hash{$to_do};
## do stuff with $to_do, which might
# make new entries in %hash
}
redo QUEUE if keys %hash;
}
--
Charles DeRykus
------------------------------
Date: Mon, 28 Jan 2008 15:40:51 -0800 (PST)
From: nolo contendere <simon.chao@gmail.com>
Subject: Re: Get an arbitrary hash key, quickly.
Message-Id: <3af188d9-b6e9-46ba-bf65-1186274839b1@y5g2000hsf.googlegroups.com>
On Jan 28, 5:52=A0pm, "comp.llang.perl.moderated" <c...@blv-
sam-01.ca.boeing.com> wrote:
> On Jan 24, 9:25 am, xhos...@gmail.com wrote:
>
>
>
> > I need a work queue, but I don't really care about the order (LIFO, FIFO=
,
> > random) in which things come out of it. =A0Either is pretty simple and
> > efficient with a Perl array, and either would suffice. =A0But I want the=
> > queue to not hold duplicate entries. =A0I could use an array as a stack =
or
> > queue, with a parallel hash to be checked to prevent duplicates from bei=
ng
> > entered. =A0But why keep parallel data structures? =A0Just use the hash =
as the
> > queue:
>
> > while (key %hash) {
> > =A0 my $to_do=3Deach %hash;
> > =A0 delete $hash{$to_do};
> > =A0 ## do stuff with $to_do, which might make new entries in %hash
>
> > };
>
> > Well, except that this gets really slow on large hashes.
>
> > I suspect the each operator does a linear scan of all the buckets until =
it
> > finds an occupied one. With a hash that used to be big but now isn't (an=
d
> > so has lots of empty buckets), this behaves poorly, essentially being N^=
2
> > to empty a large hash.
>
> > If I just use scalar %hash instead of scalar keys %hash, then the slow d=
own
> > doesn't occur because "each" scans the buckets from where it left off la=
st
> > time, instead of from the beginning each time. =A0(At first I thought it=
was
> > scalar keys %hash that was being slow and was going to post about *that*=
,
> > but then I realized that keys' reseting of the iterator was causing "eac=
h"
> > to be slow). =A0But you shouldn't change a hash at the same time you ite=
rate
> > over it because things might get missed. =A0Presumably, anything missed =
will
> > be found on the next time through the iterator, so this might work witho=
ut
> > the slowdown:
>
> > while (%hash) { =A0 =A0# does not reset iterator
> > =A0 my $to_do=3Deach %hash;
> > =A0 next unless defined $to_do; =A0# not a real hash key,
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# signals=
end of iterator
> > =A0 ## do stuff with $to_do, which might make new entries in %hash
>
> > };
>
> > If my speculation on the internals is right, then this would still
> > perform poorly if the hash first grows very large, then shrinks to
> > be only a few elements, but those last few elements keep triggering
> > the addition of just one more element each time. =A0In my case, that
> > shouldn't be a problem.
>
> > Any comments on this code? Is there some less quirky way to do this
> > efficiently? =A0Is there a simple (as simple as perl's internals can get=
)
> > way to fix "each" so that it doesn't have this degenerate case?
>
> Do you need 'each' since values don't seem
> to be retrieved...Some simple benchmarks
> suggest just looping over the keys would
> be quite a bit faster if that's the case:
>
> QUEUE: {
> =A0 foreach my $to_do (keys %hash) {
> =A0 =A0 =A0delete $hash{$to_do};
> =A0 =A0 =A0## do stuff with $to_do, which might
> =A0 =A0 =A0 =A0 # make new entries in %hash
> =A0 }
> =A0 redo QUEUE if keys %hash;
>
> }
>
perldoc perlsyn:
...
If any part of LIST is an array, "foreach" will get very
confused if
you add or remove elements within the loop body, for example
with
"splice". So don't do that.
Xho taught me that one :-).
------------------------------
Date: Mon, 28 Jan 2008 16:15:39 -0800 (PST)
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Get an arbitrary hash key, quickly.
Message-Id: <fe9da6bf-4670-49e5-9490-68a587edf8e4@d70g2000hsb.googlegroups.com>
On Jan 28, 3:40 pm, nolo contendere <simon.c...@gmail.com> wrote:
> On Jan 28, 5:52 pm, "comp.llang.perl.moderated" <c...@blv-
>
>
>
...
> > > Any comments on this code? Is there some less quirky way to do this
> > > efficiently? Is there a simple (as simple as perl's internals can get)
> > > way to fix "each" so that it doesn't have this degenerate case?
>
> > Do you need 'each' since values don't seem
> > to be retrieved...Some simple benchmarks
> > suggest just looping over the keys would
> > be quite a bit faster if that's the case:
>
> > QUEUE: {
> > foreach my $to_do (keys %hash) {
> > delete $hash{$to_do};
> > ## do stuff with $to_do, which might
> > # make new entries in %hash
> > }
> > redo QUEUE if keys %hash;
>
> > }
>
> perldoc perlsyn:
> ...
> If any part of LIST is an array, "foreach" will get very
> confused if
> you add or remove elements within the loop body, for example
> with
> "splice". So don't do that.
>
Yes, that's true. Even delete's can be problematic
unless iterating with 'each' I think. But the
original code Xho demo'ed was adding elements
during the loop as well... so I'm not sure how
that could ever work..
--
Charles DeRykus
------------------------------
Date: Mon, 28 Jan 2008 16:26:06 -0800 (PST)
From: nolo contendere <simon.chao@gmail.com>
Subject: Re: Get an arbitrary hash key, quickly.
Message-Id: <c83d0ffc-e009-491c-a693-7a4ad6960c1a@v17g2000hsa.googlegroups.com>
On Jan 28, 7:15=A0pm, "comp.llang.perl.moderated" <c...@blv-
sam-01.ca.boeing.com> wrote:
> On Jan 28, 3:40 pm, nolo contendere <simon.c...@gmail.com> wrote:
>
>
>
> > On Jan 28, 5:52 pm, "comp.llang.perl.moderated" <c...@blv-
>
> =A0...
> > > > Any comments on this code? Is there some less quirky way to do this
> > > > efficiently? =A0Is there a simple (as simple as perl's internals can=
get)
> > > > way to fix "each" so that it doesn't have this degenerate case?
>
> > > Do you need 'each' since values don't seem
> > > to be retrieved...Some simple benchmarks
> > > suggest just looping over the keys would
> > > be quite a bit faster if that's the case:
>
> > > QUEUE: {
> > > =A0 foreach my $to_do (keys %hash) {
> > > =A0 =A0 =A0delete $hash{$to_do};
> > > =A0 =A0 =A0## do stuff with $to_do, which might
> > > =A0 =A0 =A0 =A0 # make new entries in %hash
> > > =A0 }
> > > =A0 redo QUEUE if keys %hash;
>
> > > }
>
> > perldoc perlsyn:
> > =A0 =A0 =A0 =A0...
> > =A0 =A0 =A0 =A0If any part of LIST is an array, "foreach" will get very
> > confused if
> > =A0 =A0 =A0 =A0you add or remove elements within the loop body, for exam=
ple
> > with
> > =A0 =A0 =A0 =A0"splice". =A0 So don't do that.
>
> Yes, that's true. =A0Even delete's can be problematic
> unless iterating with 'each' I think. But the
> original code Xho demo'ed was adding elements
> during the loop as well... so I'm not sure how
> that could ever work..
>
Those were 'while' loops, which don't suffer from the same issue.
------------------------------
Date: Mon, 28 Jan 2008 16:54:47 -0800 (PST)
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: Get an arbitrary hash key, quickly.
Message-Id: <da78863c-b018-4b6b-ad0d-d2ea9c97b6e6@m34g2000hsf.googlegroups.com>
On Jan 28, 4:26 pm, nolo contendere <simon.c...@gmail.com> wrote:
> On Jan 28, 7:15 pm, "comp.llang.perl.moderated" <c...@blv-
>
>
>
> sam-01.ca.boeing.com> wrote:
> > On Jan 28, 3:40 pm, nolo contendere <simon.c...@gmail.com> wrote:
>
> > > On Jan 28, 5:52 pm, "comp.llang.perl.moderated" <c...@blv-
>
> > ...
> > > > > Any comments on this code? Is there some less quirky way to do this
> > > > > efficiently? Is there a simple (as simple as perl's internals can get)
> > > > > way to fix "each" so that it doesn't have this degenerate case?
>
> > > > Do you need 'each' since values don't seem
> > > > to be retrieved...Some simple benchmarks
> > > > suggest just looping over the keys would
> > > > be quite a bit faster if that's the case:
>
> > > > QUEUE: {
> > > > foreach my $to_do (keys %hash) {
> > > > delete $hash{$to_do};
> > > > ## do stuff with $to_do, which might
> > > > # make new entries in %hash
> > > > }
> > > > redo QUEUE if keys %hash;
>
> > > > }
>
> > > perldoc perlsyn:
> > > ...
> > > If any part of LIST is an array, "foreach" will get very
> > > confused if
> > > you add or remove elements within the loop body, for example
> > > with
> > > "splice". So don't do that.
>
> > Yes, that's true. Even delete's can be problematic
> > unless iterating with 'each' I think. But the
> > original code Xho demo'ed was adding elements
> > during the loop as well... so I'm not sure how
> > that could ever work..
>
> Those were 'while' loops, which don't suffer from the same issue.
No, I believe it's not just a 'while vs. foreach'
issue but rather ensuring that the iterator's reset
before the next each call.
--
Charles DeRykus
------------------------------
Date: Tue, 29 Jan 2008 01:05:59 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Get an arbitrary hash key, quickly.
Message-Id: <noa275-dq6.ln1@osiris.mauzo.dyndns.org>
Quoth nolo contendere <simon.chao@gmail.com>:
> On Jan 28, 5:52 pm, "comp.llang.perl.moderated" <c...@blv-
> sam-01.ca.boeing.com> wrote:
> >
> > Do you need 'each' since values don't seem
> > to be retrieved...Some simple benchmarks
> > suggest just looping over the keys would
> > be quite a bit faster if that's the case:
> >
> > QUEUE: {
> > foreach my $to_do (keys %hash) {
> > delete $hash{$to_do};
> > ## do stuff with $to_do, which might
> > # make new entries in %hash
> > }
> > redo QUEUE if keys %hash;
> >
> > }
> >
>
> perldoc perlsyn:
> ...
> If any part of LIST is an array, "foreach" will get very
^^^^^^^^^^^
It isn't. keys returns a list. What *is* true in this case is that if
any entries you haven't got to yet are deleted from the hash, they will
still be in for's list and will be returned anyway; since that isn't the
case here, it doesn't matter.
However, I would have thought that as the number of keys gets larger,
this get slower, since it has to build a complete list of the keys each
time through QUEUE. Let's see...
#!/usr/bin/perl -l
use strict;
use warnings;
use Benchmark qw/cmpthese/;
my %h =
map { ($_, 1) }
map { join '', map { chr rand 256 } 1..10 }
1..100_000;
cmpthese -5, {
keys => sub {
for my $x (keys %h) { 1; }
},
leach => sub {
while (my ($k, $v) = each %h) { 1; }
},
seach => sub {
while (my $k = each %h) { 1; }
},
};
__END__
Rate leach keys seach
leach 3.76/s -- -28% -30%
keys 5.21/s 38% -- -3%
seach 5.37/s 43% 3% --
Nope, I'm wrong even on large hashes, but scalar each is faster again,
though even that seems to depend on your malloc: FreeBSD's perl is built
with perl's malloc by default, and a version built with the native
malloc has keys > seach > leach. Hmmm. :)
Ben
------------------------------
Date: Mon, 28 Jan 2008 12:23:23 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: line wrapping
Message-Id: <280120081223236673%jimsgibson@gmail.com>
In article <5vGdncn_6fOtvQPanZ2dnUVZ_rignZ2d@insightbb.com>, monkeys
paw <user@example.net> wrote:
> I have entries typed in by clients that need to wrap.
> If a client were to type in a string of chars (say 100) without a space,
> i need a substitution that would insert a break and newline at space
> 80. How would one do that with a s/// type statement?
One would use substr, rather than an RE:
substr($entry,80,0,"\n");
If one insisted on using REs:
$entry =~ s/^(.{80})/$1\n/;
Note: a "newline" is assumed to be the desired "break" here.
For larger jobs, the Text::Wrap module is recommended.
--
Jim Gibson
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Tue, 29 Jan 2008 05:42:19 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Tue Jan 29 2008
Message-Id: <JvE56J.vr3@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-AhoCorasick-0.02
http://search.cpan.org/~vbar/Algorithm-AhoCorasick-0.02/
efficient search for multiple strings
----
AnyEvent-2.9
http://search.cpan.org/~mlehmann/AnyEvent-2.9/
provide framework for multiple event loops
----
App-Bondage-0.2.0
http://search.cpan.org/~hinrik/App-Bondage-0.2.0/
----
App-Bondage-0.2.1
http://search.cpan.org/~hinrik/App-Bondage-0.2.1/
----
Bio-GenBankParser-0.02
http://search.cpan.org/~kclark/Bio-GenBankParser-0.02/
Parse::RecDescent parser for a GenBank record
----
Bundle-NICAT-0.03
http://search.cpan.org/~marcel/Bundle-NICAT-0.03/
Prerequisites for the Austrian Domain Registry projects
----
CPAN-Reporter-Smoker-0.02
http://search.cpan.org/~dagolden/CPAN-Reporter-Smoker-0.02/
Turnkey CPAN Testers smoking
----
Cache-FastMmap-Tie-0.03
http://search.cpan.org/~suzuki/Cache-FastMmap-Tie-0.03/
Using Cache::FastMmap as hash
----
Cache-Memcached-libmemcached-0.01000
http://search.cpan.org/~dmaki/Cache-Memcached-libmemcached-0.01000/
Perl Interface to libmemcached
----
Class-Accessor-Complex-0.12
http://search.cpan.org/~marcel/Class-Accessor-Complex-0.12/
arrays, hashes, booleans, integers, sets and more
----
Config-Any-0.11
http://search.cpan.org/~bricas/Config-Any-0.11/
Load configuration from different file formats, transparently
----
Config-Model-0.617
http://search.cpan.org/~ddumont/Config-Model-0.617/
Model to create configuration validation tool
----
Config-Model-Xorg-0.507
http://search.cpan.org/~ddumont/Config-Model-Xorg-0.507/
Xorg configuration model for Config::Model
----
Convert-Temperature-0.01
http://search.cpan.org/~mopy/Convert-Temperature-0.01/
----
DBD-Pg-2.0.0_8
http://search.cpan.org/~turnstep/DBD-Pg-2.0.0_8/
PostgreSQL database driver for the DBI module
----
DBD-Pg-2.0.0_9
http://search.cpan.org/~turnstep/DBD-Pg-2.0.0_9/
PostgreSQL database driver for the DBI module
----
DBIx-Class-DigestOnSet-0.000001_01
http://search.cpan.org/~groditi/DBIx-Class-DigestOnSet-0.000001_01/
Automatically encode columns with Digest
----
Devel-GDB-2.02
http://search.cpan.org/~jezra/Devel-GDB-2.02/
Open and communicate a gdb session
----
EV-3.0
http://search.cpan.org/~mlehmann/EV-3.0/
perl interface to libev, a high performance full-featured event loop
----
Fuzz-0.06
http://search.cpan.org/~ksuri/Fuzz-0.06/
network services fuzzing interface.
----
Geo-Mercator-1.01
http://search.cpan.org/~darnold/Geo-Mercator-1.01/
Compute Mercator Projection of latitude/longitude into meters
----
Geo-Point-Plugin-Transform-0.0.1
http://search.cpan.org/~kokogiko/Geo-Point-Plugin-Transform-0.0.1/
Add taransforming projection method to Geo::Point
----
HTML-WikiConverter-DokuWikiFCK-0.07
http://search.cpan.org/~turnermm/HTML-WikiConverter-DokuWikiFCK-0.07/
A WikiConverter Dialect supporting the FCKeditor in DokuWiki
----
HTML-WikiConverter-DokuWikiFCK-0.08
http://search.cpan.org/~turnermm/HTML-WikiConverter-DokuWikiFCK-0.08/
A WikiConverter Dialect supporting the FCKeditor in DokuWiki
----
IO-Socket-SSL-1.13
http://search.cpan.org/~sullr/IO-Socket-SSL-1.13/
Nearly transparent SSL encapsulation for IO::Socket::INET.
----
Keystone-Resolver-1.14
http://search.cpan.org/~mirk/Keystone-Resolver-1.14/
an OpenURL resolver
----
Keystone-Resolver-1.15
http://search.cpan.org/~mirk/Keystone-Resolver-1.15/
an OpenURL resolver
----
Language-Befunge-Vector-XS-0.2.3
http://search.cpan.org/~jquelin/Language-Befunge-Vector-XS-0.2.3/
Language::Befunge::Vector rewritten for speed
----
Math-SymbolicX-Error-1.01
http://search.cpan.org/~smueller/Math-SymbolicX-Error-1.01/
Parser extension for dealing with numeric errors
----
Memcached-libmemcached-0.1404
http://search.cpan.org/~timb/Memcached-libmemcached-0.1404/
Thin fast full interface to the libmemcached client API
----
Module-ScanDeps-0.82
http://search.cpan.org/~smueller/Module-ScanDeps-0.82/
Recursively scan Perl code for dependencies
----
MooseX-Getopt-0.11
http://search.cpan.org/~blblack/MooseX-Getopt-0.11/
A Moose role for processing command line options
----
Net-Elexol-EtherIO24-0.15
http://search.cpan.org/~chrisy/Net-Elexol-EtherIO24-0.15/
Object interface for manipulating Elexol Ether I/O 24 units with Perl
----
Net-Elexol-EtherIO24-0.16
http://search.cpan.org/~chrisy/Net-Elexol-EtherIO24-0.16/
Object interface for manipulating Elexol Ether I/O 24 units with Perl
----
News-NNTP-0.1
http://search.cpan.org/~jnixon/News-NNTP-0.1/
NNTP client implementation
----
News-NNTP-0.2
http://search.cpan.org/~jnixon/News-NNTP-0.2/
NNTP client implementation
----
PApp-1.41
http://search.cpan.org/~mlehmann/PApp-1.41/
multi-page-state-preserving web applications
----
POE-Component-Server-Syslog-1.12
http://search.cpan.org/~bingos/POE-Component-Server-Syslog-1.12/
syslog services for POE
----
POE-Component-WebService-Validator-HTML-W3C-0.04
http://search.cpan.org/~zoffix/POE-Component-WebService-Validator-HTML-W3C-0.04/
a non-blocking POE wrapper around WebService::Validator::HTML::W3C
----
QtCore-4.001
http://search.cpan.org/~vadiml/QtCore-4.001/
----
QtGui-4.001
http://search.cpan.org/~vadiml/QtGui-4.001/
----
Safe-2.13
http://search.cpan.org/~rgarcia/Safe-2.13/
Compile and execute code in restricted compartments
----
SmartMatch-Sugar-0.01
http://search.cpan.org/~nuffin/SmartMatch-Sugar-0.01/
Smart match friendly tests.
----
String-BlackWhiteList-0.05
http://search.cpan.org/~marcel/String-BlackWhiteList-0.05/
match a string against a blacklist and a whitelist
----
Sub-SmartMatch-0.01
http://search.cpan.org/~nuffin/Sub-SmartMatch-0.01/
Use smart matching to define multi subs
----
Term-Size-Any-0.001
http://search.cpan.org/~ferreira/Term-Size-Any-0.001/
Retrieve terminal size
----
Test-Compile-0.08
http://search.cpan.org/~marcel/Test-Compile-0.08/
check whether Perl module files compile correctly
----
WWW-Authen-Simple-1.22
http://search.cpan.org/~unrtst/WWW-Authen-Simple-1.22/
Cookie based session and authentication module using database backend. Also provides group based authorization.
----
WWW-Myspace-Data-0.17
http://search.cpan.org/~oalders/WWW-Myspace-Data-0.17/
WWW::Myspace database interaction
----
WWW-Ohloh-API-0.0.6
http://search.cpan.org/~yanick/WWW-Ohloh-API-0.0.6/
Ohloh API implementation
----
WWW-PAUSE-Recent-0.01
http://search.cpan.org/~zoffix/WWW-PAUSE-Recent-0.01/
get the list of the recent uploads to PAUSE
----
Win32-MSI-HighLevel-1.000000
http://search.cpan.org/~grandpa/Win32-MSI-HighLevel-1.000000/
Perl wrapper for Windows Installer API
----
ack-1.77_02
http://search.cpan.org/~petdance/ack-1.77_02/
grep-like text finder
----
supertag-0.1
http://search.cpan.org/~acg/supertag-0.1/
organize your music collection like a real superhero
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: Mon, 28 Jan 2008 22:18:39 -0800 (PST)
From: Tintin <kinnar.dattani@gmail.com>
Subject: Perl bug for use strict - be forewarned!!
Message-Id: <86637591-7cad-4305-89b8-5c00bc265b61@k39g2000hsf.googlegroups.com>
Hi Folks,
I am hoping I am wrong here but is this a bug with reference to the
code segment below?
================================================
#!/usr/local/bin/perl
use strict;
use warnings;
$a=10;
print $a++ . "\n";
print $a . "\n";
================================================
After compilation and execution ==>
10
11
================================================
Perl version information is as below:
perl -v
This is perl, v5.8.8 built for darwin-thread-multi-2level
(with 10 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 822 [280952] provided by ActiveState http://www.ActiveState.com
Built Jul 31 2007 19:44:51
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source
kit.
Complete documentation for Perl, including FAQ lists, should be found
on
this system using "man perl" or "perldoc perl". If you have access to
the
Internet, point your browser at http://www.perl.org/, the Perl Home
Page.
$
================================================
The same code is now modified as below:
#!/usr/local/bin/perl
use strict;
use warnings;
$some_var=10;
print $some_var++ . "\n";
print $some_var . "\n";
================================================
After compilation and execution ==>
10
11
================================================
Global symbol "$some_var" requires explicit package name
Global symbol "$some_var" requires explicit package name
Global symbol "$some_var" requires explicit package name
Execution aborted due to compilation errors.
================================================
I don't see why this code snipped should've executed in the first
instance. I have observed this behavior to be exhibited for the
following single character identifiers ($a, $b) that act as scalar
variable names.
Has anybody has had this experience before? Any thoughts?
Regards,
- Tintin
------------------------------
Date: Tue, 29 Jan 2008 07:33:12 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Perl bug for use strict - be forewarned!!
Message-Id: <607vljF1p2ogjU1@mid.individual.net>
Tintin wrote:
> I am hoping I am wrong here but is this a bug with reference to the
> code segment below?
>
> ================================================
> #!/usr/local/bin/perl
> use strict;
> use warnings;
>
> $a=10;
>
>
> print $a++ . "\n";
> print $a . "\n";
>
> ================================================
> After compilation and execution ==>
> 10
> 11
<snip>
$a and $b don't need to be declared under strictures because they are
special variables.
http://perldoc.perl.org/perlvar.html#%24a
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 29 Jan 2008 06:33:36 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: Perl bug for use strict - be forewarned!!
Message-Id: <877ihtkunz.fsf@hacking.dk>
Tintin <kinnar.dattani@gmail.com> writes:
> I don't see why this code snipped should've executed in the first
> instance. I have observed this behavior to be exhibited for the
> following single character identifiers ($a, $b) that act as scalar
> variable names.
This is not a bug but a feature and well documented in the
documentation for the strict pragma 'perldoc strict':
Because of their special use by sort(), the variables $a and $b
are exempted from this check.
//Makholm
------------------------------
Date: Mon, 28 Jan 2008 22:38:21 -0800 (PST)
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: Perl bug for use strict - be forewarned!!
Message-Id: <ecb12fde-6735-410c-a553-8ae529d19a8b@c4g2000hsg.googlegroups.com>
On Jan 28, 10:18 pm, Tintin <kinnar.datt...@gmail.com> wrote:
> Hi Folks,
Hi TinTin,
>
> I am hoping I am wrong here but is this a bug with reference to the
> code segment below?
>
> ================================================
> #!/usr/local/bin/perl
> use strict;
> use warnings;
>
> $a=10;
>
> print $a++ . "\n";
> print $a . "\n";
>
> ================================================
> After compilation and execution ==>
> 10
> 11
> ================================================
quoted from perldoc perlvar
$a
$b Special package variables when using sort(), see "sort" in
perlfunc. Because of this specialness $a and $b don't need
to be
declared (using use vars, or our()) even when using the
"strict
'vars'" pragma. Don't lexicalize them with "my $a" or "my
$b" if
you want to be able to use them in the sort() comparison
block
or function.
> Perl version information is as below:
> perl -v
>
> This is perl, v5.8.8 built for darwin-thread-multi-2level
> (with 10 registered patches, see perl -V for more detail)
>
> Copyright 1987-2007, Larry Wall
>
> Binary build 822 [280952] provided by ActiveStatehttp://www.ActiveState.com
> Built Jul 31 2007 19:44:51
>
> Perl may be copied only under the terms of either the Artistic License
> or the
> GNU General Public License, which may be found in the Perl 5 source
> kit.
>
> Complete documentation for Perl, including FAQ lists, should be found
> on
> this system using "man perl" or "perldoc perl". If you have access to
> the
> Internet, point your browser athttp://www.perl.org/, the Perl Home
> Page.
>
> $
>
> ================================================
> The same code is now modified as below:
> #!/usr/local/bin/perl
> use strict;
> use warnings;
>
> $some_var=10;
>
> print $some_var++ . "\n";
> print $some_var . "\n";
> ================================================
> After compilation and execution ==>
> 10
> 11
> ================================================
That's odd. Here's the results I get.
C:\test>type Tintin2.pl
#!/usr/local/bin/perl
use strict;
use warnings;
$some_var=10;
print $some_var++ . "\n";
print $some_var . "\n";
C:\test>Tintin2.pl
Global symbol "$some_var" requires explicit package name at C:\test
\Tintin2.pl line 5.
Global symbol "$some_var" requires explicit package name at C:\test
\Tintin2.pl line 7.
Global symbol "$some_var" requires explicit package name at C:\test
\Tintin2.pl line 8.
Execution of C:\test\Tintin2.pl aborted due to compilation errors.
> Global symbol "$some_var" requires explicit package name
> Global symbol "$some_var" requires explicit package name
> Global symbol "$some_var" requires explicit package name
> Execution aborted due to compilation errors.
> ================================================
>
> I don't see why this code snipped should've executed in the first
> instance. I have observed this behavior to be exhibited for the
> following single character identifiers ($a, $b) that act as scalar
> variable names.
>
> Has anybody has had this experience before? Any thoughts?
>
> Regards,
> - Tintin
C:\test>perl -v
This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 33 registered patches, see perl -V for more detail)
Ron
aka FishMonger
------------------------------
Date: Mon, 28 Jan 2008 22:39:43 -0800 (PST)
From: Tintin <kinnar.dattani@gmail.com>
Subject: Re: Perl bug for use strict - be forewarned!!
Message-Id: <ac14d22b-1157-4ec4-aae1-fd4df0a6250e@i72g2000hsd.googlegroups.com>
On Jan 29, 1:33=A0am, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
> Tintin wrote:
> > I am hoping I am wrong here but is this a bug with reference to the
> > code segment below?
>
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > #!/usr/local/bin/perl
> > use strict;
> > use warnings;
>
> > $a=3D10;
>
> > print $a++ . "\n";
> > print $a . "\n";
>
> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> > After compilation and execution =3D=3D>
> > 10
> > 11
>
> <snip>
>
> $a and $b don't need to be declared under strictures because they are
> special variables.
>
> http://perldoc.perl.org/perlvar.html#%24a
>
> --
> Gunnar Hjalmarsson
> Email:http://www.gunnar.cc/cgi-bin/contact.pl
Thank You Sir!! I was reading documentation from the camel and I must
have missed the point. Apologies for the trouble & many thanks for
your time.
------------------------------
Date: Mon, 28 Jan 2008 21:00:55 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: regular expression negate a word (not character)
Message-Id: <fnlfr0.1fk.1@news.isolution.nl>
Greg Bacon schreef:
> #! /usr/bin/perl
>
> use warnings;
> use strict;
>
> use constant {
> MATCH => 1,
> NO_MATCH => 0,
> };
>
> my @tests = (
> [ "winter tire", => MATCH ],
> [ "tire", => MATCH ],
> [ "retire", => MATCH ],
> [ "tired", => MATCH ],
> [ "snowbird tire", => MATCH ],
> [ "tired on a snow day", => MATCH ],
> [ "snow tire and regular tire", => MATCH ],
> [ " tire" => MATCH ],
> [ "snow tire" => NO_MATCH ],
> [ "snow tire" => NO_MATCH ],
> [ "some snowtires" => NO_MATCH ],
> );
> [...]
I negated the test, to make the regex simpler:
my $snow_tire = qr/
snow [[:blank:]]* tire (?!.*tire)
/x;
my $fail;
for (@tests) {
my($str,$want) = @$_;
my $got = $str !~ /$snow_tire/;
my $pass = !!$want == !!$got;
print "$str: ", ($pass ? "PASS" : "FAIL"), "\n";
++$fail unless $pass;
}
print "\n", (!$fail ? "PASS" : "FAIL"), "\n";
__END__
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Mon, 28 Jan 2008 13:37:36 -0800 (PST)
From: Paul McGuire <ptmcg@austin.rr.com>
Subject: Re: regular expression negate a word (not character)
Message-Id: <49b557cb-e1ca-4bde-b0c9-02e22d04fd97@j78g2000hsd.googlegroups.com>
On Jan 25, 7:16=A0pm, Summercool <Summercooln...@gmail.com> wrote:
> somebody who is a regular expression guru... how do you negate a word
> and grep for all words that is
>
> =A0 tire
>
> but not
>
> =A0 snow tire
>
> or
>
> =A0 snowtire
>
Too bad pyparsing's not an option. Here's what it would look like:
data =3D """
Match:
> winter tire
> tire
> retire
> tired
But not match:
> snow tire
> snow tire
> some snowtires
snowbird tire
tired on a snow day
snow tire and regular tire
"""
from pyparsing import CaselessLiteral,Literal,line
# caseless wasn't really necessary but you never know
# when you'll run into a "Snow tire"
snow =3D CaselessLiteral("snow")
tire =3D Literal("tire")
tire.ignore(snow + tire)
for matchTokens,matchStart,matchEnd in tire.scanString(data):
print line(matchStart, data)
Prints:
> winter tire
> tire
> retire
> tired
snowbird tire
tired on a snow day
snow tire and regular tire
-- Paul
------------------------------
Date: Mon, 28 Jan 2008 19:44:32 -0500
From: "Thrill5" <nospam@somewhere.com>
Subject: Re: Version 5.8.8.8 html docs are shifted over (hidden) about 4 or 5 pixels to the left off the frame. WTF?
Message-Id: <FMCdnS5ZU8Nt6wPanZ2dnUVZ_v2pnZ2d@comcast.com>
<sln@netherlands.co> wrote in message
news:t77lp3l5muv7t6e4ra1p5msn1o8edn623v@4ax.com...
> Does anybody els have this problem? Its so anoying I wan't to go back to
> 5.8.6.
>
>
Probably an issue in the style sheet. Don't have 5.8.8 so I don't know what
to fix....
------------------------------
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 1239
***************************************