[31241] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2486 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 20 06:09:42 2009

Date: Sat, 20 Jun 2009 03: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           Sat, 20 Jun 2009     Volume: 11 Number: 2486

Today's topics:
    Re: FAQ 4.7 How do I multiply matrices? <usenet@larseighner.com>
        medicine <yaqubkhan82@gmail.com>
        Mlatestlaptop.blogspot.com <mohummadasif@gmail.com>
        new CPAN modules on Sat Jun 20 2009 (Randal Schwartz)
    Re: Perl WTF <hjp-usenet2@hjp.at>
    Re: Perl WTF <sisyphus359@gmail.com>
    Re: Perl WTF <sisyphus359@gmail.com>
    Re: Perl WTF <1usa@llenroc.ude.invalid>
    Re: Perl WTF <nospam-abuse@ilyaz.org>
        Reading perl substitute  expressions from a file <l.leemans@cox.net>
    Re: Reading perl substitute  expressions from a file sln@netherlands.com
    Re: Replace the first instance only of a string <jurgenex@hotmail.com>
    Re: Replace the first instance only of a string <uri@StemSystems.com>
    Re: Replace the first instance only of a string <jimsgibson@gmail.com>
    Re: SetUID <hjp-usenet2@hjp.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 20 Jun 2009 07:10:38 +0000 (UTC)
From: Lars Eighner <usenet@larseighner.com>
Subject: Re: FAQ 4.7 How do I multiply matrices?
Message-Id: <slrnh3p2hf.g9o.usenet@debranded.larseighner.com>

In our last episode, <56eug6-mr5.ln1@blue.stonehenge.com>, the lovely and
talented PerlFAQ Server broadcast on comp.lang.perl.misc:

> 4.7: How do I multiply matrices?

Provide candlelight, a nice wine with dinner, mood music, and get out of the
way.  The rest is really up to the matricies.

-- 
  Lars Eighner <http://larseighner.com/>                 September 5772, 1993
            150 days since Rick Warren prayed over Bush's third term.
  Obama: No hope, no change, more of the same. Yes, he can, but no, he won't.


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

Date: Sat, 20 Jun 2009 03:06:05 -0700 (PDT)
From: yaqub <yaqubkhan82@gmail.com>
Subject: medicine
Message-Id: <40697076-d033-4720-8a74-4a3def0282eb@z16g2000prd.googlegroups.com>

This site contain usefull informations about medical
diseases ,medicine and
 includs usefull links see it

 * Drugs beginning with "P"
    * Drugs beginning with "Q"
    * Drugs beginning with "R"
    * Drugs beginning with "S"
    * Drugs beginning with "T"
    * Drugs beginning with "U"

For more details http://yaqubmedical.blogspot.com


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

Date: Fri, 19 Jun 2009 17:51:13 -0700 (PDT)
From: Mohummadasif <mohummadasif@gmail.com>
Subject: Mlatestlaptop.blogspot.com
Message-Id: <2c3d9789-7fdf-47e0-abbe-c8f6480ac389@w9g2000pro.googlegroups.com>

Hi get information about latest laptop and pc and also free download
latest games software and beautifull screen saver and get more
fun,,,,,,,,,,,,,GOD bless u


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

