[29373] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 617 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 4 03:09:49 2007

Date: Wed, 4 Jul 2007 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           Wed, 4 Jul 2007     Volume: 11 Number: 617

Today's topics:
    Re: Kicking off multiple processes at once instead of w <shmh@bigpond.net.au>
        new CPAN modules on Wed Jul  4 2007 (Randal Schwartz)
    Re: Perl or Groovy - Help to decide which to learn <amitamit2@gmail.com>
    Re: Portable general timestamp format, not 2038-limited <hjp-usenet2@hjp.at>
    Re: Portable general timestamp format, not 2038-limited <hjp-usenet2@hjp.at>
    Re: Portable general timestamp format, not 2038-limited <rjh@see.sig.invalid>
        Trying to write a log function <shmh@bigpond.net.au>
    Re: Trying to write a log function <dummy@example.com>
    Re: unlurking <sbryce@scottbryce.com>
    Re: unlurking <sbryce@scottbryce.com>
    Re: unlurking <invalid@invalid.nyet>
    Re: unlurking <invalid@invalid.nyet>
    Re: unlurking <invalid@invalid.nyet>
    Re: using wildcards with -e <tadmc@seesig.invalid>
    Re: using wildcards with -e <savagebeaste@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 04 Jul 2007 02:36:21 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Re: Kicking off multiple processes at once instead of waiting....
Message-Id: <FIDii.2996$4A1.1664@news-server.bigpond.net.au>

Thank you Mark...really appreciate it.

"Mark Clements" <mark.clementsREMOVETHIS@wanadoo.fr> wrote in message 
news:4689ea03$0$27393$ba4acef3@news.orange.fr...
> Simon wrote:
> <snip>
> >
>> Thanks Joe..much appreciated.
>>
>> I do know Joe how to connect to a remote registry.
>>
>> I spose what Im trying to do, but cant get myself on some really really 
>> simple examples, so i can play with them, are example scripts on how to 
>> fork a process.
>> Ive looked at the perldoc but I find the doco not as clear as some good 
>> beginner fork examples so I can test them out on my systems, then gain 
>> confidence that way.
>>
>> Appreciate your help. :)
>>
>
> You could look at Parallel::ForkManager - it may make things easier for 
> you.
>
> Mark
>
> 




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

Date: Wed, 4 Jul 2007 04:42:12 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Jul  4 2007
Message-Id: <JKn12C.24qw@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.

