[30541] in Perl-Users-Digest
Perl-Users Digest, Issue: 1784 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 11 03:09:41 2008
Date: Mon, 11 Aug 2008 00:09:06 -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 Mon, 11 Aug 2008 Volume: 11 Number: 1784
Today's topics:
double slash operator syntax question <usenet@larseighner.com>
Re: double slash operator syntax question <mattj.morrison@gmail.com>
Re: double slash operator syntax question <ben@morrow.me.uk>
Re: double slash operator syntax question <mjcarman@mchsi.com>
Re: double slash operator syntax question <usenet@larseighner.com>
Re: FAQ 4.70 How can I use a reference as a hash key? <ben@morrow.me.uk>
Re: How to catch refs to nonexistent sub names at compi <ben@morrow.me.uk>
Jobs, Interview Questions, Certification, Knowledge <naveen.rao001@gmail.com>
Mail::Mailer - 'Reply To' <asuter@cisco.com>
Re: Mail::Mailer - 'Reply To' <asuter@cisco.com>
Re: modifying the haystack string inside while($haystac <eric-amick@comcast.net>
new CPAN modules on Mon Aug 11 2008 (Randal Schwartz)
Re: OO Perl <mattj.morrison@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 11 Aug 2008 01:35:10 +0000 (UTC)
From: Lars Eighner <usenet@larseighner.com>
Subject: double slash operator syntax question
Message-Id: <slrng9v5ef.bg7.usenet@debranded.larseighner.com>
I may have asked this in another form recently, but I'm senile, so indulge
me.
What I want to do: if $lb_lang is undefined, I want to set it.
What I wrote:
$lb_lang // {$lb_lang = 'en'};
What perl -w yelled:
Useless use of single ref constructor in void context at etc.
But it seems to work in spite of the yelling.
If I omit the braces, it dies with:
Can't modify defined or (//) at etc.
My understanding of what // is supposed to be: It is like
|| but tests the left side for definedness instead of for value,
so this should be like a || command list.
--
Lars Eighner <http://larseighner.com/> usenet@larseighner.com
War on Terrorism: Okay, Unleash OUR Extreme Fundamentalists
"... all of them who have tried to secularize America, I point the finger in
their face and say, 'You helped this happen.'" --Jerry Falwell
------------------------------
Date: Sun, 10 Aug 2008 18:52:54 -0700 (PDT)
From: Matt <mattj.morrison@gmail.com>
Subject: Re: double slash operator syntax question
Message-Id: <6972e8d6-79f2-4798-bfd9-8e8d1a89bfe7@e39g2000hsf.googlegroups.com>
I don't know about // being some kind of operator other than a pattern
match operator...but you could accomplish that like this
$lb_lang =3D $lb_lang ? $lb_lang : "en";
or like this
$lb_lang =3D $lb_lang || "en";
I think either of those should work.
On Aug 10, 8:35=A0pm, Lars Eighner <use...@larseighner.com> wrote:
> I may have asked this in another form recently, but I'm senile, so indulg=
e
> me.
>
> What I want to do: =A0if $lb_lang is undefined, I want to set it.
>
> What I wrote:
>
> $lb_lang // {$lb_lang =3D 'en'};
>
> What perl -w yelled:
>
> Useless use of single ref constructor in void context at etc.
> But it seems to work in spite of the yelling.
>
> If I omit the braces, it dies with:
> Can't modify defined or (//) at etc.
>
> My understanding of what // is supposed to be: =A0It is like
> || but tests the left side for definedness instead of for value,
> so this should be like a || command list.
>
> --
> Lars Eighner <http://larseighner.com/> use...@larseighner.com
> =A0 =A0 =A0 =A0 War on Terrorism: =A0Okay, Unleash OUR Extreme Fundamenta=
lists
> "... all of them who have tried to secularize America, I point the finger=
in
> =A0 =A0 =A0 =A0their face and say, 'You helped this happen.'" =A0--Jerry =
Falwell
------------------------------
Date: Mon, 11 Aug 2008 03:55:10 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: double slash operator syntax question
Message-Id: <e9m4n5-i8n.ln1@osiris.mauzo.dyndns.org>
Quoth Lars Eighner <usenet@larseighner.com>:
> I may have asked this in another form recently, but I'm senile, so indulge
> me.
>
> What I want to do: if $lb_lang is undefined, I want to set it.
>
> What I wrote:
>
> $lb_lang // {$lb_lang = 'en'};
$lb_lang //= 'en';
> What perl -w yelled:
>
> Useless use of single ref constructor in void context at etc.
> But it seems to work in spite of the yelling.
Well, sort-of. You are actually constructing an anon hashref out of the
single-element list ('en') (and I'm slightly surprised -w didn't warn
about that, as well), and assigning to $lb_lang as a side-effect. Using
the array constructor
$lb_lang // [$lb_lang = 'en'];
would work just as well; or, since you don't need to build a useless
data structure,
$lb_lang // do { $lb_lang = 'en' };
'do' makes the block into a block, rather than an anon hash.
(Annoyingly, the 'err' operator which was the low-precedence form of //
was removed just before 5.10.0. I never really understood why...)
> My understanding of what // is supposed to be: It is like
> || but tests the left side for definedness instead of for value,
> so this should be like a || command list.
Yes, exactly.
$lb_lang || {$lb_lang = 'en'};
behaves exactly the same way (except for the test performed).
Ben
--
All persons, living or dead, are entirely coincidental.
ben@morrow.me.uk Kurt Vonnegut
------------------------------
Date: Mon, 11 Aug 2008 03:17:30 GMT
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: double slash operator syntax question
Message-Id: <ebOnk.292718$yE1.188967@attbi_s21>
Matt wrote:
> I don't know about // being some kind of operator other than a pattern
> match operator...but you could accomplish that like this
It's the defined-or operator that was added in Perl 5.10. It's like ||
but tests for definedness instead of truth.
> $lb_lang = $lb_lang ? $lb_lang : "en";
> $lb_lang = $lb_lang || "en";
>
> I think either of those should work.
Not quite; those both test for boolean truth. The OP stated that he
wanted to set the variable if it wasn't _defined_. The important
difference is the behavior if the initial value of $lb_lang is defined
but false (0, '0', or '')
The typical ways of doing this prior to Perl 5.10 are:
$lb_lang = defined($lb_lang) ? $lb_lang : 'en';
or
$lb_lang = 'en' unless defined $lb_lang;
-mjc
------------------------------
Date: Mon, 11 Aug 2008 03:55:18 +0000 (UTC)
From: Lars Eighner <usenet@larseighner.com>
Subject: Re: double slash operator syntax question
Message-Id: <slrng9vdl7.bnm.usenet@debranded.larseighner.com>
In our last episode,
<ebOnk.292718$yE1.188967@attbi_s21>,
the lovely and talented Michael Carman
broadcast on comp.lang.perl.misc:
> Matt wrote:
>> I don't know about // being some kind of operator other than a pattern
>> match operator...but you could accomplish that like this
> It's the defined-or operator that was added in Perl 5.10. It's like ||
> but tests for definedness instead of truth.
It's in 5.8.8 or my perl is lying.
--
Lars Eighner <http://larseighner.com/> usenet@larseighner.com
If it wasn't for muscle spasms, I wouldn't get any exercise at all.
------------------------------
Date: Sun, 10 Aug 2008 17:46:56 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: FAQ 4.70 How can I use a reference as a hash key?
Message-Id: <0li3n5-2f1.ln1@osiris.mauzo.dyndns.org>
Quoth xhoster@gmail.com:
> brian d foy <brian.d.foy@gmail.com> wrote:
> >
> > I don't think that's what I meant. I don't know enough internals to
> > mean something like that. Would a completely different variable that
> > got the same address be available through the hash value? That seems
> > pretty twisted to me if so.
>
> If the original reference is stored in a subsidiary data structure (like
> Tie::RefHash does), then that subsidiary structure keeps an active
> reference to it so its address can't get re-used. If they aren't using
> RefHash, then I don't know what it is that they are doing or what the
> consequences might be.
Well, the obvious thing to be doing is inside-out object, that is,
objects created like this:
package Foo;
my %field;
sub new {
my $self = bless [], shift;
$field{$self} = shift;
}
sub field {
my $self = shift;
$field{$self} = shift if @_;
return $field{$self};
}
There are better ways of doing this (use Hash::Util::Fieldhash, use
Object::InsideOut, apply Scalar::Util::refaddr extensively and attempt
to handle threads and GC manually) but this is the most obvious.
Ben
--
Every twenty-four hours about 34k children die from the effects of poverty.
Meanwhile, the latest estimate is that 2800 people died on 9/11, so it's like
that image, that ghastly, grey-billowing, double-barrelled fall, repeated
twelve times every day. Full of children. [Iain Banks] ben@morrow.me.uk
------------------------------
Date: Sun, 10 Aug 2008 17:49:30 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: How to catch refs to nonexistent sub names at compilation time ?
Message-Id: <qpi3n5-2f1.ln1@osiris.mauzo.dyndns.org>
Quoth Peter Scott <Peter@PSDT.com>:
> On Sun, 10 Aug 2008 00:20:45 -0700, Yakov wrote:
> > But I'd like to catch ref to apparently nonexistent subroutine at
> > compile-time.
>
> The reason this hasn't been done is that in general, it is impossible.
> Try doing it for this code:
>
> chomp(my $sub = <STDIN>);
> $sub->(42);
> sub foo { print shift }
Can't use string ("foo") as a subroutine ref while "strict refs" is in
use at ...
> What subroutine does $sub refer to? So this is only possible by ignoring
> the possibility of dynamically constructed subroutine references. And
> doing it for method calls is hair raising.
Method calls are a whole nother kettle of fish.
Ben
--
I must not fear. Fear is the mind-killer. I will face my fear and
I will let it pass through me. When the fear is gone there will be
nothing. Only I will remain.
ben@morrow.me.uk Frank Herbert, 'Dune'
------------------------------
Date: Sun, 10 Aug 2008 08:46:37 -0700 (PDT)
From: Naveen <naveen.rao001@gmail.com>
Subject: Jobs, Interview Questions, Certification, Knowledge
Message-Id: <de815f2b-2257-451f-a202-82108b064aad@n33g2000pri.googlegroups.com>
Hi All,
Please visit www.itjobguru.com/forum/index.php, if you are
1. Looking for a Job Change =96 Java, .NET, Oracle, SQL Server,
Informatica, Cognos, SAP
2. For Latest Interview Questions =96 Java, .NET, Oracle, SQL
Server,
Informatica, Cognos, SAP
3. Planning to write Certification =96 Java, .NET, Oracle, SQL
Server,
SAP
4. Increase your Knowledge Levels.
See you on board!!!
Regards,
Naveen
------------------------------
Date: Sun, 10 Aug 2008 19:20:15 -0700
From: "Asim Suter" <asuter@cisco.com>
Subject: Mail::Mailer - 'Reply To'
Message-Id: <1218421215.811245@sj-nntpcache-3.cisco.com>
Hi,
It is possible to set 'Reply To' address
in Mail::Mailer ?
If so, is it possible to set more than one ids for that value.
I have a script that sends out email - When people reply to those
emails by default I'd like the reply emails to go to a different set of
recipients.[ more than one ids ]
Is this possible ?
TIA.
------------------------------
Date: Sun, 10 Aug 2008 19:24:39 -0700
From: "Asim Suter" <asuter@cisco.com>
Subject: Re: Mail::Mailer - 'Reply To'
Message-Id: <1218421480.905869@sj-nntpcache-3.cisco.com>
'Reply-to' seems to do it - can handle multiple ids it seems.
"Asim Suter" <asuter@cisco.com> wrote in message
news:1218421215.811245@sj-nntpcache-3.cisco.com...
>
> Hi,
>
> It is possible to set 'Reply To' address
> in Mail::Mailer ?
>
> If so, is it possible to set more than one ids for that value.
>
> I have a script that sends out email - When people reply to those
> emails by default I'd like the reply emails to go to a different set of
> recipients.[ more than one ids ]
>
> Is this possible ?
>
> TIA.
>
------------------------------
Date: Sun, 10 Aug 2008 16:36:24 -0400
From: Eric Amick <eric-amick@comcast.net>
Subject: Re: modifying the haystack string inside while($haystack =~ /needle/g) { ... }
Message-Id: <47ku949u3lfoc2mk0tghvtmi8ul6iagau3@4ax.com>
On Sun, 10 Aug 2008 00:25:43 -0700 (PDT), Yakov <iler.ml@gmail.com>
wrote:
>What exactly happens if I modify the $haystack inside such while (see
>subject) ?
It's documented in perldoc perlop. The position is reset to 0.
--
Eric Amick
Columbia, MD
------------------------------
Date: Mon, 11 Aug 2008 04:42:20 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Aug 11 2008
Message-Id: <K5F6EK.rL2@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.
Atomik-0.00001_02
http://search.cpan.org/~dmaki/Atomik-0.00001_02/
An Atom/AtomPub Framework
----
CDB_Perl-0.54
http://search.cpan.org/~plank/CDB_Perl-0.54/
Perl extension for reading and creating CDB files
----
CGI-Application-4.11
http://search.cpan.org/~markstos/CGI-Application-4.11/
Framework for building reusable web-applications
----
CGI-CMS-0.35
http://search.cpan.org/~lze/CGI-CMS-0.35/
Content Managment System that runs under mod_perl and and as cgi script.
----
CGI-Lazy-0.05
http://search.cpan.org/~vayde/CGI-Lazy-0.05/
----
CPANPLUS-Dist-Mdv-0.3.7
http://search.cpan.org/~jquelin/CPANPLUS-Dist-Mdv-0.3.7/
a cpanplus backend to build mandriva rpms
----
CatalystX-ListFramework-Builder-0.18
http://search.cpan.org/~oliver/CatalystX-ListFramework-Builder-0.18/
Instant AJAX web front-end for DBIx::Class, using Catalyst
----
Data-ParseBinary-0.03
http://search.cpan.org/~semuelf/Data-ParseBinary-0.03/
Yet Another parser for binary structures
----
EekBoek-1.03.92
http://search.cpan.org/~jv/EekBoek-1.03.92/
Bookkeeping software for small and medium-size businesses
----
GD-SVG-0.30
http://search.cpan.org/~twh/GD-SVG-0.30/
Seamlessly enable SVG output from scripts written using GD
----
HTML-Template-Compiled-0.92_001
http://search.cpan.org/~tinita/HTML-Template-Compiled-0.92_001/
Template System Compiles HTML::Template files to Perl code
----
Ham-Reference-QRZ-0.01
http://search.cpan.org/~bradmc/Ham-Reference-QRZ-0.01/
An object oriented front end for the QRZ.COM Amateur Radio callsign database
----
List-Enumerator-0.04
http://search.cpan.org/~satoh/List-Enumerator-0.04/
list construct library
----
Log-Log4perl-DataDumper-0.01
http://search.cpan.org/~ctilmes/Log-Log4perl-DataDumper-0.01/
Wrapper for Log4perl auto Data::Dumper objects
----
MediaWiki-API-0.13
http://search.cpan.org/~exobuzz/MediaWiki-API-0.13/
Provides a Perl interface to the MediaWiki API (http://www.mediawiki.org/wiki/API)
----
Module-CPANTS-ProcessCPAN-0.77
http://search.cpan.org/~domm/Module-CPANTS-ProcessCPAN-0.77/
Generate Kwalitee ratings for the whole CPAN
----
Module-CPANTS-Site-0.76
http://search.cpan.org/~domm/Module-CPANTS-Site-0.76/
Catalyst based application
----
MooseX-DOM-0.00002
http://search.cpan.org/~dmaki/MooseX-DOM-0.00002/
Simplistic Object XML Mapper
----
MooseX-DOM-0.00003
http://search.cpan.org/~dmaki/MooseX-DOM-0.00003/
Simplistic Object XML Mapper
----
MooseX-Timestamp-0.05
http://search.cpan.org/~samv/MooseX-Timestamp-0.05/
simple timestamp type for Moose, with Time Zone
----
Net-CUPS-0.57
http://search.cpan.org/~dhageman/Net-CUPS-0.57/
Common Unix Printing System Interface
----
OpenVZ-BC-0.02
http://search.cpan.org/~wilsond/OpenVZ-BC-0.02/
Perl access to OpenVZ Beancounter Data
----
PAR-0.982
http://search.cpan.org/~smueller/PAR-0.982/
Perl Archive Toolkit
----
PAR-Repository-0.15
http://search.cpan.org/~smueller/PAR-Repository-0.15/
Create and modify PAR repositories
----
PDF-API2-0.71
http://search.cpan.org/~areibens/PDF-API2-0.71/
A Perl Module Chain to faciliate the Creation and Modification of High-Quality "Portable Document Format (aka. PDF)" Files.
----
PDF-API2-0.71.001
http://search.cpan.org/~areibens/PDF-API2-0.71.001/
A Perl Module Chain to faciliate the Creation and Modification of High-Quality "Portable Document Format (aka. PDF)" Files.
----
POOF-1.2
http://search.cpan.org/~bmillares/POOF-1.2/
Perl extension that provides stronger typing, encapsulation and inheritance.
----
POOF-1.3
http://search.cpan.org/~bmillares/POOF-1.3/
Perl extension that provides stronger typing, encapsulation and inheritance.
----
Perl-Dist-1.04
http://search.cpan.org/~adamk/Perl-Dist-1.04/
Perl Distribution Creation Toolkit
----
Perl-Dist-Strawberry-1.04
http://search.cpan.org/~adamk/Perl-Dist-Strawberry-1.04/
Strawberry Perl for win32
----
Perl-Metrics-Simple-0.12
http://search.cpan.org/~matisse/Perl-Metrics-Simple-0.12/
Count packages, subs, lines, etc. of many files.
----
PerlIO-via-EscStatus-1
http://search.cpan.org/~kryde/PerlIO-via-EscStatus-1/
dumb terminal status display layer
----
Remote-Use-0.03
http://search.cpan.org/~casiano/Remote-Use-0.03/
Using modules from a remote server
----
Spreadsheet-WriteExcel-2.23
http://search.cpan.org/~jmcnamara/Spreadsheet-WriteExcel-2.23/
Write to a cross-platform Excel binary file.
----
Test.php-0.13
http://search.cpan.org/~avar/Test.php-0.13/
TAP test framework for PHP with a Test::More-like interface
----
WWW-Ohloh-API-0.3.0
http://search.cpan.org/~yanick/WWW-Ohloh-API-0.3.0/
Ohloh API implementation
----
indirect-0.01
http://search.cpan.org/~vpit/indirect-0.01/
Lexically warn about using the indirect object syntax.
----
kurila-1.13_0
http://search.cpan.org/~tty/kurila-1.13_0/
Perl Kurila
----
makepp-1.50-cvs-080810
http://search.cpan.org/~pfeiffer/makepp-1.50-cvs-080810/
Compatible but improved replacement for make
----
reform-0.2
http://search.cpan.org/~hkoch/reform-0.2/
Third millenium syntax for Perl 5 OOP
----
reform-0.3
http://search.cpan.org/~hkoch/reform-0.3/
Third millenium syntax for Perl 5 OOP
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/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Sun, 10 Aug 2008 09:26:36 -0700 (PDT)
From: Matt <mattj.morrison@gmail.com>
Subject: Re: OO Perl
Message-Id: <7ae13407-591a-4cab-ba7f-02e1fcfd99f0@l64g2000hse.googlegroups.com>
Here is the thing. Everything that's done is Perl to "extend the
language" is done in Modules - which is the way its done, but that
just doesn't work for me. I don't want to install Moose and any of
the other Module dependencies it may have. The tooling to make
installing Modules for Perl just doesn't exist..here is an example.
I've got a web server - which I rent for a monthly fee. I'm not an
admin on that server, and I don't have root access. So any Perl
modules that I install must be to MY directory only...which I know can
be done, but the thing is that when I develop in my local environment
I can't just deploy my code to my web server, I have to make sure that
the Perl modules installed on my local machine are also installed on
my remote server. I've gotten sick of doing that, so I've decided
that I'm going to break the mold. I don't want to develop Perl
modules the way its always been done, I want to do it in a way that
works for me. I've got my OO Perl stuff in a directory, if I change
it, I deploy it from my local server to my remote server, no other
changes needed. On my remote server, I know its there because I
deployed it there. I didn't have to bring up an SSH session and log
into the remote server for anything. What I've done with my OO Perl
"module" is that I've made it completely independent from any and all
other Perl modules. This way I've got all the code I need without
having to worry about installing any additional Modules locally or
remotely.
Hope that makes sense...I'm sure it probably won't to most of you.
Thanks,
Matt
On Aug 8, 6:36=A0am, Peter Scott <Pe...@PSDT.com> wrote:
> On Thu, 07 Aug 2008 17:49:36 -0700, Matt wrote:
> > I'm curious to see if people are
> > opting to use a language like Ruby with Rails over using Perl....since
> > Perl's OOness is a bit...forced.
>
> You...noticed.
>
> > Just wondering. =A0Also, over the years I've developed sort of my own
> > Perl OO style, if anyone is interested in using some of the Perl OO
> > helper methods I've developed (or reviewing/critiquing )....let me
> > know.
>
> Sure, provided you first check on what has already been done in this area=
,
> because OO helper modules/style/methods have been done practically to
> death and your chances of reinventing a wheel are high, =A0If you don't k=
now
> what Moose is, start there.
>
> --
> Peter Scotthttp://www.perlmedic.com/http://www.perldebugged.com/
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V11 Issue 1784
***************************************