Date: Sat, 20 Jun 2009 04:42:30 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Jun 20 2009
Message-Id: <KLIt2u.E6y@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-PDF-rescale-0.2
http://search.cpan.org/~herve/Acme-PDF-rescale-0.2/
A stupid module just to get trained with CPAN. 
----
Any-Moose-0.10
http://search.cpan.org/~sartak/Any-Moose-0.10/
use Moose or Mouse modules 
----
Bundle-AndyA-1.03
http://search.cpan.org/~andya/Bundle-AndyA-1.03/
Basic working environment. 
----
Business-DK-Phonenumber-0.01
http://search.cpan.org/~jonasbn/Business-DK-Phonenumber-0.01/
Danish telephone number validator/formatter 
----
CGI-Session-Driver-layered-0.1
http://search.cpan.org/~crein/CGI-Session-Driver-layered-0.1/
Use multiple layered drivers 
----
CPAN-Packager-0.05
http://search.cpan.org/~kitano/CPAN-Packager-0.05/
Create packages(rpm, deb) from perl modules 
----
CPAN-Packager-0.051
http://search.cpan.org/~kitano/CPAN-Packager-0.051/
Create packages(rpm, deb) from perl modules 
----
CPAN-Packager-0.052
http://search.cpan.org/~kitano/CPAN-Packager-0.052/
Create packages(rpm, deb) from perl modules 
----
Catalyst-Model-DBIC-Schema-0.25
http://search.cpan.org/~mstrout/Catalyst-Model-DBIC-Schema-0.25/
DBIx::Class::Schema Model Class 
----
Catalyst-Plugin-Authentication-0.10013
http://search.cpan.org/~bobtfish/Catalyst-Plugin-Authentication-0.10013/
Infrastructure plugin for the Catalyst authentication framework. 
----
Coat-Persistent-0.200
http://search.cpan.org/~sukria/Coat-Persistent-0.200/
Simple Object-Relational mapping for Coat objects 
----
Coat-Persistent-0.210
http://search.cpan.org/~sukria/Coat-Persistent-0.210/
Simple Object-Relational mapping for Coat objects 
----
DBD-SQLite-1.26_02
http://search.cpan.org/~adamk/DBD-SQLite-1.26_02/
Self-contained RDBMS in a DBI Driver 
----
DBD-Unify-0.77
http://search.cpan.org/~hmbrand/DBD-Unify-0.77/
DBI driver for Unify database systems 
----
Data-ParseBinary-0.21
http://search.cpan.org/~semuelf/Data-ParseBinary-0.21/
Yet Another parser for binary structures 
----
Eidolon-0.02
http://search.cpan.org/~abel/Eidolon-0.02/
web application framework. 
----
Eidolon-Driver-DB-MySQL-0.01
http://search.cpan.org/~abel/Eidolon-Driver-DB-MySQL-0.01/
MySQL database driver. 
----
Eidolon-Driver-DB-PostgreSQL-0.01
http://search.cpan.org/~abel/Eidolon-Driver-DB-PostgreSQL-0.01/
PostgreSQL database driver. 
----
Eidolon-Driver-Log-Basic-0.01
http://search.cpan.org/~abel/Eidolon-Driver-Log-Basic-0.01/
basic log driver for Eidolon. 
----
Eidolon-Driver-Router-Basic-0.02
http://search.cpan.org/~abel/Eidolon-Driver-Router-Basic-0.02/
basic request router for Eidolon. 
----
Eidolon-Driver-Router-Consequent-0.01
http://search.cpan.org/~abel/Eidolon-Driver-Router-Consequent-0.01/
consequent request router for Eidolon. 
----
Eidolon-Driver-Template-HTML-0.01
http://search.cpan.org/~abel/Eidolon-Driver-Template-HTML-0.01/
Eidolon HTML::Template driver. 
----
Eidolon-Driver-Template-Toolkit-0.01
http://search.cpan.org/~abel/Eidolon-Driver-Template-Toolkit-0.01/
Eidolon Template::Toolkit driver. 
----
Eidolon-Driver-User-Basic-0.02
http://search.cpan.org/~abel/Eidolon-Driver-User-Basic-0.02/
Eidolon basic user driver. 
----
Elive-0.27
http://search.cpan.org/~warringd/Elive-0.27/
Elluminate Live! (c) client library 
----
Email-Simple-Test-TraceHeaders-0.091700
http://search.cpan.org/~rjbs/Email-Simple-Test-TraceHeaders-0.091700/
generate sample trace headers for testing 
----
Games-Quake-Stats-0.04
http://search.cpan.org/~mbeebe/Games-Quake-Stats-0.04/
Perl module for compiling basic Quake game statistics 
----
HTTP-Engine-0.02001
http://search.cpan.org/~yappo/HTTP-Engine-0.02001/
Web Server Gateway Interface and HTTP Server Engine Drivers (Yet Another Catalyst::Engine) 
----
HTTP-Engine-Middleware-0.15
http://search.cpan.org/~yappo/HTTP-Engine-Middleware-0.15/
middlewares distribution 
----
IPC-PerlSSH-0.12
http://search.cpan.org/~pevans/IPC-PerlSSH-0.12/
a class for executing remote perl code over an SSH link 
----
JSON-DWIW-0.33
http://search.cpan.org/~dowens/JSON-DWIW-0.33/
JSON converter that Does What I Want 
----
KinoSearch-0.30_01
http://search.cpan.org/~creamyg/KinoSearch-0.30_01/
Search engine library. 
----
Log-Syslog-Fast-0.15
http://search.cpan.org/~athomason/Log-Syslog-Fast-0.15/
Perl extension for very quickly sending syslog messages over TCP or UDP. 
----
Mail-IMAPClient-3.19
http://search.cpan.org/~plobbes/Mail-IMAPClient-3.19/
An IMAP Client API 
----
Math-Evol-1.09
http://search.cpan.org/~pjb/Math-Evol-1.09/
Evolution search optimisation 
----
Math-GMPf-0.29
http://search.cpan.org/~sisyphus/Math-GMPf-0.29/
perl interface to the GMP library's floating point (mpf) functions. 
----
Mouse-0.25
http://search.cpan.org/~sartak/Mouse-0.25/
Moose minus the antlers 
----
Net-IMAP-Server-1.19
http://search.cpan.org/~alexmv/Net-IMAP-Server-1.19/
A single-threaded multiplexing IMAP server implementation, using Net::Server::Coro. 
----
Net-IMAP-Server-1.20
http://search.cpan.org/~alexmv/Net-IMAP-Server-1.20/
A single-threaded multiplexing IMAP server implementation, using Net::Server::Coro. 
----
Net-SMS-TMobile-UK-0.03
http://search.cpan.org/~benc/Net-SMS-TMobile-UK-0.03/
Send SMS Messages via the T-Mobile UK Website. 
----
OP-0.300
http://search.cpan.org/~aayars/OP-0.300/
Compact Perl 5 class prototyping with object persistence 
----
POE-Component-Client-NSCA-0.16
http://search.cpan.org/~bingos/POE-Component-Client-NSCA-0.16/
a POE Component that implements send_nsca functionality 
----
POE-Component-Server-BigBrother-0.05
http://search.cpan.org/~yblusseau/POE-Component-Server-BigBrother-0.05/
POE Component that implements BigBrother daemon functionality 
----
POE-Component-Server-BigBrother-0.06
http://search.cpan.org/~yblusseau/POE-Component-Server-BigBrother-0.06/
POE Component that implements BigBrother daemon functionality 
----
POE-Component-Server-NSCA-0.08
http://search.cpan.org/~bingos/POE-Component-Server-NSCA-0.08/
a POE Component that implements NSCA daemon functionality 
----
POE-Filter-SimpleHTTP-0.091700
http://search.cpan.org/~nperez/POE-Filter-SimpleHTTP-0.091700/
A simple client/server suitable HTTP filter 
----
Pod-L10N-0.05
http://search.cpan.org/~argrath/Pod-L10N-0.05/
----
RT-Extension-LDAPImport-0.06
http://search.cpan.org/~falcone/RT-Extension-LDAPImport-0.06/
Import Users from an LDAP store 
----
Religion-Bible-Regex-Builder-v0.95
http://search.cpan.org/~holmlund/Religion-Bible-Regex-Builder-v0.95/
builds regular expressions that match Bible References 
----
Religion-Bible-Regex-Config-v0.5
http://search.cpan.org/~holmlund/Religion-Bible-Regex-Config-v0.5/
Creates a configuration object for the Religion::Bible::Regex objects from a YAML file. 
----
Religion-Bible-Regex-Lexer-v0.8
http://search.cpan.org/~holmlund/Religion-Bible-Regex-Lexer-v0.8/
[One line description of module's purpose here] 
----
Religion-Bible-Regex-Reference-v0.9
http://search.cpan.org/~holmlund/Religion-Bible-Regex-Reference-v0.9/
this Perl object represents a Biblical reference along with the functions that can be applied to it. 
----
Religion-Bible-Regex-Versification-v0.1
http://search.cpan.org/~holmlund/Religion-Bible-Regex-Versification-v0.1/
[One line description of module's purpose here] 
----
Time-Format_XS-1.03
http://search.cpan.org/~roode/Time-Format_XS-1.03/
Companion module for Time::Format, to speed up time formatting. 
----
UR-0.9
http://search.cpan.org/~sakoht/UR-0.9/
rich declarative non-hierarchical transactional objects 
----
Unicode-LineBreak-1.000.510
http://search.cpan.org/~nezumi/Unicode-LineBreak-1.000.510/
UAX #14 Unicode Line Breaking Algorithm 
----
VJF-Emphase-0.11
http://search.cpan.org/~herve/VJF-Emphase-0.11/
EM likelihood maximisation for familial data. 
----
VJF-MITDT-1.0
http://search.cpan.org/~herve/VJF-MITDT-1.0/
Multiple Imputation for Transmission Disequilibrium Test. 
----
VJF-MITDT-1.01
http://search.cpan.org/~herve/VJF-MITDT-1.01/
Multiple Imputation for Transmission Disequilibrium Test. 
----
libintl-perl-1.19
http://search.cpan.org/~guido/libintl-perl-1.19/


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: Sat, 20 Jun 2009 00:35:31 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Perl WTF
Message-Id: <slrnh3o4lj.qrs.hjp-usenet2@hrunkner.hjp.at>

On 2009-06-19 16:42, A. Sinan Unur <1usa@llenroc.ude.invalid> wrote:
[...]
> So, my AS perl on Windows does not seem to support NaNs.
>
> Trying with Strawberry now ... Nope, the same problem.
>
> Cygwin perl works. But then it suffers from the other issue:
>
> $ perl -e 'print "nanoseconds" != "nanoseconds"'
> 1
>
> $ perl -e 'print "infertility" == "infertility"'
> 1
>
> $ perl -e 'print "infertility" == "informal"'
> 1

I don't think this is an "issue". In numeric context perl interprets any
string which starts with a number as that number:

% perl -wle 'print "5ertility" * 1'
Argument "5ertility" isn't numeric in multiplication (*) at -e line 1.
5
% perl -wle 'print "42ertility" * 1'
Argument "42ertility" isn't numeric in multiplication (*) at -e line 1.
42
% perl -wle 'print "-315E39ertility" * 1' 
Argument "-315E39ertility" isn't numeric in multiplication (*) at -e line 1.
-3.15e+41

So if "42ertility" has the numeric value of 42, it is at least
consistent that "infertility" has the numeric value of inf.

Of course one could argue that a string with "trailing junk" should not
be interpreted as a number at all, and that the result of 

    "42ertility" * 1

should be undef or NaN. But perl has always done this and I think it is
very unlikely to change in perl5.

	hp



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

Date: Fri, 19 Jun 2009 17:25:23 -0700 (PDT)
From: sisyphus <sisyphus359@gmail.com>
Subject: Re: Perl WTF
Message-Id: <0b5a4be1-4cd9-41b0-bcd6-952c6378e912@o21g2000prn.googlegroups.com>

On Jun 20, 2:42=A0am, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:


> So, my AS perl on Windows does not seem to support NaNs.

It supports them (and Inf's), but, unlike most nixes, you can't assign
them using strings 'nan' and 'inf' (or any other strings, for that
matter) because the Windows C runtime doesn't support that.
Strawberry Perl and ActivePerl use the same C runtime - so expect
identical behaviour.

Here's a script that demos some ways of creating inf's and nan's on
windows - based on advice received on perlmonks (mainly from ikegami,
iirc). Apart from the first (commented out) approach, it's just making
use of the IEEE specifications for these values:

###############################
use warnings;

#Alternative creation of an inf:
#$inf =3D 99 ** 99 ** 99; # or somesuch.

# Create a +inf
$pinf =3D create('7FF0000000000000');
print $pinf, "\n";

# Create a -inf
$ninf =3D create('FFF0000000000000');
print $ninf, "\n";

# Create a qNaN
$nan =3D  create('7FF8000000000000');
print $nan, "\n";

# create an Ind (signaled NAN ?)
$ind =3D  create('FFF8000000000000');
print $ind, "\n";

sub create {
    return unpack 'd', scalar reverse pack 'H*', $_[0];
}
###############################

The other fun part is that, as you'll see from running that script,
the strings that represent the infs and nans on Windows all begin with
either '1' or '-1'. Consequently, if you use any of those strings in
numeric context, then they take on the value '1' or '-1' respectively
- whereas, on linux, the inf/nan strings retain their inf/nan values
when used in numeric context.

This can cause, and has caused, linux-windows portability issues. On
linux, you don't even get any "isn't numeric" warnings if you:

perl -wle 'print "nan" !=3D "nan"'

And many linux people expect that using the string "nan" as a number
will work everywhere - after all, the absence of any warning could be
taken as a validation of that approach.

(Maybe there's another WTF brewing somewhere in there :-)

Like I said, perl just consistently hands things over to the
underlying system libraries, and we simply get what they provide.

Cheers,
Rob


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

Date: Fri, 19 Jun 2009 19:07:47 -0700 (PDT)
From: sisyphus <sisyphus359@gmail.com>
Subject: Re: Perl WTF
Message-Id: <f1861b9c-cedc-4231-95fc-be931d4ba882@s38g2000prg.googlegroups.com>

On Jun 20, 8:35=A0am, "Peter J. Holzer" <hjp-usen...@hjp.at> wrote:

> So if "42ertility" has the numeric value of 42, it is at least
> consistent that "infertility" has the numeric value of inf.

Yes - looking at it like that makes it a little less WTFish.

Cheers,
Rob


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

Date: Sat, 20 Jun 2009 02:51:12 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Perl WTF
Message-Id: <Xns9C2FE87F84CC6asu1cornelledu@127.0.0.1>

sisyphus <sisyphus359@gmail.com> wrote in news:0b5a4be1-4cd9-41b0-bcd6-
952c6378e912@o21g2000prn.googlegroups.com:

> On Jun 20, 2:42 am, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> 
> 
>> So, my AS perl on Windows does not seem to support NaNs.
> 
> It supports them (and Inf's), but, unlike most nixes, you can't assign
> them using strings 'nan' and 'inf' (or any other strings, for that
> matter) because the Windows C runtime doesn't support that.
> Strawberry Perl and ActivePerl use the same C runtime - so expect
> identical behaviour.
> 
> Here's a script that demos some ways of creating inf's and nan's on
> windows - based on advice received on perlmonks (mainly from ikegami,
> iirc). Apart from the first (commented out) approach, it's just making
> use of the IEEE specifications for these values:

Thank you very much for the detailed explanation and examples. 

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://www.rehabitation.com/clpmisc/


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

Date: Sat, 20 Jun 2009 09:07:06 GMT
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Perl WTF
Message-Id: <slrnh3p9lq.vb6.nospam-abuse@chorin.math.berkeley.edu>

On 2009-06-20, sisyphus <sisyphus359@gmail.com> wrote:
>> So, my AS perl on Windows does not seem to support NaNs.
>
> It supports them (and Inf's), but, unlike most nixes, you can't assign
> them using strings 'nan' and 'inf' (or any other strings, for that
> matter) because the Windows C runtime doesn't support that.

So what?  Who saiz that Perl should always rely on C runtime?  If the
runtime is limited, one should create more capable wrappers...

Yours,
Ilya


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

Date: Fri, 19 Jun 2009 23:32:51 -0700
From: "Luc Leemans" <l.leemans@cox.net>
Subject: Reading perl substitute  expressions from a file
Message-Id: <po%_l.33068$Dr4.15628@newsfe24.iad>

A simple substitution in perl is done by
  $variable =~ s/string1/string2/i;
  $variable =~ s/string3/string4/g;
  print $variable;

This works fine but I would have to tailor the program for each specific 
case.

I would like to put these is a file D:/TEMP/perlString.txt and then write a 
perl program to read and execute them.

I have tried something like this but have been unsuccessful.
Is it even possible?

Basic logic I tried:

my $inFile= "D:/TEMP/perlString.txt";
open(INFILEH, $inFile);
while (<INFILEH>)
{
    chomp;
    $perlExpr = $_;
    $variable =~ $perlExpr;
}
print $variable; 




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

Date: Sat, 20 Jun 2009 00:30:18 -0700
From: sln@netherlands.com
Subject: Re: Reading perl substitute  expressions from a file
Message-Id: <qq3p351q4g27005h6sffek0nolsm65rl0u@4ax.com>

On Fri, 19 Jun 2009 23:32:51 -0700, "Luc Leemans" <l.leemans@cox.net> wrote:

>A simple substitution in perl is done by
>  $variable =~ s/string1/string2/i;
>  $variable =~ s/string3/string4/g;
>  print $variable;
>
>This works fine but I would have to tailor the program for each specific 
>case.
>
>I would like to put these is a file D:/TEMP/perlString.txt and then write a 
>perl program to read and execute them.
>
>I have tried something like this but have been unsuccessful.
>Is it even possible?
>
>Basic logic I tried:
>
>my $inFile= "D:/TEMP/perlString.txt";
>open(INFILEH, $inFile);
>while (<INFILEH>)
>{
>    chomp;
>    $perlExpr = $_;
>    $variable =~ $perlExpr;
>}
>print $variable; 
>
Not unless you 'eval' the $_.
s/// is not a form Perl lets you do dynamically.

-sln


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

Date: Fri, 19 Jun 2009 15:33:57 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Replace the first instance only of a string
Message-Id: <af4o355kt0hmci9jf2g1253hgdh9816ikm@4ax.com>

Willem <willem@snail.stack.nl> wrote:
>J?rgen Exner wrote:
>) Then in all following iterations $replaced will be true already and the
>) short-circuit evaluation of 'or' will prevent the second argument of the
>) boolean expression to be ever evaluated again.
>
>Does ||= also use short-circuiting ?
>
>I.E.:
>
>  $replaced ||= s/foo/bar/;

I am not familiar with this operator.

>Anyway,
>
>  $replaced = s/foo/bar/ unless $replaced;
>
>Seems more descriptive of its purpose.

TIMTOWTDI.

jue


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

Date: Fri, 19 Jun 2009 19:39:58 -0400
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: Replace the first instance only of a string
Message-Id: <87ab433i9d.fsf@quad.sysarch.com>

>>>>> "JE" == Jürgen Exner <jurgenex@hotmail.com> writes:

  JE> Willem <willem@snail.stack.nl> wrote:
  >> J?rgen Exner wrote:
  >> ) Then in all following iterations $replaced will be true already and the
  >> ) short-circuit evaluation of 'or' will prevent the second argument of the
  >> ) boolean expression to be ever evaluated again.
  >> 
  >> Does ||= also use short-circuiting ?
  >> 
  >> I.E.:
  >> 
  >> $replaced ||= s/foo/bar/;

  JE> I am not familiar with this operator.

