[31042] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2287 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 21 06:09:46 2009

Date: Sat, 21 Mar 2009 03:09:10 -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, 21 Mar 2009     Volume: 11 Number: 2287

Today's topics:
    Re: A small problem I can't quite work out. <jurgenex@hotmail.com>
    Re: A small problem I can't quite work out. <jurgenex@hotmail.com>
    Re: Confusion in perlrun documentation <whynot@pozharski.name>
    Re: Confusion in perlrun documentation <schaitan@gmail.com>
    Re: DateTime format of date <whynot@pozharski.name>
        earnmoney on advertisement$500dollers <abcdrajuu@gmail.com>
    Re: How can I keep LWP::UserAgent from adding the http- <whynot@pozharski.name>
    Re: how to extract bunch of things from ( ) <syangs04@gmail.com>
    Re: is anybody using perl for mobile devices? <john1949@yahoo.com>
        new CPAN modules on Sat Mar 21 2009 (Randal Schwartz)
        Passing ARG[0] parameters to a subroutine in a module dn.perl@gmail.com
    Re: Passing ARG[0] parameters to a subroutine in a modu <peter@makholm.net>
    Re: Perl Packager - Free to wrong pool error (Tim McDaniel)
    Re: use warnings unless $foo <jurgenex@hotmail.com>
    Re: use warnings unless $foo <jurgenex@hotmail.com>
    Re: use warnings unless $foo <sensorflo@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 20 Mar 2009 18:10:56 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: A small problem I can't quite work out.
Message-Id: <b9f8s4t5ku9od36fd74j4u218eeer1jmmg@4ax.com>

sj <sjmarshy@gmail.com> wrote:
>I'm making a program just for the joy of it, really, but I'm getting a
>bug I just can't work out. Basically, when I run it, I get the message
>'uninitiated value $whatever in pattern match (m//) at C:\wherever
>line whatever'.

I don't believe you. That is not an error message issued by perl. Maybe
you meant "uninitialized" instead of 'uninitiated'? Please copy and
paste error messages, the exact wording is important.

>The problem is, they are initiated...

Maybe. I don't know what an initiated variable is. Whoever it has no
bearing on a variable being initialized.

>I can post the code if it would
>make this easier, 

That would certainly make it easier. Finding an error in a piece of code
without seeing the code requires some unusual levels of paranormal
abilities.

>but all variables are declared 

The declaration of a variable has nothing to do with its initialization.

>with 'my' not
>'local'...I've tried putting them in different places in the code,
>within loops or all at the begining etc...

Well, fine, but those declare variables, they don't assign any value to
them.

>it used to work :/ maybe I
>should just start again!

It might be easier to just assign a value to the variable $whatever.

jue


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

Date: Fri, 20 Mar 2009 18:15:43 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: A small problem I can't quite work out.
Message-Id: <anf8s4prnmru8omtnaq8k3ch2irc3injcb@4ax.com>

sj <sjmarshy@gmail.com> wrote:
>Sorry, I'm completely new to both programming and usenet, I'll attempt
>to pick it up as fast as possible.
>I *think* it's the 'special' and 'checkinput' subs that are having the
>problems...

Your code does not have a variable $whatever, which -as you claimed in
your first posting- was named in the error message.

>#use strict;
>#use warnings;

Why are you disabling the two most helpful weapons against frequent
programmer mistakes in perl's arsenal? Enable them, fix all the warnings
and error messages you get now, and then we can talk again. In all
likelyhood your original problem will be gone by then.

[rest of code snipped]

jue


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

Date: Fri, 20 Mar 2009 23:03:33 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: Confusion in perlrun documentation
Message-Id: <slrngs815f.u55.whynot@orphan.zombinet>

