[29890] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1133 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 20 03:09:51 2007

Date: Thu, 20 Dec 2007 00:09:15 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 20 Dec 2007     Volume: 11 Number: 1133

Today's topics:
    Re: CGI::Minimal and Cookies <ced@blv-sam-01.ca.boeing.com>
    Re: CGI::Minimal and Cookies <ben@morrow.me.uk>
    Re: FAQ 4.3 Why isn't my octal data interpreted correct <hjp-usenet2@hjp.at>
    Re: FAQ 4.3 Why isn't my octal data interpreted correct <hjp-usenet2@hjp.at>
        new CPAN modules on Thu Dec 20 2007 (Randal Schwartz)
    Re: PID of Service <rkb@i.frys.com>
    Re: regex question about ?, *, and $1 <rvtol+news@isolution.nl>
    Re: remove CR + trailing spaces <krahnj@telus.net>
    Re: remove CR + trailing spaces <danfan46@hotmail.com>
    Re: remove CR + trailing spaces <ben@morrow.me.uk>
    Re: remove CR + trailing spaces <rvtol+news@isolution.nl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 19 Dec 2007 11:32:03 -0800 (PST)
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: CGI::Minimal and Cookies
Message-Id: <8295d2f3-b870-40e0-9b43-b59bf42829da@b1g2000pra.googlegroups.com>

On Dec 18, 10:58 am, Ben Morrow <b...@morrow.me.uk> wrote:
 ...

> > Unfortunately you can't prevent a "use" from happening via subclassing.
>
>     {
>         local $INC{'CGI.pm'} = $0;
>         use CGI::Cookie;
>     }
>


Wouldn't that need a  BEGIN {} tweak  since
'use CGI::Cookie' loads earlier ... ?


> perhaps with a
>
>     {
>         package CGI;
>         use autouse CGI => 'header';
>     }
>
> as well. Of course, it will break if you call the ->bake method, so
> don't do that.


--
Charles DeRykus



------------------------------

Date: Wed, 19 Dec 2007 19:36:52 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: CGI::Minimal and Cookies
Message-Id: <kf8o35-qsb2.ln1@osiris.mauzo.dyndns.org>


Quoth "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>:
> On Dec 18, 10:58 am, Ben Morrow <b...@morrow.me.uk> wrote:
> > [Xho wrote:]
> > 
> > > Unfortunately you can't prevent a "use" from happening via subclassing.
> >
> >     {
> >         local $INC{'CGI.pm'} = $0;
> >         use CGI::Cookie;
> >     }
> 
> 
> Wouldn't that need a  BEGIN {} tweak  since
> 'use CGI::Cookie' loads earlier ... ?

Yes, of course. My mistake... :) To still achieve the 'local', it would
need to be

    BEGIN {
        local $INC{'CGI.pm'} = $0;
        require CGI::Cookie;
        CGI::Cookie->import(...);
    }

Ben



------------------------------

Date: Wed, 19 Dec 2007 20:32:48 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 4.3 Why isn't my octal data interpreted correctly?
Message-Id: <slrnfmisf0.n0u.hjp-usenet2@hrunkner.hjp.at>

On 2007-12-19 17:11, brian d foy <brian.d.foy@gmail.com> wrote:
> In article <slrnfmg4dg.go9.hjp-usenet2@hrunkner.hjp.at>, Peter J.
> Holzer <hjp-usenet2@hjp.at> wrote:
>
>> > I still say that Perl numbers are decimal unless we say otherwise.
>> 
>> That's easy to disprove:
>> 
>> % perl -l -e 'for ($i = 0; $i != 1; $i += 0.1) { print $i }' 
>
> I see Perl using the digits 0 to 9.
>
> There are underlying implementation details based on the architecture,
> but that's implementation. The language is not the processor or the
> storage. That there is some round-off error because of the limitations
> of computers doesn't change the fact that Perl is using the digits 0 to
> 9.

You are confusing Source code and run-time. I was talking about
run-time.


>> > Perl will treat them as decimal
>> 
>> No. Perl treats *strings* as decimal when used in a numeric context.
>
> No. Perl treats literal numbers as decimal.

