[28568] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9932 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Nov 5 14:05:49 2006

Date: Sun, 5 Nov 2006 11:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 5 Nov 2006     Volume: 10 Number: 9932

Today's topics:
    Re: FAQ 5.22 All I want to do is append a small amount  <tadmc@augustmail.com>
    Re: I need to be amused on the perldocs that ship with  <john@castleamber.com>
    Re: Keep getting error with email validation script <tadmc@augustmail.com>
    Re: Keep getting error with email validation script <rvtol+news@isolution.nl>
    Re: Keep getting error with email validation script (Randal L. Schwartz)
    Re: Keep getting error with email validation script <admin@link-exchangers.com>
    Re: Keep getting error with email validation script <admin@link-exchangers.com>
        Question on having the hash not butt plug my computers  <cdalten@gmail.com>
        warnings or -w ? <ynl@nsparks.net>
    Re: warnings or -w ? <sisyphus1@nomail.afraid.org>
    Re: warnings or -w ? <tadmc@augustmail.com>
    Re: warnings or -w ? <hjp-usenet2@hjp.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 5 Nov 2006 05:27:23 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: FAQ 5.22 All I want to do is append a small amount of text to the end of a file.  Do I still have to use locking?
Message-Id: <slrnekrikr.c7t.tadmc@tadmc30.august.net>

Puckdropper <puckdropper@yahoo.com> wrote:
> PerlFAQ Server <brian@stonehenge.com> wrote in
> news:mbtv14-5k.ln1@blue.stonehenge.com: 
>
>> This is an excerpt from the latest version perlfaq5.pod, which
>> comes with the standard Perl distribution. These postings aim to 
>> reduce the number of repeated questions as well as allow the community
>> to review and update the answers. The latest version of the complete
>> perlfaq is at http://faq.perl.org .
>> 
>> --------------------------------------------------------------------
>> 
>> 5.22: All I want to do is append a small amount of text to the end of
>> a file.  Do I still have to use locking? 
>> 
>>  
>
> *snip, no code*
>
>> 
>>     If you know you are only going to use a system that does correctly
>>     implement appending (i.e. not Win32) then you can omit the seek()
>>     from the above code.
>> 
>
> *snip*
>
> There's no code included in this post.  


But there is code _referenced_ in that post:

   use the example appending code from "perldoc -f flock"


> Would someone either change the 
> paragraph to be less ambiguous or include the code?


It would be less ambiguous if it instead said:

   you can omit the seek() from the above-referenced code.

or some such.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 5 Nov 2006 16:39:43 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: I need to be amused on the perldocs that ship with Perl.
Message-Id: <Xns98726C752B87Fcastleamber@130.133.1.4>

Michele Dondi <bik.mido@tiscalinet.it> wrote:

> On 4 Nov 2006 13:47:57 -0800, "grocery_stocker" <cdalten@gmail.com>
> wrote:
> 
>>I don't know who Xah Lee is. Actually, I don't know who any of the
>>developers are. I could really care less. I think this stems from my
> 
> You should care some more since xl is far from being any of the
> developers, he's actually one guy who's been trolling here and
> elsewhere (maybe he's *still* trolling, but I've killfiled him since
> long, and I'm not really sure) just like you *seem* to be doing now,
> and that's what John meant.

Xah posted quite some time a lot of criticism on the documentation that 
came with Python. I can't recall he submitted corrections and 
improvements. This poster seems to have issues with the documentation on 
closures. So it would be nice if he/she submitted corrections/additions, 
etc, so all can learn. But I doubt if this ever is going to happen.

And yes, Xah still posts, but less frequent. I know that some people are 
still reporting him for every spam attempt (cross post to 5 groups with 
links to articles on his site).

-- 
John                Experienced Perl programmer: http://castleamber.com/

          Perl help, tutorials, and examples: http://johnbokma.com/perl/


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

Date: Sun, 5 Nov 2006 05:35:56 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Keep getting error with email validation script
Message-Id: <slrnekrj4s.c7t.tadmc@tadmc30.august.net>

Get Links <admin@link-exchangers.com> wrote:

> print "Content-type: text/html";
                               ^^
                               ^^

You mark the end of the headers with a blank line, so:

   print "Content-type: text/html\n\n";


>  if ($email
>=~m/^([A-Z0-9]+[._]?){1,}[A-Z0-9]+\@(([A-Z0-9]+[-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i)
> {
> print "Good email: $email\n";


Errr, you said you were going to be generating HTML, but that
doesn't look like HTML, so:

   print "Content-type: text/plain\n\n";

instead then.


> print OUT $firstname ."|" . $email . "|" . "\n";


Yuck!

   print OUT "$firstname|$email|\n";
or
   print OUT join '|', $firstname, $email, "\n";


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sun, 5 Nov 2006 13:10:23 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Keep getting error with email validation script
Message-Id: <eiknuo.is.1@news.isolution.nl>

Tad McClellan schreef:

>    print OUT join '|', $firstname, $email, "\n";

Alternatives:

1. { local $, = '|' ;
     print OUT $firstname, $email, "\n" ;
   }

2. { local ($\, $,) = ("\n", '|') ;
     print OUT $firstname, $email, q// ;
   }

3. { local ($\, $") = ("\n", '|') ;
     print OUT "@{[ $firstname, $email, q// ]}" ;
   }

I tend to use #2 a lot, but with ($\, $,) set earlier. 

-- 
Affijn, Ruud

"Gewoon is een tijger."


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

Date: 05 Nov 2006 06:15:59 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Keep getting error with email validation script
Message-Id: <86odrmj7xc.fsf@blue.stonehenge.com>

>>>>> "Get" == Get Links <admin@link-exchangers.com> writes:

Get>  if ($email
Get> =~m/^([A-Z0-9]+[._]?){1,}[A-Z0-9]+\@(([A-Z0-9]+[-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i)

That's absolutely *not* a regex to match a "valid email address".
You are victim of the cargo-cult phenomenon of "cut n paste this from
somewhere else" which apparently *also* got it wrong.

To validate email addresses, see Email::Valid and Mail::RFC822::Address
in the CPAN.  Both of them *compute* the "valid email regex" from
component rules.  Here is the result of one of them:

    $ perl -MMail::RFC822::Address -le 'print Mail::RFC822::Address::make_rfc822re()'
    (?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;!
 :\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r!
 \n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*!
\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\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?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@!
 (?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\!
n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*))*)?;\s*)

Yes, if you're not using a regex that is at LEAST that complex, you are NOT
matching email addresses.  Yes, I'm serious.

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!

-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: 5 Nov 2006 09:43:51 -0800
From: "Get Links" <admin@link-exchangers.com>
Subject: Re: Keep getting error with email validation script
Message-Id: <1162748631.598353.6700@m73g2000cwd.googlegroups.com>

Wow! Randall Schwartz! I'm honored!...I've read your books..
I tried your regex and got a boo boo..  It said pattern not terminated.
 Where did I goof this up?

#!/usr/bin/perl -w

use CGI qw(param);
my $firstname = param("firstname");
my $email = param("email");
#my $email = "test@test.com";
my $zfile= "../list/list.txt";
#my $zfile= "c:/list.txt";
##########################################################
print "Content-type: text/html\n\n";
 if ($email =~m/(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[
\t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\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".\[\]
\000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[
\t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[(?:[^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*))*\>(?:(?:\r\n)?[ \t])*))*)?;\s*)
 {
print "Good email: $email\n";

open (OUT, ">>$zfile") || die("Can't open file!");
print OUT $firstname ."|" . $email . "|" . "\n";
close OUT;
print "name added";
} else {
                print "Bad email: $email\n";
        }



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

Date: 5 Nov 2006 10:31:28 -0800
From: "Get Links" <admin@link-exchangers.com>
Subject: Re: Keep getting error with email validation script
Message-Id: <1162751488.582748.46060@e3g2000cwe.googlegroups.com>


I just want to say thanks to everyone else for your help on this.  I
got it working. I also want to check the dns to verify it also. I found
this code, but when I run it, it doesn't print out any message or add
the address to the list.  it just hangs there with a blank browser.

#!/usr/bin/perl -w

use CGI qw(param);
my $firstname = param("firstname");
my $email = param("email");
#my $email = "test@test.com";
my $zfile= "../list/list.txt";
#my $zfile= "c:/list.txt";
##########################################################
print "Content-type: text/html\n\n";

 if ($email
=~m/^([A-Z0-9]+[._]?){1,}[A-Z0-9]+\@(([A-Z0-9]+[-]?){1,}[A-Z0-9]+\.){1,}[A-Z]{2,4}$/i)
{
&valid_address($email);
#print "valid email$valid";
#exit;
if ($valid==1) {
print "Good email: $email\n";
open (OUT, ">>$zfile") || die ("Can't open file!");
print OUT $firstname ."|" . $email . "|" . "\n";
close OUT;
print "name added";
} else {
   print "Bad email: $email\n";
        }
}
sub valid_address {
        	my($addr) = @_;
        	my($domain, $valid);
         	return(0) unless ($addr =~ /^[^@]+@([-\w]+\.)+[A-Za-z]
        					{2,4}$/);
        	$domain = (split(/@/, $addr))[1];
        	$valid = 0; open(DNS, "nslookup -q=any $domain |") ||
        					return(-1);
        	while (<DNS>) {
        		$valid = 1 if (/^$domain.*\s(mail exchanger|
        					internet address)\s=/);
        	}
        	return($valid);
        }


Thanks,

Scot 

http://www.link-exchangers.com
"Get your page rank high"



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

Date: 5 Nov 2006 10:27:42 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Question on having the hash not butt plug my computers memory
Message-Id: <1162751262.066365.270230@h48g2000cwc.googlegroups.com>

Given the following:

#!/usr/bin/perl -w

package Person;

sub new {
    my $that = shift;
    my $class = ref($that) || $that;
    my $self = {
        NAME => undef,
        AGE => undef,
        PEERS => []
        };

    my $closure = sub {
        my $field = shift;
        if (@_) { $self->{$field} = shift }
        return $self->{$field};
    };

    bless($closure, $class);
    return $closure;
}

sub name   { &{ $_[0] }("NAME",  @_[ 1 .. $#_ ] ) }

package main;

$him = Person->new();
$him2 = Person->new();
$him3 = Person->new();

$him->name("my ex girlfried");
$him2->name("is a");
$him3->name("whore");

print $him->name, "\n";
print $him2->name, "\n";
print $him3->name, "\n";

This presumably creates 3 hashes. If I modified this to create say like
30,000 hashes, this could possibly blow.

Okay, if modified the code to have something like:
use Symbol;
$obj = Symbol::gensym();

vs

my $self = {
        NAME => undef,
        AGE => undef,
        PEERS => []
        };

Would I still be creating more memory each time I invoked a new
instance of the object?



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

Date: Sun, 5 Nov 2006 13:24:25 +0100
From: Yohan N Leder <ynl@nsparks.net>
Subject: warnings or -w ?
Message-Id: <MPG.1fb7f666306ba39f9898ec@news.tiscali.fr>

Hello,

What the preferable way to activate warnings in CGI Perl scripts ? And, 
especially, why ?

1) The "-w" in the shebang line as "#!/usr/bin/perl -w"
2) Or a "use warnings;"

This question because, I'm used to use "use warnings", but was surprised 
to see, some days ago, that some servers (for example, in a Fedora Core 
5 with httpd and the Perl packages installed by default) don't have this 
module and fail on it with errors log saying something like "no such a 
file".


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

Date: Sun, 5 Nov 2006 23:55:47 +1100
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: warnings or -w ?
Message-Id: <454de076$0$5109$afc38c87@news.optusnet.com.au>


"Yohan N Leder" <ynl@nsparks.net> wrote in message
news:MPG.1fb7f666306ba39f9898ec@news.tiscali.fr...
> Hello,
>
> What the preferable way to activate warnings in CGI Perl scripts ? And,
> especially, why ?
>
> 1) The "-w" in the shebang line as "#!/usr/bin/perl -w"
> 2) Or a "use warnings;"

See 'perldoc perllexwarn'.
I think the short answer is "use warnings, unless the warnings module is not
available".

>
> This question because, I'm used to use "use warnings", but was surprised
> to see, some days ago, that some servers (for example, in a Fedora Core
> 5 with httpd and the Perl packages installed by default) don't have this
> module and fail on it with errors log saying something like "no such a
> file".

I don't think the warnings module became available until perl-5.6.
Any servers running earlier versions of perl will therefore throw up the
error you describe.

Cheers,
Rob





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

Date: Sun, 5 Nov 2006 08:19:05 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: warnings or -w ?
Message-Id: <slrnekrsmp.dri.tadmc@tadmc30.august.net>

Yohan N Leder <ynl@nsparks.net> wrote:

> What the preferable way to activate warnings in CGI Perl scripts ? 


[ Using Perl in a CGI environment has no bearing on which one is preferred.

  But if you _are_ using Perl in a CGI environment, then:

      perldoc -q CGI

       How can I get better error messages from a CGI program?
]


That can be answered by

   perldoc warnings

       The "warnings" pragma is a replacement for the command line flag "−w",

> And, 
> especially, why ?


That is the next line of the docs quoted above:

       but the pragma is limited to the enclosing block, while the flag is
       global.  See perllexwarn for more information.


> 1) The "-w" in the shebang line as "#!/usr/bin/perl -w"
> 2) Or a "use warnings;"
>
> This question because, I'm used to use "use warnings", 


Good. Keep doing that.


> but was surprised 
> to see, some days ago, that some servers (for example, in a Fedora Core 
> 5 with httpd and the Perl packages installed by default) don't have this 
> module 


Then they likely have a really really old version of perl.

Lexical warnings (ie. use warnings) have been part of Perl
for many years.


> and fail on it with errors log saying something like 


"something like" is worthless when dealing with computers. Exact
details matter when dealing with machines.

Please quote the exact text of the message.

Have you seen the Posting Guidelines that are posted here frequently?


> "no such a 
> file".


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sun, 5 Nov 2006 15:11:48 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: warnings or -w ?
Message-Id: <slrnekrs94.de7.hjp-usenet2@yoyo.hjp.at>

On 2006-11-05 12:24, Yohan N Leder <ynl@nsparks.net> wrote:
> This question because, I'm used to use "use warnings", but was surprised 
> to see, some days ago, that some servers (for example, in a Fedora Core 
> 5 with httpd and the Perl packages installed by default) don't have this 
> module

I don't believe this. Fortunately I have a Fedora 5 box to check:

wifo715:~ 15:06 101% cat /etc/redhat-release 
Fedora Core release 5 (Bordeaux)
wifo715:~ 15:06 102% perl -Mwarnings -e 42
Useless use of a constant in void context at -e line 1.

Seems to be there

wifo715:~ 15:07 104% perldoc -l warnings
/usr/lib/perl5/5.8.8/warnings.pm
wifo715:~ 15:07 105% rpm -qf /usr/lib/perl5/5.8.8/warnings.pm
perl-5.8.8-5

and it's in the base package. If you find a Fedora 5 which has perl
installed but no warnings.pm, it either isn't Fedora's perl package or
somebody has manually deleted part of the package.

	hp

-- 
   _  | Peter J. Holzer    | > Wieso sollte man etwas erfinden was nicht
|_|_) | Sysadmin WSR       | > ist?
| |   | hjp@hjp.at         | Was sonst wäre der Sinn des Erfindens?
__/   | http://www.hjp.at/ |	-- P. Einstein u. V. Gringmuth in desd


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

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 V10 Issue 9932
***************************************


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