On 2009-03-20, Peter Scott <Peter@PSDT.com> wrote:
> On Fri, 20 Mar 2009 04:49:20 -0700, Krishna Chaitanya wrote:
>
>> Hi, I've been trying out a2p and found these lines at the top of the
>> perl output:
>> 
>> #!/usr/bin/perl
>> eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
>>     if $running_under_some_shell;
>> 
>> Googled around for this and found several links to perlrun that attempt
>> to explain what this idiom does exactly but I am confused about the part
>> where the shell exec's /usr/bin/perl with the script name and its
>> arguments and then .... "ignores the lines parsed from the script
>> because the $running_under_some_shell variable is always false"....
>> 
>> Where is the glue between parsing lines and ignoring them due to this
>> undefined variable? How is this happening exactly? Could anyone please
>> explain in a simpler language what is happening?
>
> This construct is meant for ancient systems that don't know what #!
> means and pass every script to /bin/sh.  (Anyone know whether any such
> systems are still in use?)
>
> The lines are written so that they do the right thing in both /bin/sh
> and perl.  When /bin/sh reads the first line, it interprets it as
> meaning, "run perl on this file and pass it the arguments I was given",
> which is what you want.  When perl runs the file - whether because it
> was started on it originally due to being on a nonbroken system or whether 
> because it was started by the eval line - it reads the eval line but being 
> perl, then reads the next line to see the rest of the statement, and 
> ignores it because $running_under_some_shell was never set and is 
> therefore undef, hence false.  Then it goes on with the rest of the 
> program.

And here we have that fabulous I<-w> story again.  Or not.

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


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

Date: Sat, 21 Mar 2009 02:42:35 -0700 (PDT)
From: Krishna Chaitanya <schaitan@gmail.com>
Subject: Re: Confusion in perlrun documentation
Message-Id: <720a8cdd-d6f9-4dcb-9894-4e25f98e7b5b@o2g2000prl.googlegroups.com>

>
> And here we have that fabulous I<-w> story again. =A0Or not.
>

Excuse me, I didn't get it. What is the story about? :)


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

Date: Fri, 20 Mar 2009 22:41:02 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: DateTime format of date
Message-Id: <slrngs7vr8.u55.whynot@orphan.zombinet>

On 2009-03-19, Justin C <justin.0903@purestblue.com> wrote:
> On 2009-03-18, Glenn Jackman <glennj@ncf.ca> wrote:
*SKIP*
>>     my $formattedDate = strftime "%d%m%y", localtime; 
>
> Works perfectly, thank you. But I'm not sure what's going on.
> strftime = STRing Formatting of TIME? 
> ... and why is the documentation for it in DateTime when you don't need
> the DateTime module for it to run? There's obviously still a *lot* for
> me to learn.

(mere attempt to make you more confused) Consider reading something
about Unix programming.  That will make rounds about C (the very old
stuff the Perl is still written in, you know) obviously, but when you'll
succeed you'll acquire better understanding what Perl does.

*SKIP*
>>     substr( my $fmtDate = $date->dmy(), 4, 2) = '';
>
> Yeah, but it's not as clear/elegant as your first suggestion.

I beg to differ.  Either clearness or elegance is matter of taste.  As
of me this one is cute and teaching.

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


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

Date: Fri, 20 Mar 2009 23:56:39 -0700 (PDT)
From: abcdrajuu <abcdrajuu@gmail.com>
Subject: earnmoney on advertisement$500dollers
Message-Id: <38d97ad5-8ff0-4db6-980a-b68286500565@z8g2000prd.googlegroups.com>

earnmoney on advertisement$500dollers
http://www.earnpound.50webs.com
http://www.earnpound.50webs.com


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

Date: Fri, 20 Mar 2009 22:52:51 +0200
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: How can I keep LWP::UserAgent from adding the http-equiv strings  from the Head section of the page?
Message-Id: <slrngs80hd.u55.whynot@orphan.zombinet>

On 2009-03-20, J. Gleixner <glex_no-spam@qwest-spam-no.invalid> wrote:
> CronJob wrote:
*SKIP*
>> print "The headers:\n$headers\n";
>> print "The body:\n$body\n";
>
> You can call print once, with a list:
>
> print "The headers:\n$headers\n",
>        "The body:\n$body\n";

With such outrageous number of newlines I would suggest

	print <<"EOT";
	The headers:
	$headers
	The body:
	$body
	EOT

*CUT*

-- 
Torvalds' goal for Linux is very simple: World Domination
Stallman's goal for GNU is even simpler: Freedom


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