Literal numbers are completely irrelevant to the matter at hand, which
is what the hex and oct functions do. Whether a literal is written in
decimal, hex or octal doesn't matter after the compiler is done with it.
The hex and oct functions don't have anything to do with literal
numbers. They take a string argument and return a number.


> When you talk about binary, you're talking about computer storage.
> That's something external to Perl. I'm just talking about Perl.

I am talking about the behaviour of perl at run-time. Which is what the
sentence in the FAQ entry I remarked upon talked about.
You seem to be talking about perl source code, which is a completely
different matter.

	hp



------------------------------

Date: Wed, 19 Dec 2007 20:41:24 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 4.3 Why isn't my octal data interpreted correctly?
Message-Id: <slrnfmisv4.n0u.hjp-usenet2@hrunkner.hjp.at>

On 2007-12-19 17:57, RedGrittyBrick <RedGrittyBrick@SpamWeary.foo> wrote:
> You and Peter seem to be arguing at cross-purposes. I believe Peter was
> objecting to the final words of this part of the FAQ:
>
>>> Perl only understands octal and hex numbers as such when they occur
>>>  as literals in your program. Octal literals in perl must start 
>>> with a leading 0 and hexadecimal literals must start with a leading
>>>  "0x". If they are read in from somewhere and assigned, no 
>>> automatic conversion takes place. You must explicitly use "oct()" 
>>> or "hex()" if you want the values converted to decimal.

Exactly.


> If, as I think you say, Perl doesn't care whether the internal
> representation of a number in perl (or some hypothetical other
> implementation) is decimal or binary, it might be clearer to end that
> paragraph thus:
>
>     You must explicitly use "oct()" or "hex()" if you want the
>     values converted from octal or hexadecimal representations.

Which is quite similar to the sentence I suggested, yes.

	hp


------------------------------

Date: Thu, 20 Dec 2007 05:42:18 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Thu Dec 20 2007
Message-Id: <JtC2II.1zD5@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.