Apache-BabyConnect-0.93
http://search.cpan.org/~maxou/Apache-BabyConnect-0.93/
uses DBI::BabyConnect to initiate persistent database connections 
----
Apache2-Translation-0.16
http://search.cpan.org/~opi/Apache2-Translation-0.16/
Configuring Apache dynamically 
----
Bundle-Ensembl-0.02
http://search.cpan.org/~ashgene/Bundle-Ensembl-0.02/
Perl extension for blah blah blah 
----
Bundle-Ensembl-0.03
http://search.cpan.org/~ashgene/Bundle-Ensembl-0.03/
Bundle for installing Ensembl Perl Modules (Built from dependencies of ENSEMBL_45 VERSION) 
----
Bundle-Font-0.02
http://search.cpan.org/~ski/Bundle-Font-0.02/
a bundle to install Font modules and dependencies 
----
Bundle-SQL-0.04
http://search.cpan.org/~ski/Bundle-SQL-0.04/
installs SQL modules and dependencies 
----
CPAN-Mini-0.561
http://search.cpan.org/~rjbs/CPAN-Mini-0.561/
create a minimal mirror of CPAN 
----
CPAN-Reporter-0.45
http://search.cpan.org/~dagolden/CPAN-Reporter-0.45/
Provides Test::Reporter support for CPAN.pm 
----
Catalyst-Plugin-Dumper-0.00_03
http://search.cpan.org/~chisel/Catalyst-Plugin-Dumper-0.00_03/
Data::Dumper plugin for Catalyst 
----
Catalyst-Plugin-Session-0.16
http://search.cpan.org/~nuffin/Catalyst-Plugin-Session-0.16/
Generic Session plugin - ties together server side storage and client side state required to maintain session data. 
----
Class-MOP-0.40
http://search.cpan.org/~stevan/Class-MOP-0.40/
A Meta Object Protocol for Perl 5 
----
Config-Model-0.611
http://search.cpan.org/~ddumont/Config-Model-0.611/
Model to create configuration validation tool 
----
DBI-BabyConnect-0.93
http://search.cpan.org/~maxou/DBI-BabyConnect-0.93/
creates an object that holds a DBI connection to a database 
----
DBIx-OO-0.0.5
http://search.cpan.org/~mishoo/DBIx-OO-0.0.5/
Database to Perl objects abstraction 
----
DBIx-ORM-Declarative-0.15
http://search.cpan.org/~jschneid/DBIx-ORM-Declarative-0.15/
Perl extension for object-oriented database access 
----
Excel-Template-Plus-0.03
http://search.cpan.org/~stevan/Excel-Template-Plus-0.03/
An extension to the Excel::Template module 
----
ExtUtils-MakeMaker-6.36
http://search.cpan.org/~mschwern/ExtUtils-MakeMaker-6.36/
Create a module Makefile 
----
Geo-GeoNames-0.04
http://search.cpan.org/~perhenrik/Geo-GeoNames-0.04/
Perform geographical queries using GeoNames Web Services 
----
HTML-GMap-0.04
http://search.cpan.org/~pcanaran/HTML-GMap-0.04/
Generic framework for building Google Maps displays 
----
HTML-SearchPage-0.03
http://search.cpan.org/~pcanaran/HTML-SearchPage-0.03/
Generic framework for building web-based search pages 
----
HTML-WebDAO-0.81
http://search.cpan.org/~zag/HTML-WebDAO-0.81/
Perl extension for create complex web application 
----
IO-Socket-SIPC-0.03
http://search.cpan.org/~bloonix/IO-Socket-SIPC-0.03/
Serialize perl structures for inter process communication. 
----
IWL-0.47
http://search.cpan.org/~viktork/IWL-0.47/
A widget library for the web 
----
Lemonldap-NG-Manager-0.8
http://search.cpan.org/~guimard/Lemonldap-NG-Manager-0.8/
Perl extension for managing Lemonldap::NG Web-SSO system. 
----
Lingua-Cyrillic-Translit-ICAO-1.01
http://search.cpan.org/~stro/Lingua-Cyrillic-Translit-ICAO-1.01/
Cyrillic characters transliteration into ICAO Doc 9303 
----
MasonX-MiniMVC-0.02
http://search.cpan.org/~skud/MasonX-MiniMVC-0.02/
Very simple MVC framework for HTML::Mason 
----
MasonX-MiniMVC-0.03
http://search.cpan.org/~skud/MasonX-MiniMVC-0.03/
Very simple MVC framework for HTML::Mason 
----
Moose-0.24
http://search.cpan.org/~stevan/Moose-0.24/
A complete modern object system for Perl 5 
----
MooseX-Getopt-0.05
http://search.cpan.org/~stevan/MooseX-Getopt-0.05/
A Moose role for processing command line options 
----
MooseX-Storage-0.04
http://search.cpan.org/~stevan/MooseX-Storage-0.04/
An serialization framework for Moose classes 
----
Net-Appliance-Session-0.14
http://search.cpan.org/~oliver/Net-Appliance-Session-0.14/
Run command-line sessions to network appliances 
----
Net-Appliance-Session-0.15
http://search.cpan.org/~oliver/Net-Appliance-Session-0.15/
Run command-line sessions to network appliances 
----
Net-SSLeay-1.31_01
http://search.cpan.org/~flora/Net-SSLeay-1.31_01/
Perl extension for using OpenSSL 
----
PAB3-3.1.4
http://search.cpan.org/~chrmue/PAB3-3.1.4/
Perl Application Builder / Version 3 
----
String-EscapeCage-0.01
http://search.cpan.org/~msulliva/String-EscapeCage-0.01/
Cage and escape strings to prevent injection attacks 
----
Sub-Current-0.01
http://search.cpan.org/~rgarcia/Sub-Current-0.01/
Get the current subroutine 
----
Template-Alloy-1.006
http://search.cpan.org/~rhandom/Template-Alloy-1.006/
TT2/3, HT, HTE, Tmpl, and Velocity Engine 
----
Term-Prompt-1.04
http://search.cpan.org/~persicom/Term-Prompt-1.04/
Perl extension for prompting a user for information 
----
Test-MinimumVersion-0.005
http://search.cpan.org/~rjbs/Test-MinimumVersion-0.005/
does your code require newer perl than you think? 
----
Text-Greeking-zh_TW-0.0.2
http://search.cpan.org/~gugod/Text-Greeking-zh_TW-0.0.2/
A module for generating meaningless Chinese text that creates the illusion of the finished document. 
----
Text-Greeking-zh_TW-0.0.3
http://search.cpan.org/~gugod/Text-Greeking-zh_TW-0.0.3/
A module for generating meaningless Chinese text that creates the illusion of the finished document. 
----
Workflow-0.27
http://search.cpan.org/~jonasbn/Workflow-0.27/
Simple, flexible system to implement workflows 
----
XML-SAX-ExpatXS-1.31
http://search.cpan.org/~pcimprich/XML-SAX-ExpatXS-1.31/
Perl SAX 2 XS extension to Expat parser 
----
XML-SemanticDiff-0.96
http://search.cpan.org/~shlomif/XML-SemanticDiff-0.96/
Perl extension for comparing XML documents. 
----
mogilefs-server-2.17
http://search.cpan.org/~bradfitz/mogilefs-server-2.17/


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: Tue, 03 Jul 2007 22:04:02 -0700
From:  Amit <amitamit2@gmail.com>
Subject: Re: Perl or Groovy - Help to decide which to learn
Message-Id: <1183525442.568036.77350@a26g2000pre.googlegroups.com>