Date: Fri, 20 Mar 2009 15:47:18 -0700 (PDT)
From: sherry <syangs04@gmail.com>
Subject: Re: how to extract bunch of things from ( )
Message-Id: <08da6d40-fbb7-4076-bd15-1801789fae2a@e1g2000pra.googlegroups.com>

Thanks for all the people replied. Since the length of the heading and
trailing are fixed, I used substr to extract it.

Sherry


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

Date: Sat, 21 Mar 2009 07:20:57 -0000
From: "John" <john1949@yahoo.com>
Subject: Re: is anybody using perl for mobile devices?
Message-Id: <gq24gp$rcj$1@news.albasani.net>


"rabbits77" <rabbits77@my-deja.com> wrote in message 
news:3da8b$49c3d185$c650990a$10714@news.eurofeeds.com...
>I am curious to see if it is possible to use perl
> to develop for mobile devices. Googling has revealed to
> me a very old stab at perl for Symbian phone.
> There are a couple of other tries here and there
> but they are all very old and seem to not be maintained
> and provide no documentation or examples.
> Does anyone here know of any actively maintained perl SDKs
> for mobile devices?

Simplewire Inc had a Perl SDK for text messaging.

Regards
John





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

Date: Sat, 21 Mar 2009 04:42:26 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Mar 21 2009
Message-Id: <KGuAEq.1KMA@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.