App-Module-Lister-0.10_01
http://search.cpan.org/~bdfoy/App-Module-Lister-0.10_01/
----
Archive-Cpio-0.07
http://search.cpan.org/~pixel/Archive-Cpio-0.07/
module for manipulations of cpio archives 
----
Cache-FastMmap-Tie-0.01
http://search.cpan.org/~suzuki/Cache-FastMmap-Tie-0.01/
Using Cache::FastMmap as hash 
----
Catalyst-Authentication-Store-FromSub-Hash-0.04
http://search.cpan.org/~fayland/Catalyst-Authentication-Store-FromSub-Hash-0.04/
A storage class for Catalyst Authentication using one Catalyst Model class (hash returned) 
----
Catalyst-Model-DBIC-Schema-QueryLog-0.05
http://search.cpan.org/~fayland/Catalyst-Model-DBIC-Schema-QueryLog-0.05/
DBIx::Class::QueryLog Model Class 
----
CatalystX-CRUD-0.17
http://search.cpan.org/~karman/CatalystX-CRUD-0.17/
CRUD framework for Catalyst applications 
----
CatalystX-CRUD-View-Excel-0.01
http://search.cpan.org/~karman/CatalystX-CRUD-View-Excel-0.01/
view CRUD search/list results in Excel format 
----
Chart-Clicker-1.4.2
http://search.cpan.org/~gphat/Chart-Clicker-1.4.2/
Powerful, extensible charting. 
----
Data-YUID-0.03
http://search.cpan.org/~miyagawa/Data-YUID-0.03/
Distributed ID generator ("Yet another Unique ID") 
----
Devel-PerlySense-0.0136
http://search.cpan.org/~johanl/Devel-PerlySense-0.0136/
IntelliSense for Perl 
----
Email-Address-1.889
http://search.cpan.org/~rjbs/Email-Address-1.889/
RFC 2822 Address Parsing and Creation 
----
FCGI-ProcManager-0.18
http://search.cpan.org/~gbjk/FCGI-ProcManager-0.18/
functions for managing FastCGI applications. 
----
File-Find-Node-0.01
http://search.cpan.org/~scl/File-Find-Node-0.01/
Recursively traverses a directory tree and processes each item using callback functions supplied by the user. 
----
Finance-Bank-Cahoot-0.02
http://search.cpan.org/~masaccio/Finance-Bank-Cahoot-0.02/
Check your Cahoot bank accounts from Perl 
----
Form-Processor-Model-CDBI-0.07
http://search.cpan.org/~hank/Form-Processor-Model-CDBI-0.07/
model class for Form::Processor based on Class::DBI 
----
Geography-Countries-LatLong-1.0
http://search.cpan.org/~lgoddard/Geography-Countries-LatLong-1.0/
Mean latitude and longitude 
----
Ham-APRS-FAP-1.00
http://search.cpan.org/~hessu/Ham-APRS-FAP-1.00/
Finnish APRS Parser (Fabulous APRS Parser) 
----
Ham-APRS-FAP-1.01
http://search.cpan.org/~hessu/Ham-APRS-FAP-1.01/
Finnish APRS Parser (Fabulous APRS Parser) 
----
Hash-Extract-0.02
http://search.cpan.org/~hio/Hash-Extract-0.02/
extract hash values onto lexical variables. 1 
----
Image-GD-Thumbnail-0.041
http://search.cpan.org/~lgoddard/Image-GD-Thumbnail-0.041/
produce thumbnail images with GD 
----
Image-Magick-Thumbnail-0.05
http://search.cpan.org/~lgoddard/Image-Magick-Thumbnail-0.05/
Produces thumbnail images with ImageMagick 
----
Image-Thumbnail-0.63
http://search.cpan.org/~lgoddard/Image-Thumbnail-0.63/
Simple thumbnails with GD/ImageMagick/Imager 
----
InSilicoSpectro-Databanks-0.0.29
http://search.cpan.org/~alexmass/InSilicoSpectro-Databanks-0.0.29/
parsing protein/nucleotides sequence databanks (fasta, uniprot...) 
----
JSON-2.00
http://search.cpan.org/~makamaka/JSON-2.00/
JSON (JavaScript Object Notation) encoder/decoder 
----
JSON-2.01
http://search.cpan.org/~makamaka/JSON-2.01/
JSON (JavaScript Object Notation) encoder/decoder 
----
JSON-RPC-0.90
http://search.cpan.org/~makamaka/JSON-RPC-0.90/
Perl implementation of JSON-RPC 1.1 protocol 
----
JSON-RPC-0.91
http://search.cpan.org/~makamaka/JSON-RPC-0.91/
Perl implementation of JSON-RPC 1.1 protocol 
----
Language-MuldisD-0.14.0
http://search.cpan.org/~duncand/Language-MuldisD-0.14.0/
Formal spec of Muldis D relational DBMS lang 
----
Mail-SpamAssassin-SimpleClient-0.006
http://search.cpan.org/~rjbs/Mail-SpamAssassin-SimpleClient-0.006/
easy client to SpamAssassin's spamd 
----
Module-CoreList-2.13
http://search.cpan.org/~rgarcia/Module-CoreList-2.13/
what modules shipped with versions of perl 
----
MooseX-SimpleConfig-0.02
http://search.cpan.org/~blblack/MooseX-SimpleConfig-0.02/
A Moose role for setting attributes from a simple configfile 
----
Net-Google-Calendar-0.92
http://search.cpan.org/~simonw/Net-Google-Calendar-0.92/
programmatic access to Google's Calendar API 
----
Net-Ping-2.34
http://search.cpan.org/~smpeters/Net-Ping-2.34/
check a remote host for reachability 
----
POE-Component-Client-NSCA-0.05
http://search.cpan.org/~bingos/POE-Component-Client-NSCA-0.05/
a POE Component that implements send_nsca functionality 
----
POE-Component-MessageQueue-0.1.7
http://search.cpan.org/~dsnopek/POE-Component-MessageQueue-0.1.7/
A POE message queue that uses STOMP for the communication protocol 
----
Parse-Eyapp-1.096
http://search.cpan.org/~casiano/Parse-Eyapp-1.096/
Extensions for Parse::Yapp 
----
Parse-Marpa-0.001_058
http://search.cpan.org/~jkegl/Parse-Marpa-0.001_058/
(pre-Alpha) Jay Earley's general parsing algorithm, with LR(0) precomputation 
----
Perl-Dist-0.51
http://search.cpan.org/~adamk/Perl-Dist-0.51/
Perl Distribution Creation Toolkit 
----
Pod-Advent-0.03
http://search.cpan.org/~davidrw/Pod-Advent-0.03/
POD Formatter for The Perl Advent Calendar 
----
Pod-Advent-0.04
http://search.cpan.org/~davidrw/Pod-Advent-0.04/
POD Formatter for The Perl Advent Calendar 
----
Pod-POM-Web-1.09
http://search.cpan.org/~dami/Pod-POM-Web-1.09/
HTML Perldoc server 
----
SOAP-WSDL-2.00_27
http://search.cpan.org/~mkutter/SOAP-WSDL-2.00_27/
SOAP with WSDL support 
----
Scalar-Defer-0.12
http://search.cpan.org/~audreyt/Scalar-Defer-0.12/
Lazy evaluation in Perl 
----
Sledge-Config-YAML-0.06
http://search.cpan.org/~mikihoshi/Sledge-Config-YAML-0.06/
The configuration file of Sledge can be written by using YAML. 
----
Sol-Parser-0.01
http://search.cpan.org/~aff/Sol-Parser-0.01/
a .sol file reader 
----
Test-WWW-Mechanize-Runner-0.0.1
http://search.cpan.org/~sukria/Test-WWW-Mechanize-Runner-0.0.1/
test-suites maker for "WWW::Mechanize"-compatible agents. 
----
Text-GooglewikiFormat-0.02
http://search.cpan.org/~fayland/Text-GooglewikiFormat-0.02/
Translate Google Code Wiki markup into HTML 
----
Text-GooglewikiFormat-0.03
http://search.cpan.org/~fayland/Text-GooglewikiFormat-0.03/
Translate Google Code Wiki markup into HTML 
----
Text-GooglewikiFormat-0.04
http://search.cpan.org/~fayland/Text-GooglewikiFormat-0.04/
Translate Google Code Wiki markup into HTML 
----
Text-Restructured-0.003037
http://search.cpan.org/~nodine/Text-Restructured-0.003037/
Perl implementation of reStructuredText parser 
----
Time-Simple-0.053
http://search.cpan.org/~lgoddard/Time-Simple-0.053/
A simple, light-weight ISO 8601 time object. 
----
Tk-Wizard-2.123
http://search.cpan.org/~lgoddard/Tk-Wizard-2.123/
GUI for step-by-step interactive logical process 
----
WWW-Reddit-0.02
http://search.cpan.org/~amoore/WWW-Reddit-0.02/
interface with reddit.com 
----
WebService-EveOnline-0.04
http://search.cpan.org/~chrisc/WebService-EveOnline-0.04/
a wrapper intended to (eventually) provide a consistent interface to the MMORPG game, "Eve Online" 
----
dan-0.551.1
http://search.cpan.org/~yappo/dan-0.551.1/
The literal unread 