On Jul 3, 11:26 am, Mark Clements <mark.clementsREMOVET...@wanadoo.fr>
wrote:
> Amit wrote:
> > Hi,
>
> > I want somehelpdeciding which of the two to learn.
>
> > I am new to either of the scripting languages. But I have worked in
> > Java.  So I wanted to know that how doesgroovycompare withPerl.
>
> > I knowperlis very strong and very much adored.  So, considering the
> > long history ofperl, it may definitely have more functions and
> > libraries (and sample code :;).
>
> Well - that's one of the advantages ofGroovy, supposedly seamless
> integration with Java. You can call any Java libraries you have directly
> fromGroovy.
>
>  > But considering my background, will I> miss many functionalities if Idecideto learnGroovyinstead ofPerl.
>
> If you already know Java, thenGroovyprobably won't be much of a
> learning curve. You should probably consider it as an additional Java
> skill rather than a totally separate language.
>
> Any decision you make should be based on what you need to do your work.
> It wouldn't hurt to learn both (and maybe look at other languages as
> well, eg Python, Ruby). If you need to specialize, you can do that as
> the need arises.
>
> Mark

Thanks Mark.



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

Date: Wed, 4 Jul 2007 08:12:53 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <slrnf8mej5.jr9.hjp-usenet2@zeno.hjp.at>

On 2007-07-03 23:15, CBFalconer <cbfalconer@yahoo.com> wrote:
> "Peter J. Holzer" wrote:
>> Richard Heathfield <rjh@see.sig.invalid> wrote:
>>
> ... snip ...
>>
>>> In that case, the obvious choice is Greenwich Mean Time.  :-)
>> 
>> Hardly. That hasn't been in use for over 35 years (according to
>> Wikipedia).
>
> I am glad to see you depend on absolutely reliable sources.

