[28151] in Perl-Users-Digest
Perl-Users Digest, Issue: 9515 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jul 23 03:05:51 2006
Date: Sun, 23 Jul 2006 00:05:05 -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 Sun, 23 Jul 2006 Volume: 10 Number: 9515
Today's topics:
[ANNOUNCE] Emacs modules for Perl programming (Jari Aalto+mail.perl)
ASP.Net, PERL and File Uploading <getmyemails2@yahoo.com>
Re: ASP.Net, PERL and File Uploading mgarrish@gmail.com
Re: ASP.Net, PERL and File Uploading <mumia.w.18.spam+nospam.usenet@earthlink.net>
Re: CGI.pm and lost carriage returns <1usa@llenroc.ude.invalid>
Re: Idiot Q: How to find index number of HASH match? <abigail@abigail.nl>
Re: Idiot Q: How to find index number of HASH match? <franzl.wisseworst@mailinator.net>
Re: Lingua::Han::PinYin and utf8 problem <corff@zedat.fu-berlin.de>
Re: my VAR = EXPR if COND <benmorrow@tiscali.co.uk>
new CPAN modules on Sun Jul 23 2006 (Randal Schwartz)
Re: numeric sort on string like a123-3 <1usa@llenroc.ude.invalid>
Re: perl + regex bug? <1usa@llenroc.ude.invalid>
UNIVERSAL::isa($object, 'UNIVERSAL') returns false? <kevin@vaildc.net>
Re: UNIVERSAL::isa($object, 'UNIVERSAL') returns false? <sisyphus1@nomail.afraid.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 23 Jul 2006 04:43:25 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: [ANNOUNCE] Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_1153629771@rtfm.mit.edu>
Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
Maintainer: Jari Aalto A T cante net
Announcement: "What Emacs lisp modules can help with programming Perl"
Preface
Emacs is your friend if you have to do anything comcerning software
development: It offers plug-in modules, written in Emacs lisp
(elisp) language, that makes all your programmings wishes come
true. Please introduce yourself to Emacs and your programming era
will get a new light.
Where to find Emacs/XEmacs
o Unix:
http://www.gnu.org/software/emacs/emacs.html
http://www.xemacs.org/
o Unix Windows port (for Unix die-hards):
install http://www.cygwin.com/ which includes native Emacs 21.x.
and XEmacs port
o Pure Native Windows port
http://www.gnu.org/software/emacs/windows/ntemacs.html
ftp://ftp.xemacs.org/pub/xemacs/windows/setup.exe
o More Emacs resources at
http://tiny-tools.sourceforge.net/ => Emacs resource page
Emacs Perl Modules
Cperl -- Perl programming mode
http://math.berkeley.edu/~ilya/software/emacs/
by Ilya Zakharevich
CPerl is major mode for editing perl files. Also included in
latest Emacs, but newest version is at Ilya's site. Note that
the directrory at CPAN is out of date:
http://www.cpan.org/modules/by-authors/id/ILYAZ/cperl-mode/
Compared to default `perl-mode' that comes with Emacs, this
one has more features.
TinyPerl -- Perl related utilities
http://tiny-tools.sourceforge.net/
If you ever wonder how to deal with Perl POD pages or how to find
documentation from all perl manpages, this package is for you.
Couple of keystrokes and all the documentaion is in your hands.
o Instant function help: See documentation of `shift', `pop'...
o Show Perl manual pages in *pod* buffer
o Grep through all Perl manpages (.pod)
o Follow POD references e.g. [perlre] to next pod with RETURN
o Coloured pod pages with `font-lock'
o Separate `tiperl-pod-view-mode' for jumping topics and pages
forward and backward in *pod* buffer.
o Update `$VERSION' variable with YYYY.MMDD on save.
o Load source code into Emacs, like Devel::DProf.pm
o Prepare script (version numbering) and Upload it to PAUSE
o Generate autoload STUBS (Devel::SelfStubber) for you
Perl Module (.pm)
TinyIgrep -- Perl Code browsing and easy grepping
[TinyIgrep is included in Tiny Tools Kit]
To grep from all installed Perl modules, define database to
TinyIgrep. There is example file emacs-rc-tinyigrep.el that shows
how to set up dattabases for Perl5, Perl4 whatever you have
installed
TinyIgrep calls Igrep.el to to do the search, You can adjust
recursive grep options, set search case sensitivity, add user grep
options etc.
You can find latest `igrep.el' module at
<http://groups.google.com/groups?group=gnu.emacs.sources> The
maintainer is Jefin Rodgers <kevinr@ihs.com>.
TinyCompile -- To Browse grep results in Emacs *compile* buffer
TinyCompile is a minor mode for *compile* buffer from where
you can collapse unwanted lines or shorten file URLs:
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
/asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT
-->
cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
file1:NNN: MATCHED TEXT
file1:NNN: MATCHED TEXT
End
------------------------------
Date: 22 Jul 2006 17:19:12 -0700
From: "getmyemails2@yahoo.com" <getmyemails2@yahoo.com>
Subject: ASP.Net, PERL and File Uploading
Message-Id: <1153613952.604033.37680@s13g2000cwa.googlegroups.com>
Hello All,
I have an ASP.Net application and I need to upload files from a
pre-determined source. Although a standard HTML FileInput control will
allow a default "value" property, the control available in ASP.Net does
not.
Can I pass a string representing a filename and path to a PERL script
in
order to upload a file?
If the above can work, are there other configuration settings required
to run a CGI script written in PERL from within an ASP.Net environment?
I have ActivePerl installed on my machine along with "C:\Temp" folder,
etc.
Thanks & Regards,
TC
------------------------------
Date: 22 Jul 2006 17:57:40 -0700
From: mgarrish@gmail.com
Subject: Re: ASP.Net, PERL and File Uploading
Message-Id: <1153616260.585171.211110@s13g2000cwa.googlegroups.com>
getmyemails2@yahoo.com wrote:
> Hello All,
>
> I have an ASP.Net application and I need to upload files from a
> pre-determined source. Although a standard HTML FileInput control will
> allow a default "value" property, the control available in ASP.Net does
> not.
>
Really? What browser allows a default value? Opera's the only one I've
ever heard of, but it prompts before allowing a postback if that value
hasn't been altered. If what you were asking were possible anyone could
write in the file they want to steal from the user's machine and pull
it up to the server.
> Can I pass a string representing a filename and path to a PERL script
> in
> order to upload a file?
>
No, you need the user to select or type in the value and submit the
form, otherwise the browser will not send the file to the server, and
without the file the path is useless to the script on the receiving
end.
> If the above can work, are there other configuration settings required
> to run a CGI script written in PERL from within an ASP.Net environment?
>
Perl and ASP.NET have nothing to do with each other. If you chose to
configure your server during the ActivePerl install then you should be
able to run .pl and .plx files.
Matt
------------------------------
Date: Sun, 23 Jul 2006 02:08:19 GMT
From: "Mumia W." <mumia.w.18.spam+nospam.usenet@earthlink.net>
Subject: Re: ASP.Net, PERL and File Uploading
Message-Id: <nSAwg.8525$vO.6776@newsread4.news.pas.earthlink.net>
On 07/22/2006 07:19 PM, getmyemails2@yahoo.com wrote:
> Hello All,
>
> I have an ASP.Net application and I need to upload files from a
> pre-determined source. Although a standard HTML FileInput control will
> allow a default "value" property, the control available in ASP.Net does
> not.
>
> Can I pass a string representing a filename and path to a PERL script
> in order to upload a file?
>
Yes
> If the above can work, are there other configuration settings required
> to run a CGI script written in PERL from within an ASP.Net environment?
>
There are many. Launch a command prompt and type "perldoc CGI"
to learn about the Perl CGI module. Someone else will have to
give you the pointers on getting ActivePerl working with your
web server.
In Perl, to create a file-upload control that has a default
value, you can either write the HTML text directly, like so:
print q{
<p> Please enter your file name:
<input type=file value="myfile.val" >
</p>
};
Or you can use CGI.pm's methods for creating them. See §
"Creating a file upload field" in "perldoc CGI".
> I have ActivePerl installed on my machine along with "C:\Temp" folder,
> etc.
>
> Thanks & Regards,
>
> TC
>
You're welcome.
------------------------------
Date: Sat, 22 Jul 2006 23:01:28 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: CGI.pm and lost carriage returns
Message-Id: <Xns9808C19E4798Easu1cornelledu@127.0.0.1>
"Alan J. Flavell" <flavell@physics.gla.ac.uk> wrote in
news:Pine.LNX.4.64.0607221206220.2443@ppepc20.ph.gla.ac.uk:
> On Fri, 21 Jul 2006, A. Sinan Unur wrote:
>
>> David Squire <David.Squire@no.spam.from.here.au> wrote in
>> news:e9qamj$heb$1@gemini.csx.cam.ac.uk:
>>
>> > Fair enough. Point taken. There would have to be other sanity
>> > checks too.
>>
>> Sanity checks? Checking arbitrary text entered in a textbox is
>> 'difficult' in a very real sense.
>>
>> What is needed is not checking, but encoding.
>
> Yes, but what is primarily needed here is a sound analysis of what's
> intended to be achieved!
I agree. I assumed the spec: Disallow any HTML at all, respect various
kinds of line breaks in the input.
I do appreciate your discussion of alternative contexts, and
> [
> Have we even understood what it is that the O.P is intending to
> achieve? Whatever it is, I'm highly sceptical of the server-side
> processing merely sprinkling the input with <br> tags instead of
> newlines, and nothing more: it does not seem to be a solution to any
> variant of this problem that I can think of.
>]
I agree wholeheartedly with this observation.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: 22 Jul 2006 22:40:28 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Idiot Q: How to find index number of HASH match?
Message-Id: <slrnec5aar.c2.abigail@alexandra.abigail.nl>
Jim Gibson (jgibson@mail.arc.nasa.gov) wrote on MMMMDCCVII September
MCMXCIII in <URL:news:210720061642064632%jgibson@mail.arc.nasa.gov>:
??
?? Then efficiency is probably not a consideration. Scalability might be a
?? factor, if you have more than two hashes.
Funny that your post mentions both a solution using an array of tiny
arrays, and the word 'scalability'.
Using two arrays scales much better than using an array of two element
arrays. Both in memory and in construction time.
#!/usr/bin/perl
use strict;
use warnings;
no warnings 'syntax';
use Devel::Size qw [total_size];
$| = 1;
print " Size bytes bytes ratio\n";
foreach my $size (10, 100, 1_000, 10_000, 100_000, 1_000_000) {
my @a1 = (undef) x $size;
my @a2 = (undef) x $size;
my $s1 = total_size (\@a1) + total_size (\@a2);
printf "%8d %9d " => $size, $s1;
my @da = map {[(undef) x 2]} 1 .. $size;
my $s2 = total_size (\@da);
printf "%9d %.2f\n" => $s2, $s2 / $s1;
}
__END__
Size bytes bytes ratio
10 440 1180 2.68
100 3512 11356 3.23
1000 40472 116236 2.87
10000 371160 1145580 3.09
100000 3448664 11324332 3.28
1000000 32388696 ^C
--
:;$:=~s:
-:;another Perl Hacker
:;chop
$:;$:=~y
:;::d;print+Just.
$:;
------------------------------
Date: Sun, 23 Jul 2006 07:07:08 +0200
From: Franzl Wisseworst <franzl.wisseworst@mailinator.net>
Subject: Re: Idiot Q: How to find index number of HASH match?
Message-Id: <e9v158$pj5$01$1@news.t-online.com>
Tad McClellan wrote:
[..]
> while ( local $_ = each %$_ ) {
> if ( exists $activities{$_} )
> { print "<li>$activities{$_}</li> \n" }
> else
> { print "<li><a href=$_>$activities{$_}</a></li> \n" }
> }
Thank you for the above code. I'v been staring at it for a while and can't
understand why it shouldn't work.
But for some reason it always opts for the if condition to return the
no-link version no matter what the $current::page is so that all <li>'s in
the nested <ul> block becomes no-links.
Or its just too early in the morning for my cut-and-paste skills to work....
I've copied in the complete code down below, now including an if procedure
for the $firstkey hash occurance of the for loop, which does work to
display the no-link if page1.html is accessed, and otherwise displays the
relevant entry as a link as it should.
Its only the while-if-else bit posted above which I can't get to work for
in my code for some reason. Any ideas?
#!/usr/bin/perl -w
print "Content-type: text/html\n\n";
######## css bits #########
print "<head>\n";
print "<style>\n";
print ".green {background:green;}\n";
print ".yellow {background:yellow;\n";
print "</style>\n";
print "</head>\n\n";
######## some pre-procedures ########
use Tie::IxHash;
use strict;
use warnings;
tie my %location, "Tie::IxHash";
tie my %activities, "Tie::IxHash";
# Thanks for this bit, this much I can understand at this hour
$current::page = $ENV{DOCUMENT_NAME} || 'undefined';
######### the hashes with links ##########
%location = ('page1.html' => 'page one',
'ding.html' => 'DING',
'something.html' => 'Something');
%activities = ('fishing.html' => 'Fishing',
'diving.html' => 'Diving',
'trekking.html', => 'Trekking');
##### display first group of links with a loop ####
if (exists($location{$current::page})){
$class::value = "yellow";
}
else {
$class::value = "green";
}
print "<ul>\n";
for (\%location) {
my $firstkey = each %$_;
if ($current::page eq $firstkey){
print "<li class=$class::value>$location{$firstkey}\n";
}
else {
print "<li class=$class::value><a
href=$firstkey>$location{$firstkey}</a>\n";
}
print "<ul>\n";
# previous code:
# print "<li><a href=$_>$location{$_}</a></li> \n"while local $_ = each %$_;
# new code:
while ( local $_ = each %$_ ) {
if ( exists $location{$_} )
{ print "<li>$location{$_}</li> \n" }
else
{ print "<li><a href=$_>$location{$_}</a></li> \n" }
}
print "</ul>\n";
print "</li>\n";
}
print "</ul>";
#### display second group of links with loop ####
if (exists($activities{$current::page})){
$class::value = "yellow";
}
else {
$class::value = "green";
}
print "<ul>";
for (\%activities) {
my $firstkey = each %$_;
if ($current::page eq $firstkey){
print "<li class=$class::value>$activities{$firstkey}\n";
}
else {
print "<li class=$class::value><a
href=$firstkey>$activities{$firstkey}</a>\n";
}
print "<ul>\n";
# previous code:
# print "<li><a href=$_>$activities{$_}</a></li>" while local $_ = each %$_;
# new code:
while ( local $_ = each %$_ ) {
if ( exists $activities{$_} )
{ print "<li>$activities{$_}</li> \n" }
else
{ print "<li><a href=$_>$activities{$_}</a></li> \n" }
}
print "</ul>\n";
print "</li>\n";
}
print "</ul>";
------------------------------
Date: 23 Jul 2006 05:59:57 GMT
From: <corff@zedat.fu-berlin.de>
Subject: Re: Lingua::Han::PinYin and utf8 problem
Message-Id: <4ighitF3kkkeU1@uni-berlin.de>
Hello Peter,
Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
: On Sat, 22 Jul 2006 09:26:19 +0000, corff wrote:
: > my $h2p = new Lingua::Han::PinYin(format => 'utf8');
: There doesn't seem to be any format parameter for
: Lingua::Han::PinYin->new().
Interesting. What prompts your assumption? I copied and pasted the
Lingua::Han::PinYin-related stuff directly, AS IS, from its documentation,
including the (format... ) parameter.
: > #print $h2p->han2pinyin("�"),"\n";
: > #print $h2p->han2pinyin(chr(0x4e00)),"\n";
: > #print $h2p->han2pinyin("$name"),"\n";
: >
: > Uncomment the first print statement, and it prints "yi" as last line,
: > as expected.
: Note that the String "�" is 3 characters long, not 1 (you have 'use
: utf8' commented out).
I am afraid this unwanted conversion took place when uploading the minimal
script to the Usenet message (I am working in a text terminal which is not
utf8).
: That doesn't seem to have anything to do with scalars and literals.
: Instead, han2pinyin seems to expect an utf-8-encoded string.
: use Encode;
: print $h2p->han2pinyin(encode('utf-8', $name)),"\n";
I'll give it a try. Remains the question why the following two utf8-encoded
statements trigger an error message.
print $h2p->han2pinyin(chr(0x4e00)),"\n";
print $h2p->han2pinyin("$name"),"\n";
Thank you, you saved my day!
Oliver.
--
Dr. Oliver Corff e-mail: corff@zedat.fu-berlin.de
------------------------------
Date: Sun, 23 Jul 2006 06:59:00 +0100
From: Ben Morrow <benmorrow@tiscali.co.uk>
Subject: Re: my VAR = EXPR if COND
Message-Id: <4qfbp3-vn8.ln1@osiris.mauzo.dyndns.org>
Quoth David Squire <David.Squire@no.spam.from.here.au>:
> DJ Stunks wrote:
> > Ben Morrow wrote:
> >> Quoth "DJ Stunks" <DJStunks@gmail.com>:
> >>> grin.k1tt3n@gmail.com wrote:
> >>>> I just discovered the bug/feature of having a static variable if it
> >>>> initialized as:
> >>>>
> >>>> my $var = expr() if condition();
> >>>>
> >>>> That is, if condifition is not true, then var is initialized with
> >>>> whatever was last there.
> >>> I don't think I understand what you're getting at.
> >> I believe the OP is referring to this behaviour:
> >>
> >> ~% perl -le'sub foo { my $x if 0; print $x++ } foo; foo;'
> >> 0
> >> 1
> >> ~%
> >>
> >> which is a way of faking 'static' variables (note that without the C<if
> >> 0> you get 0 both times). This has always been undocumented (technically
> >> it's a bug), and in bleadperl (the dev track for 5.10) it has been
> >> replaced with proper static vars declared with the C<state> keyword. I'm
> >> not sure what will happen to this construct then: I wouldn't be
> >> surprised if it was fixed... so don't rely on it.
> >
> > so "static variable" would be synonymous with "private variable" as
> > through a closure?
>
> ITIM "static" as in one of the many uses of that keyword in C/C++: a
> variable that is static to a function retains its value between function
> calls. They are declared, for example, as "static int ever_called = 0;".
Yes.
> This functionality is similar to a variable declared outside a
> subroutine in a closure,
This is not about closures. Named subs don't close over their variables
in Perl, yet
{
my $x = 0;
sub foo { print $x++ }
}
will behave as above, indeed is the 'correct' way to declare it. The
disadvantage is that you have to create the extra scope outside the sub:
with C<state> vars you don't.
A closure is different in that you can end up with several different
copies of the sub with *different* copies of the variable: with
sub mkcounter {
my $x;
return sub { $x++ };
}
each time you call mkcounter you get a new counter, whereas with named
subs (which aren't closures)
sub mkcounter {
my $x;
sub counter { $x++ }
return \&counter;
}
there is only one, and you get a 'Variable "%s" will not stay shared'
warning to let you know that. Of course, sub names are global in scope,
so there's little point declaring one inside another anyway.
> though I suspect that there is more to closures
> than that (at least in other languages) - and in Perl you can have
> multiple subs in the same closure.
I'm not sure what you mean by that: a closure is just a sub+lexical
scope (padlist), so each closure 'contains' exactly one sub...
Ben
--
Although few may originate a policy, we are all able to judge it.
Pericles of Athens, c.430 B.C.
benmorrow@tiscali.co.uk
------------------------------
Date: Sun, 23 Jul 2006 04:42:07 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sun Jul 23 2006
Message-Id: <J2uAE7.CtG@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.
Acme-speeed-1.00
http://search.cpan.org/~memowe/Acme-speeed-1.00/
Makes your script terminate really fast!
----
AuthLLDAPSympa-1.0.0
http://search.cpan.org/~sebdiaz/AuthLLDAPSympa-1.0.0/
Authz module to authorize access asking sympa server if the user is subscribing a list. Usefull for working groups!!
----
Bot-BasicBot-Pluggable-Module-Assemble-0.01
http://search.cpan.org/~book/Bot-BasicBot-Pluggable-Module-Assemble-0.01/
IRC frontend to Regexp::Assemble
----
Bundle-Test-1.07
http://search.cpan.org/~szabgab/Bundle-Test-1.07/
A set of modules for software and hardware testing using Perl
----
CPAN-1.87_53
http://search.cpan.org/~andk/CPAN-1.87_53/
query, download and build perl modules from CPAN sites
----
Cache-BDB-0.04
http://search.cpan.org/~jdr/Cache-BDB-0.04/
An object caching wrapper around BerkeleyDB
----
Catalyst-Plugin-Cache-0.01
http://search.cpan.org/~nuffin/Catalyst-Plugin-Cache-0.01/
Flexible caching support for Catalyst.
----
Catalyst-Plugin-Cache-Store-FastMmap-0.01
http://search.cpan.org/~nuffin/Catalyst-Plugin-Cache-Store-FastMmap-0.01/
FastMmap cache store for Catalyst::Plugin::Cache.
----
DBIx-Class-0.07000
http://search.cpan.org/~mstrout/DBIx-Class-0.07000/
Extensible and flexible object <-> relational mapper.
----
Email-Abstract-2.11
http://search.cpan.org/~rjbs/Email-Abstract-2.11/
unified interface to mail representations
----
FLV-Info-0.10
http://search.cpan.org/~clotho/FLV-Info-0.10/
Extract metadata from Flash Video files
----
HTML-ParagraphSplit-0.01
http://search.cpan.org/~hanenkamp/HTML-ParagraphSplit-0.01/
Change text containing HTML into a formatted HTML fragment
----
HTML-ParagraphSplit-0.02
http://search.cpan.org/~hanenkamp/HTML-ParagraphSplit-0.02/
Change text containing HTML into a formatted HTML fragment
----
Jifty-0.60722
http://search.cpan.org/~jesse/Jifty-0.60722/
an application framework
----
Luka-1.08
http://search.cpan.org/~tpg/Luka-1.08/
Exception handling and reporting framework
----
Net-AIML-v0.0.1
http://search.cpan.org/~perigrin/Net-AIML-v0.0.1/
Perl interface to the Pandorabots.com AIML server
----
PAR-0.942
http://search.cpan.org/~smueller/PAR-0.942/
Perl Archive Toolkit
----
PAR-Dist-0.13
http://search.cpan.org/~smueller/PAR-Dist-0.13/
Create and manipulate PAR distributions
----
PAR-Dist-0.14
http://search.cpan.org/~smueller/PAR-Dist-0.14/
Create and manipulate PAR distributions
----
RT-Client-REST-0.11
http://search.cpan.org/~dmitri/RT-Client-REST-0.11/
talk to RT installation using REST protocol.
----
Sys-Syslog-0.17
http://search.cpan.org/~saper/Sys-Syslog-0.17/
Perl interface to the UNIX syslog(3) calls
----
WWW-Google-Video-0.4
http://search.cpan.org/~kenwu/WWW-Google-Video-0.4/
Fetch the Google Video Information
----
YAML-Syck-0.64
http://search.cpan.org/~audreyt/YAML-Syck-0.64/
Fast, lightweight YAML loader and dumper
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: Sat, 22 Jul 2006 22:55:35 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: numeric sort on string like a123-3
Message-Id: <Xns9808C09F836D5asu1cornelledu@127.0.0.1>
"filippo" <filippo2991@virgilio.it> wrote in news:1153555784.849392.145270
@75g2000cwc.googlegroups.com:
> I forgot to mention that I have also strings
> bungalow 1
> bungalow2
> a12-1
> a12
>
> etc
>
> Thanks,
Bye bye ...
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Sat, 22 Jul 2006 22:52:34 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: perl + regex bug?
Message-Id: <Xns9808C01C96C49asu1cornelledu@127.0.0.1>
nitroamos@gmail.com wrote in news:1153513835.324982.209140
@i42g2000cwa.googlegroups.com:
> hello -- i've been spending quite a bit of time trying to figure out
> this issue, and now that i've found a workaround, i'm wondering if the
> problem was a bug.
Please read #11907 at
http://groups.google.com/group/comp.lang.perl.misc/msg/b2f911d6d9c5cef2
> basically, i have some code that looks like this:
Please read the posting guidelines for this group. In particular,
1) Reduce your code to a short but complete example which illustrates
the problem
2) Post sample data which illustrates your problem.
> $orbitals[$i] =~ /\s+(\d)\s+Orbital Energy/;
What is in $orbitals[$i]?
What kind of black magic do you think would be able to figure out your
problem?
> $index = $1;
Do you really know that the match above actually succeeded? You probably
have some stale value in $1.
> $index--; $index++;
>
> if($element =~ /_${index}_/ or $element =~ m/_$index$/){
> print "$element matches $& with index = $index\n";
>
>
> }
>
> this is just a small part of my program, so i hope i've shown enough
> to isolate the bug.
No, not by a long shot.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Sun, 23 Jul 2006 00:50:10 GMT
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: UNIVERSAL::isa($object, 'UNIVERSAL') returns false?
Message-Id: <kevin-9A3177.20500722072006@news.verizon.net>
I ran across a problem yesterday that I traced back to this line in
Callback.pm:
if (ref $func ne 'CODE' && UNIVERSAL::isa($func, "UNIVERSAL")) {
$func was a blessed reference, so this should have been true. Instead,
sometimes it wasn't. It seems to depend on the data being processed at
the time, and I haven't yet been successful in producing anything
smaller than my entire program that can reproduce it yet.
One thing I discovered is that if I place a breakpoint here when the
comparison fails, and then (in the debugger) do the following:
use Scalar::Util qw(blessed);
p blessed $func
Not only does that print 1, but it makes the UNIVERSAL::isa function
return true afterwards as well!
This is in ActiveState Perl 5.6.1 (build 638). I haven't been able to
try to get this to fail under 5.8.x because I'm not able to move to that
version yet (interactions with Perl2Exe that I haven't had time to track
down yet, involving problems with regular expressions), although I
suspect that's the real solution.
As a workaround, I replaced the line above with
if (ref $func ne 'CODE' && blessed $func) {
which is fine for what I'm doing (internal utilities, compiled with
perl2exe and installed on workstations without Perl), but obviously not
ideal.
Note: it may not be clear from the above, but the problem shows up both
running under Perl2Exe and when just running normally.
I guess my Perl question is WTF?? I seem to recall reading somewhere
about a bug in "isa" in a particular Perl version that might have been
5.6.1, but I don't recall where now, and never did have any details.
Googling for "Perl bug UNIVERSAL isa" returns some very interesting
reading about the advisability of calling UNIVERSAL::isa as a function
in the first place, but nothing concrete that might relate to the above
problem.
--
Kevin Michael Vail | I would rather have a mind opened by wonder
kevin@vaildc.net | than one closed by belief. -- Gerry Spence
------------------------------
Date: Sun, 23 Jul 2006 11:59:05 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: UNIVERSAL::isa($object, 'UNIVERSAL') returns false?
Message-Id: <44c2d8d9$0$22362$afc38c87@news.optusnet.com.au>
"Kevin Michael Vail" <kevin@vaildc.net> wrote in message
news:kevin-9A3177.20500722072006@news.verizon.net...
> I ran across a problem yesterday that I traced back to this line in
> Callback.pm:
>
> if (ref $func ne 'CODE' && UNIVERSAL::isa($func, "UNIVERSAL")) {
>
What is Callback.pm ? I don't seem to have it (though I do have As build
638).
> $func was a blessed reference, so this should have been true. Instead,
> sometimes it wasn't. It seems to depend on the data being processed at
> the time, and I haven't yet been successful in producing anything
> smaller than my entire program that can reproduce it yet.
Keep working at producing a minimal demo .... I suspect it is what we really
need.
>
> One thing I discovered is that if I place a breakpoint here when the
> comparison fails, and then (in the debugger) do the following:
>
> use Scalar::Util qw(blessed);
> p blessed $func
>
> Not only does that print 1, but it makes the UNIVERSAL::isa function
> return true afterwards as well!
It might be useful to do a Devel::Peek::Dump($func) under the various
scenarios and look for differences. If Devel::Peek::Dump($func) *does* show
up some variations (which is by no means guaranteed) then that might help to
determine what's going on.
>
> This is in ActiveState Perl 5.6.1 (build 638). I haven't been able to
> try to get this to fail under 5.8.x because I'm not able to move to that
> version yet (interactions with Perl2Exe that I haven't had time to track
> down yet, involving problems with regular expressions), although I
> suspect that's the real solution.
>
> As a workaround, I replaced the line above with
>
> if (ref $func ne 'CODE' && blessed $func) {
>
> which is fine for what I'm doing (internal utilities, compiled with
> perl2exe and installed on workstations without Perl), but obviously not
> ideal.
>
> Note: it may not be clear from the above, but the problem shows up both
> running under Perl2Exe and when just running normally.
There's probably nothing to stop you from also installing the latest perl
5.8.8 and seeing whether the same problem still exists. Not sure that would
achieve much beyond determining whether the bug disappears with perl 5.8.8.
(When installing additional versions of ActiveState perl I always download
the zip package, rather than the msi, and then install by running the
'install.bat', making sure to *not* accept any options that will mess with
the registry or the path.)
>
> I guess my Perl question is WTF?? I seem to recall reading somewhere
> about a bug in "isa" in a particular Perl version that might have been
> 5.6.1, but I don't recall where now, and never did have any details.
Comparing 'perldoc UNIVERSAL' for both 5.6 and 5.8, I note that under perl
5.6, we are advised to *not* do 'use UNIVERSAL qw(isa)', whereas, with perl
5.8, it's quite ok to import UNIVERSAL functions into the main namespace.
Could that be what you're thinking of ?
Cheers,
Rob
------------------------------
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 9515
***************************************