If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.

This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
  http://www.stonehenge.com/merlyn/LinuxMag/col82.html

print "Just another Perl hacker," # the original

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Wed, 19 Dec 2007 13:33:08 -0800 (PST)
From: Ron Bergin <rkb@i.frys.com>
Subject: Re: PID of Service
Message-Id: <356e588b-ffc6-49c0-af7f-a5cbee11beb8@d4g2000prg.googlegroups.com>

On Dec 19, 6:07 am, "Ferry Bolhar" <b...@adv.magwien.gv.at> wrote:
> Good day to all,
>
> Given the name of a Win32 service, is there a way to find out its PID from a
> Perl script?
>
> I looked at Win32::Service and Win32::Daemon modules, but couldn't find a
> way for this.
>
> Kind greetings,
>
> --
> Ing Ferry Bolhar
> Magistrat der Stadt Wien - MA 14
> A-1010 Wien
> E-Mail: ferdinand.bolhar-nordenka...@wien.gv.at

use strict;
use warnings;
use Win32::Process::Info;

my $pi = Win32::Process::Info->new ();
my ($info) = grep {$_->{Name} =~ m/msnmsgr/} $pi->GetProcInfo();
print $info->{ProcessId};


------------------------------

Date: Thu, 20 Dec 2007 00:07:35 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: regex question about ?, *, and $1
Message-Id: <fkcbvo.1ls.1@news.isolution.nl>