Mostly I relied on my own memory (which is of course even less reliable
than Wikipedia). I checked Wikipedia for the date (Jan 1st 1972) when
GMT was replaced by UTC as the basis for civil time. Since that
coincided with my own recollection (sometime in the 1970's), I see no
reason to doubt it.

It is possible that the observatory at Greenwich still keeps and
announces GMT, but it has no practical importance anymore. Certainly
what everybody (except specialists in the field) means when they talk
about "GMT" is UTC.

	hp


-- 
   _  | Peter J. Holzer    | I know I'd be respectful of a pirate 
|_|_) | Sysadmin WSR       | with an emu on his shoulder.
| |   | hjp@hjp.at         |
__/   | http://www.hjp.at/ |	-- Sam in "Freefall"


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

Date: Wed, 4 Jul 2007 08:27:33 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <slrnf8mfel.jr9.hjp-usenet2@zeno.hjp.at>

On 2007-07-04 00:14, Dr.Ruud <rvtol+news@isolution.nl> wrote:
> Peter J. Holzer schreef:
>> Since a day with a leap second has 86401 seconds (or 86399, but that
>> hasn't happened yet)
>
> Many systems allow a seconds value of 0..61, so minutes (actually
> months) with two leap seconds are foreseen.

That comes from the ANSI C standard. It is unclear why the standard
specifies 0..61 instead of 0..60. The most plausible explanation I've
read is that it's the result of a misunderstanding: Up to two leap
seconds in a year are expected, and somebody thought they would be
applied both at the end of the year (instead of one at the end of each
semester).


> A leap second may be introduced at the end of any month, the preferred
> dates are at the end of June and the end of December.
>
> At the estimated rate of decrease, the earth would lose about 1/2 day
> after 4,000 years, and about two leap seconds a
> month would be needed to keep UTC in step with Earth time, UT1.

C is already ready for this, although I doubt that it's authors planned
that far ahead.

	hp


-- 
   _  | Peter J. Holzer    | I know I'd be respectful of a pirate 
|_|_) | Sysadmin WSR       | with an emu on his shoulder.
| |   | hjp@hjp.at         |
__/   | http://www.hjp.at/ |	-- Sam in "Freefall"


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

Date: Wed, 04 Jul 2007 07:07:36 +0000
From: Richard Heathfield <rjh@see.sig.invalid>
Subject: Re: Portable general timestamp format, not 2038-limited
Message-Id: <g-ednUfVA70l2xbbnZ2dnUVZ8t7inZ2d@bt.com>

Peter J. Holzer said:

<snip>
 
> It is possible that the observatory at Greenwich still keeps and
> announces GMT, but it has no practical importance anymore. Certainly
> what everybody (except specialists in the field) means when they talk
> about "GMT" is UTC.

I am not a specialist in the field. When I talk about GMT, I mean GMT, 
not UTC. Therefore, I am a counter-example to your claim.

-- 
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


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

Date: Wed, 04 Jul 2007 02:35:44 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Trying to write a log function
Message-Id: <4IDii.2995$4A1.2565@news-server.bigpond.net.au>

Hi guys!

Hope you can help.
Im a newbie to this, but have some sample code that Im trying to understand.
The goal is that I can successfully write a log function that writes 
messages to a log file.
Please bare with me as I dont fully understand the below code, which is 
where I need your gurus expertise.
Here is the code, which is not working, but Id like to try and find out how 
i can get it to work to write messages to a log file.
Any help appreciated.
Thank you.

====================================================================== code

sub Log {

   @g = localtime time;
   open(LOG,">>$LogFile");
   printf LOG "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
   printf "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];
   close(LOG);

}