then you should be. it is very useful for defaulting values or making
sure something is set so it doesn't trigger warnings. it's only failing
is that it tests for boolean truth so it will be false on 0 or ''. 5.10
has the //= op which does the same thing but tests for undef.

here is a common usage for ||=

sub foo {
	my( $bar ) = @_ ;

# set bar to a default if nothing was passed in

	$bar ||= 'baz' ;

or if '' or 0 are legal values then do this in 5.10:

	$bar //= 'baz' ;

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Fri, 19 Jun 2009 17:20:55 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: Replace the first instance only of a string
Message-Id: <190620091720559366%jimsgibson@gmail.com>

In article <af4o355kt0hmci9jf2g1253hgdh9816ikm@4ax.com>, Jürgen Exner
<jurgenex@hotmail.com> wrote:

> Willem <willem@snail.stack.nl> wrote:
> >J?rgen Exner wrote:
> >) Then in all following iterations $replaced will be true already and the
> >) short-circuit evaluation of 'or' will prevent the second argument of the
> >) boolean expression to be ever evaluated again.
> >
> >Does ||= also use short-circuiting ?
> >
> >I.E.:
> >
> >  $replaced ||= s/foo/bar/;
> 
> I am not familiar with this operator.

But you are no doubt familiar with other assignment operators, such as

  $a += 2;

being equivalent to

  $a = $a + 2;


So in the same way

  $a ||= 1;

is equivalent to

  $a = $a || 1;

-- 
Jim Gibson


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

Date: Sat, 20 Jun 2009 00:59:13 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: SetUID
Message-Id: <slrnh3o623.qrs.hjp-usenet2@hrunkner.hjp.at>

On 2009-06-19 10:59, maylcc <sg.maylcc@gmail.com> wrote:
> thanks for your reply. i am trying to implement a test password script
> which accepts user id and password and using these parameters to auth
> against the server (linux) /etc/passwd and shadow. any suggestion?

Take a look at saslauthd. It is intended for exactly this situation
where a non-privileged process needs to check whether a supplied
password is correct. There is even a perl module for it:
http://search.cpan.org/dist/Authen-SASL-Authd/

	hp


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

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


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