vorticitywolfe@gmail.com schreef:

> if $string =~ m/(-|\+)*(AB|YZ)*(EF|CD)*\s??(PL|PS|PT)*?/g{
>      print $1,$2,$3,$4;
> }
>
> $string = 2340Z 4SL PS T1203045;
>
> It doesn't return anything for $1,$2,$3 or $4
> Why?

I would change things like "(AB|YZ)*" to something like "((?:AB|YZ)?)".

-- 
Affijn, Ruud

"Gewoon is een tijger."



------------------------------

Date: Wed, 19 Dec 2007 19:18:12 GMT
From: "John W. Krahn" <krahnj@telus.net>
Subject: Re: remove CR + trailing spaces
Message-Id: <47696E64.176A1A51@telus.net>

Dan van Ginhoven wrote:
> 
> I had some files on my Linux server containing  Dos/Win style CRLF and also
> trailing spaces on most lines.
> 
> I ran this one-liner perl on them:
> cat localfn | perl -p -e "s/\r//;s/\s*$//;" > tempname
> To my surprise both CR and LF was removed and I ended up with a file with
> just one long line.
> 
> When I changed the one-liner to
> cat localfn | perl -p -e "s/\r//;s/\s*$/\n/;" > tempname
> it came out OK.
> 
> What am I missing?

The character class \s includes both the \r character and the \n
character.

perldoc perlre


You could simplify that to:

perl -lpe "s/\s+\z//" localfn > tempname


Or if you want to modify localfn "in-place":

perl -i.bak -lpe "s/\s+\z//" localfn



John
-- 
use Perl;
program
fulfillment


------------------------------

Date: Wed, 19 Dec 2007 19:35:58 GMT
From: "Dan van Ginhoven" <danfan46@hotmail.com>
Subject: Re: remove CR + trailing spaces
Message-Id: <yoeaj.1848$R_4.1361@newsb.telia.net>

Thanks John.
>
> The character class \s includes both the \r character and the \n
> character.
>




------------------------------

Date: Wed, 19 Dec 2007 19:33:54 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: remove CR + trailing spaces
Message-Id: <2a8o35-qsb2.ln1@osiris.mauzo.dyndns.org>


Quoth "Dan van Ginhoven" <danfan46@hotmail.com>:
>
> I had some files on my Linux server containing  Dos/Win style CRLF and also
> trailing spaces on most lines.
> 
> I ran this one-liner perl on them:
> cat localfn | perl -p -e "s/\r//;s/\s*$//;" > tempname

Useless Use Of Cat.
    
    perl ... < localfn > tempname

or use perl -i.

> To my surprise both CR and LF was removed and I ended up with a file with
> just one long line.

\s matches \n, so this will remove all LFs.

> When I changed the one-liner to
> cat localfn | perl -p -e "s/\r//;s/\s*$/\n/;" > tempname
> it came out OK.

This will remove any blank lines, as well. You want

    s/[\r\t ]+$//;

or (with 5.10)

    s/[\r\h]+$//;

or use perl -l, which will remove the "\n" before doing the s///, and
add it back on afterwards.

Ben



------------------------------

Date: Thu, 20 Dec 2007 00:08:57 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: remove CR + trailing spaces
Message-Id: <fkcbvq.1ls.1@news.isolution.nl>

Dan van Ginhoven schreef:

> cat localfn | perl -p -e "s/\r//;s/\s*$//;" > tempname
> To my surprise both CR and LF was removed and I ended up with a file
> with just one long line.

Consider [[:blank:]] in stead of \s. 

-- 
Affijn, Ruud

"Gewoon is een tijger."


------------------------------

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 1133
***************************************


home help back first fref pref prev next nref lref last post