sub WaitForInstall() {

   Log "   Waiting for installation to complete";
   sleep 10;
   $finished = 0;
   while (!$finished) {
      sleep 5;
      $finished = 1;  # assume we're finished
      open(PS,"$PSCMD|");
      while (<PS>) {

         if ($_ =~ /$Product Setup/i) {
            $finished = 0;  # not finished
         }
         elsif ($_ =~ /$Product/i) {
            $finished = 0;  # not finished
         }
      }
      close(PS);
   }

}


$LogFile = "C:\\logs\\$Product.log";

====================================================================== code

So basically, what Im trying to do is, insert a Log function into particular 
parts of the script, and wherever I insert the Log function, to write that 
line to Product.log.
The above is only a snippet.
Any help will be great.
I just dont know how to call the Log function, or how to actually write it 
to be honest.
The below is my objective.

1) Write a log function (subroutine)
2) Being able to call that log subroutine anywhere in my script, and log 
messages from that call to a text file.

Thanku in advance.





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

Date: Wed, 04 Jul 2007 05:11:42 GMT
From: "John W. Krahn" <dummy@example.com>
Subject: Re: Trying to write a log function
Message-Id: <i_Fii.26076$xk5.3904@edtnps82>

Simon wrote:
> 
> Hope you can help.
> Im a newbie to this, but have some sample code that Im trying to understand.
> The goal is that I can successfully write a log function that writes 
> messages to a log file.
> Please bare with me as I dont fully understand the below code, which is 
> where I need your gurus expertise.
> Here is the code, which is not working, but Id like to try and find out how 
> i can get it to work to write messages to a log file.
> Any help appreciated.
> Thank you.
> 
> ====================================================================== code

You should have these two lines at the beginning of your program and let perl 
help you find mistakes:

use warnings;
use strict;


> sub Log {
> 
>    @g = localtime time;
>    open(LOG,">>$LogFile");

You should *ALWAYS* verify that your file opened correctly:

     open LOG, '>>', $LogFile or die "Cannot open '$LogFile' $!";

This would have caught the error that $LogFile has *no* value here because it 
is not assigned a value until later in the program.


>    printf LOG "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];

The correct way to get the year (as described in 'perldoc -f localtime') is to 
add 1900 to the sixth element of the list returned from localtime so that 
expression could be more concisely written as:

     printf LOG "%04d/%02d/%02d %02d:%02d:%02d  %s\n", $g[ 5 ] + 1900, $g[ 4 ] 
+ 1, @g[ 3, 2, 1, 0 ], $_[ 0 ];


>    printf "%02d%02d/%02d/%02d %02d:%02d:%02d  $_[0]\n", 
> sprintf("%02d",(substr sprintf("%03d",$g[5]), 0, 1) + 19),(substr 
> sprintf("%03d",$g[5]), 1, 2),$g[4]+1,$g[3],$g[2],$g[1],$g[0];

Same as above.


>    close(LOG);
> 
> }
> 
> sub WaitForInstall() {
> 
>    Log "   Waiting for installation to complete";
>    sleep 10;
>    $finished = 0;
>    while (!$finished) {
>       sleep 5;
>       $finished = 1;  # assume we're finished
>       open(PS,"$PSCMD|");

You should *ALWAYS* verify that your file opened correctly:

        open PS, '-|', $PSCMD or die "Cannot open pipe from '$PSCMD' $!";


>       while (<PS>) {
> 
>          if ($_ =~ /$Product Setup/i) {
>             $finished = 0;  # not finished
>          }
>          elsif ($_ =~ /$Product/i) {
>             $finished = 0;  # not finished
>          }
>       }
>       close(PS);

And with a pipe you should also verify that it closed correctly:

close PS or warn $! ? "Error closing '$PSCMD' pipe: $!"
                     : "Exit status $? from '$PSCMD'";


>    }
> 
> }


John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall


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

Date: Tue, 03 Jul 2007 19:15:54 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: unlurking
Message-Id: <oY-dndmJO4ZbaRfbnZ2dnUVZ_sLinZ2d@comcast.com>