Algorithm-Cluster-1.44
http://search.cpan.org/~mdehoon/Algorithm-Cluster-1.44/
Perl interface to the C Clustering Library. 
----
Algorithm-Evolutionary-0.66
http://search.cpan.org/~jmerelo/Algorithm-Evolutionary-0.66/
Perl module for performing paradigm-free evolutionary algorithms. 
----
Algorithm-LSH-0.00001_01
http://search.cpan.org/~miki/Algorithm-LSH-0.00001_01/
perl implementation of Locality Sensitive Hashing 
----
Apache2-WURFLFilter-1.5
http://search.cpan.org/~ifuschini/Apache2-WURFLFilter-1.5/
is a Apache Mobile Filter that manage content (text & image) to the correct mobile device 
----
Apache2-WURFLFilter-1.51
http://search.cpan.org/~ifuschini/Apache2-WURFLFilter-1.51/
is a Apache Mobile Filter that manage content (text & image) to the correct mobile device 
----
App-Sequence-0.0401
http://search.cpan.org/~kimoto/App-Sequence-0.0401/
pluggable subroutine engine. 
----
CGI-Session-4.41
http://search.cpan.org/~markstos/CGI-Session-4.41/
persistent session data in CGI applications 
----
CPANPLUS-Dist-Arch-0.01
http://search.cpan.org/~juster/CPANPLUS-Dist-Arch-0.01/
Creates Archlinux packages from Perl's CPAN repository. 
----
Class-DBI-Lite-0.020
http://search.cpan.org/~johnd/Class-DBI-Lite-0.020/
Lightweight ORM for Perl 
----
Correios-Frete-0.00001
http://search.cpan.org/~tbr/Correios-Frete-0.00001/
get the price to send with Correios (Brazilian Post-Office) your mail. 
----
DBIx-DWIW-0.49
http://search.cpan.org/~jzawodny/DBIx-DWIW-0.49/
Robust and simple DBI wrapper to Do What I Want (DWIW) 
----
Data-Feed-0.00009
http://search.cpan.org/~dmaki/Data-Feed-0.00009/
Extensible Feed Parsing Tool 
----
Data-Inspect-0.01
http://search.cpan.org/~owl/Data-Inspect-0.01/
human-readable object representations 
----
File-Lock-Multi-0.03
http://search.cpan.org/~crakrjack/File-Lock-Multi-0.03/
Lock files more than once 
----
File-ShareDir-PAR-0.05
http://search.cpan.org/~smueller/File-ShareDir-PAR-0.05/
File::ShareDir with PAR support 
----
FlatFile-DataStore-0.08
http://search.cpan.org/~bbaxter/FlatFile-DataStore-0.08/
Perl module that implements a flat file data store. 
----
FlatFile-DataStore-0.09
http://search.cpan.org/~bbaxter/FlatFile-DataStore-0.09/
Perl module that implements a flat file data store. 
----
FlatFile-DataStore-Lite-0.01
http://search.cpan.org/~bbaxter/FlatFile-DataStore-Lite-0.01/
Perl module that implements a lightweight flat file data store. 
----
FreeBSD-i386-Ptrace-0.02
http://search.cpan.org/~dankogai/FreeBSD-i386-Ptrace-0.02/
Ptrace for FreeBSD-i386 
----
FreeBSD-i386-Ptrace-0.03
http://search.cpan.org/~dankogai/FreeBSD-i386-Ptrace-0.03/
Ptrace for FreeBSD-i386 
----
Geo-Coder-Google-0.05
http://search.cpan.org/~miyagawa/Geo-Coder-Google-0.05/
Google Maps Geocoding API 
----
Log-Simplest
http://search.cpan.org/~dmytro/Log-Simplest/
----
Mac-Finder-DSStore-0.94
http://search.cpan.org/~wiml/Mac-Finder-DSStore-0.94/
Read and write Macintosh Finder DS_Store files 
----
Mail-IMAPClient-3.15
http://search.cpan.org/~markov/Mail-IMAPClient-3.15/
An IMAP Client API 
----
Math-Cartesian-Product-1.001
http://search.cpan.org/~prbrenan/Math-Cartesian-Product-1.001/
Generate the cartesian product of zero or more lists. 
----
Module-Install-Any-Moose-0.00002
http://search.cpan.org/~dmaki/Module-Install-Any-Moose-0.00002/
Any::Moose Support For Module::Install 
----
Muldis-D-0.62.1
http://search.cpan.org/~duncand/Muldis-D-0.62.1/
Formal spec of Muldis D relational DBMS lang 
----
Muldis-D-0.62.2
http://search.cpan.org/~duncand/Muldis-D-0.62.2/
Formal spec of Muldis D relational DBMS lang 
----
Muldis-D-0.62.3
http://search.cpan.org/~duncand/Muldis-D-0.62.3/
Formal spec of Muldis D relational DBMS lang 
----
Net-IMAP-Server-1.13
http://search.cpan.org/~alexmv/Net-IMAP-Server-1.13/
A single-threaded multiplexing IMAP server implementation, using Net::Server::Coro. 
----
Net-Ping-Network-1.62
http://search.cpan.org/~angerstei/Net-Ping-Network-1.62/
A modul to ICMP-request nodes in a network (or list) very fast 
----
PDF-API2-0.73
http://search.cpan.org/~areibens/PDF-API2-0.73/
A Perl Module Chain to faciliate the Creation and Modification of High-Quality "Portable Document Format (aka. PDF)" Files. 
----
POE-Component-PubSub-0.05
http://search.cpan.org/~nperez/POE-Component-PubSub-0.05/
A generic publish/subscribe POE::Component that enables POE::Sessions to publish events to which other POE::Sessions may subscribe. 
----
POE-Filter-Hessian-0.1.3
http://search.cpan.org/~heytrav/POE-Filter-Hessian-0.1.3/
Translate datastructures to and from Hessian for transmission via a POE ReadWrite wheel. 
----
Pod-POM-0.23
http://search.cpan.org/~andrewf/Pod-POM-0.23/
POD Object Model 
----
SVN-Access-0.05
http://search.cpan.org/~mgregoro/SVN-Access-0.05/
Perl extension to manipulate SVN Access files 
----
SVN-Look-0.14.12
http://search.cpan.org/~gnustavo/SVN-Look-0.14.12/
A caching wrapper aroung the svnlook command. 
----
Storable-AMF-0.57
http://search.cpan.org/~grian/Storable-AMF-0.57/
Perl extension for serialize/deserialize AMF0/AMF3 data 
----
Term-ReadLine-Gnu-1.19
http://search.cpan.org/~hayashi/Term-ReadLine-Gnu-1.19/
Perl extension for the GNU Readline/History Library 
----
Test-XML-Deep-0.07
http://search.cpan.org/~jlavallee/Test-XML-Deep-0.07/
= XML::Simple + Test::Deep 
----
Text-CSV_XS-0.63
http://search.cpan.org/~hmbrand/Text-CSV_XS-0.63/
comma-separated values manipulation routines 
----
Tk-Clock-0.26
http://search.cpan.org/~hmbrand/Tk-Clock-0.26/
Clock widget with analog and digital display 
----
VCS-SCCS-0.15
http://search.cpan.org/~hmbrand/VCS-SCCS-0.15/
OO Interface to SCCS files 
----
WordNet-QueryData-1.48
http://search.cpan.org/~jrennie/WordNet-QueryData-1.48/
direct perl interface to WordNet database 
----
XML-RSS-FromHTML-0.041
http://search.cpan.org/~bashi/XML-RSS-FromHTML-0.041/
simple framework for making RSS out of HTML 


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, 21 Mar 2009 00:08:15 -0700 (PDT)
From: dn.perl@gmail.com
Subject: Passing ARG[0] parameters to a subroutine in a module
Message-Id: <a16268bd-02be-41f0-b790-7084180a8ed1@w1g2000prk.googlegroups.com>