Wade Ward wrote:

> One of the errors I was getting said "since you're using strict...." 
> Commenting it out was an attempt to remove an error,

The error was not telling you not to use strict. It is telling you that 
what you did is an error if you use strict. The best practice is to use 
strict, then fix any errors that Perl reports.


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

Date: Tue, 03 Jul 2007 19:17:48 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: unlurking
Message-Id: <oY-dndiJO4alaBfbnZ2dnUVZ_sLinZ2d@comcast.com>

Wade Ward wrote:

> "Scott Bryce" <sbryce@scottbryce.com> wrote in message  
>>Also, ask Perl to tell you whether this succeeds.
> 
> isn't that the purpose of
> or die "Cannot contact $nntphost: $!";
> ?

It is, but you did not include that in your script. If there was an 
error creating a new Net::NNTP object, you wouldn't have known.


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

Date: Wed, 4 Jul 2007 02:42:50 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: unlurking
Message-Id: <rMedndPL9b003BbbnZ2dnUVZ_qSrnZ2d@comcast.com>


"Scott Bryce" <sbryce@scottbryce.com> wrote in message 
news:oY-dndmJO4ZbaRfbnZ2dnUVZ_sLinZ2d@comcast.com...
> Wade Ward wrote:
>
>> One of the errors I was getting said "since you're using strict...." 
>> Commenting it out was an attempt to remove an error,
>
> The error was not telling you not to use strict. It is telling you that 
> what you did is an error if you use strict. The best practice is to use 
> strict, then fix any errors that Perl reports.
And when I've got unshakeable errors, they're unshakeable.  I wish I could 
report them faithfully.  Why do I want strict as opposed to lenient in a 
syntax where, besides hello world, I get nothing but punishment?
-- 
WW 




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

Date: Wed, 4 Jul 2007 02:45:45 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: unlurking
Message-Id: <77edna6859fF3xbbnZ2dnUVZ_g6dnZ2d@comcast.com>


"Scott Bryce" <sbryce@scottbryce.com> wrote in message 
news:oY-dndiJO4alaBfbnZ2dnUVZ_sLinZ2d@comcast.com...
> Wade Ward wrote:
>
>> "Scott Bryce" <sbryce@scottbryce.com> wrote in message
>>>Also, ask Perl to tell you whether this succeeds.
>>
>> isn't that the purpose of
>> or die "Cannot contact $nntphost: $!";
>> ?
>
> It is, but you did not include that in your script. If there was an error 
> creating a new Net::NNTP object, you wouldn't have known.
Let's assume that to be true.  Doesn't the mere fact that I have to ask how 
I would know if there were an error in creating an object in perl preclude 
me from knowledge thereof?
-- 
WW 




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

Date: Wed, 4 Jul 2007 02:47:51 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: unlurking
Message-Id: <raudnV-dvNZI3xbbnZ2dnUVZ_tijnZ2d@comcast.com>


"Tad McClellan" <tadmc@seesig.invalid> wrote in message 
news:slrnf8lr6l.id5.tadmc@tadmc30.sbcglobal.net...
> Michele Dondi <bik.mido@tiscalinet.it> wrote:
>> On Tue, 3 Jul 2007 16:03:36 -0400, "Wade Ward" <invalid@invalid.nyet>
>> wrote:
>
>>>OP has _Programming Perl_ and _Perl in a nutshell_ in hand.  Do these 
>>>count
>>>as standard references?
>>
>> The former, certainly. The latter, I don't know.
>
>
> They do not count as the "standard references" mentioned upthread.
>
> What "group" means in a Usenet context is independant of
> any programming language.
It's July 4:  for the love of God, spell it correctly.
-- 
WW 




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

Date: Tue, 3 Jul 2007 21:12:07 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: using wildcards with -e
Message-Id: <slrnf8m0fn.khv.tadmc@tadmc30.sbcglobal.net>

Clenna Lumina <savagebeaste@yahoo.com> wrote:
> Tad McClellan wrote:
>> Clenna Lumina <savagebeaste@yahoo.com> wrote:
>>> Tad McClellan wrote:
>>>> Clenna Lumina <savagebeaste@yahoo.com> wrote:
>>>>
>>>>> Although most of the built in functions (sort, grep, map, ...) that
>>>>> return lists behave as you expect in scalar context too.
>>>>
>>>>
>>>> You expected that sort() in a scalar context behaves
>>>> in an undefined manner?
>>>
>>> Hmmm, I stand corrected. I ran some quick command-line tests, showing
>>> that 'map' and 'grep' return the item count but sort does not. It
>>> just seems to return undef:
>>>
>>>    $ perl -le 'my @list = qw/1 2 4 8 16 32/; print(defined(scalar
>>> sort @list) ? "Y" : "N");'
>>>    N
>>>
>>> Why is this?
>>
>>
>>   perldoc -f sort
>>
>>       sort SUBNAME LIST
>>       sort BLOCK LIST
>>       sort LIST
>>            In list context, this sorts the LIST and returns the
>>            sorted list value.  In scalar context, the behaviour of
>>            "sort()" is unde� fined.
>
> I understand that it is undefined behavior, but what I'm trying to 
> determine is what useful purpose could that possibly serve? 


None, other than to indicate that it has been called incorrectly.


> Why doesn't 
> it just return the count?


Why don't you just call map() when you want the count?


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Tue, 3 Jul 2007 20:37:13 -0700
From: "Clenna Lumina" <savagebeaste@yahoo.com>
Subject: Re: using wildcards with -e
Message-Id: <5f0ivbF3ag6bbU1@mid.individual.net>

Tad McClellan wrote:
> Clenna Lumina <savagebeaste@yahoo.com> wrote:
>> Tad McClellan wrote:
>>> Clenna Lumina <savagebeaste@yahoo.com> wrote:
>>>> Tad McClellan wrote:
>>>>> Clenna Lumina <savagebeaste@yahoo.com> wrote:
>>>>>
>>>>>> Although most of the built in functions (sort, grep, map, ...)
>>>>>> that return lists behave as you expect in scalar context too.
>>>>>
>>>>>
>>>>> You expected that sort() in a scalar context behaves
>>>>> in an undefined manner?
>>>>
>>>> Hmmm, I stand corrected. I ran some quick command-line tests,
>>>> showing that 'map' and 'grep' return the item count but sort does
>>>> not. It just seems to return undef:
>>>>
>>>>    $ perl -le 'my @list = qw/1 2 4 8 16 32/; print(defined(scalar
>>>> sort @list) ? "Y" : "N");'
>>>>    N
>>>>
>>>> Why is this?
>>>
>>>
>>>   perldoc -f sort
>>>
>>>       sort SUBNAME LIST
>>>       sort BLOCK LIST
>>>       sort LIST
>>>            In list context, this sorts the LIST and returns the
>>>            sorted list value.  In scalar context, the behaviour of
>>>            "sort()" is unde� fined.
>>
>> I understand that it is undefined behavior, but what I'm trying to
>> determine is what useful purpose could that possibly serve?
>
>
> None, other than to indicate that it has been called incorrectly.

True. It just seems like unexpected behavior given that it returns a 
list, and lists in scalar context normally return the amount of items.

>> Why doesn't
>> it just return the count?
>
>
> Why don't you just call map() when you want the count?

Yes one could do that. I can understand why it would not be of high 
importance, as sort in scalar context would seem like a waste when you 
think about it, but that doesn't mean that there will never me never 
were any situations where returning the count could have a use.

For instance, I could imagine some really crazy/obfuscated code that 
uses the body of a sort function to do some unorthodox type processing. 
I mean, I've seen crazier things done in Perl :)

-- 
CL 




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

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


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