use English ;

Within a single-file script, I tend to use the following method to
pass arguments :

$rh_result_set = &main::get_data( {
    rh_query        => $rh_query,
    rh_db_details => $rh_db_details,
    db_name => $db_name } );

sub get_data
{
    my $rh_query        = $ARG[0]{rh_query};
    my $rh_db_details = $ARG[0]{rh_db_details};
}


Is it possible, and if possible is it advisable, to pass parameters to
a function in a module in this manner?

-------



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

Date: Sat, 21 Mar 2009 09:59:12 +0100
From: Peter Makholm <peter@makholm.net>
Subject: Re: Passing ARG[0] parameters to a subroutine in a module
Message-Id: <874oxn1cbj.fsf@vps1.hacking.dk>

dn.perl@gmail.com writes:

> use English ;
>
> $rh_result_set = &main::get_data( {

You shouldn't use '&' as it is considered bad style. Using the fully
quallyfied name ''main::get_data' instead of just 'get_data' is
unneeded too.

>     rh_query        => $rh_query,
>     rh_db_details => $rh_db_details,
>     db_name => $db_name } );
>
> sub get_data
> {
>     my $rh_query        = $ARG[0]{rh_query};
>     my $rh_db_details = $ARG[0]{rh_db_details};
> }
>
>
> Is it possible, and if possible is it advisable, to pass parameters to
> a function in a module in this manner?

Yes it is possible if the module's API is defined that way. If a
module provides both a positional and a named way of passing
parameters I prefere to use the latter.

But I really don't like to have to add an extra pair of
parentheses. So I usually define my functions with named parameteres
in this way:

    sub get_data {
        my %args    = @_;
        my $query   = $args{query};
        my $details = $args{details};

        ...
    }

    get_data( query => 'foo', details => 1 );

//Makholm



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

Date: Fri, 20 Mar 2009 22:38:59 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Perl Packager - Free to wrong pool error
Message-Id: <gq15u3$an8$1@reader1.panix.com>

In article <0bd49123-0355-4fb7-a205-3bd72d7e020b@v1g2000prd.googlegroups.com>,
 <google@markginsburg.com> wrote:
>On Mar 17, 6:53 pm, Ben Morrow <b...@morrow.me.uk> wrote:
>> Since you're on Win32, is there a good reason for using fork/exec rather
>> than system(1, ...) or Win32::Process?
 ...
>
>I was unaware that system() could be made to run asynchroneously.

I'd never heard of it either.  I Googled and found
<http://www.mail-archive.com/perl-win32-users@listserv.activestate.com/msg35810.html>
explaining things.

It's not documented in "perlfunc system" but in "man perlport".  The
text (the trailing "(Win32)" apparently means "this paragraph applies
to Windows 32-bit"):

    As an optimization, may not call the command shell specified in
    $ENV{PERL5SHELL}.  "system(1, @args)" spawns an external process
    and immediately returns its process designator, without waiting
    for it to terminate.  Return value may be used subsequently in
    "wait" or "waitpid".  Failure to spawn() a subprocess is indicated
    by setting $? to "255 << 8".  $? is set in a way compatible with
    Unix (i.e. the exitstatus of the subprocess is obtained by "$?  >>
    8", as described in the documentation).  (Win32)

The Jan Dubois, in that note above, also wrote "

> One thing that may not be obvious from the documentation is that
> Perl keeps track of the process ids returned by system(1, ...), and
> the call will fail once you have created more than 63 processes.
> 
> Check here for a "workaround" to make sure you at least reclaim
> handles of processes no longer running:
> 
>     http://aspn.activestate.com/ASPN/Mail/Message/pdk/3122771
> 
> You will still be limited to about 63 concurrent processes.

I haven't looked further for a few minutes, but I found no other
gotchas.

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 20 Mar 2009 23:13:41 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: use warnings unless $foo
Message-Id: <bv09s4t2t9q77cl402bgte37tj6jbnueb1@4ax.com>

Florian Kaufmann <sensorflo@gmail.com> wrote:
>use, no, package are special in that I can not say
>
>use warnings if $foo;

Well, yes, you can. But it doesn't do what you seem to expect it to do.
use() is executed at compile time because it is a short form of 
	BEGIN { require Module; import Module LIST; }

If you don't want that but want it to be executed at compile time after
evaluating and assessing $foo then just use the block without the
BEGIN/END:
	if $foo then {require warnings; import warnings;}

>Is there a name for those keywords which do not form a normal
>expression? I.e. where I can not append a statement modifier.

Missleading way of thinking. The problem is It is not that you can't
statement modifiers, it is that 
>Where in the perldoc do I find a complete list of those keywords?
>
>Thank you
>
>Flo


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

Date: Fri, 20 Mar 2009 23:20:53 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: use warnings unless $foo
Message-Id: <nd19s4hmkt153bdbn00fk7a7crug64m8jg@4ax.com>

Jürgen Exner <jurgenex@hotmail.com> wrote:
[Sorry, hit the wrong button]
>Florian Kaufmann <sensorflo@gmail.com> wrote:
>>use, no, package are special in that I can not say
>>
>>use warnings if $foo;
>
>Well, yes, you can. But it doesn't do what you seem to expect it to do.
>use() is executed at compile time because it is a short form of 
>	BEGIN { require Module; import Module LIST; }
>
>If you don't want that but want it to be executed at compile time after
>evaluating and assessing $foo then just use the block without the
>BEGIN/END:
>	if $foo then {require warnings; import warnings;}
>
>>Is there a name for those keywords which do not form a normal
>>expression? I.e. where I can not append a statement modifier.

Misleading way of thinking. The problem is NOT that you couldn't
use statement modifiers. The problem is that that BEGIN/END enforces
execution at compile time, i.e. before perl had any chance to look at
the condition 'if $foo'.

>>Where in the perldoc do I find a complete list of those keywords?

About the fourth line of 
	perldoc -f use

As for where to find "BEGIN/END": that's a good question :-) I couldn't
find an entry after a brief search.

jue


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

Date: Sat, 21 Mar 2009 00:46:40 -0700 (PDT)
From: Florian Kaufmann <sensorflo@gmail.com>
Subject: Re: use warnings unless $foo
Message-Id: <ffea8828-c734-44d1-8031-182b121b9bff@v38g2000yqb.googlegroups.com>

> Well, yes, you can. But it doesn't do what you seem to expect it to do.

Apparently not:

  $ perl -e 'use warnings if $foo'
  syntax error at -e line 1, near "use warnings if"
  Execution of -e aborted due to compilation errors.
  $ perl --version

  This is perl, v5.10.0 built for i486-linux-gnu-thread-multi

It's not that I currently wan't to do such sort of thing, I just want
to learn Pearl properly. But you mentioned the right thing: use, no,
package happen at compile time. So I ask another way round: Is there a
complete list of things (keywords?) that happen at compile time, and
thus can't have a statement modifier. Is there a name for the group of
such things?

Flo



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

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


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