[28569] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9933 Volume: 10

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

Date: Sun, 5 Nov 2006 15:05:06 -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: 9933

Today's topics:
        ANNOUNCE: Win32::GUI v1.05 <rmay@popeslane.clara.co.uk>
    Re: Keep getting error with email validation script <cdalten@gmail.com>
    Re: Keep getting error with email validation script <cdalten@gmail.com>
    Re: Keep getting error with email validation script <mark.clementsREMOVETHIS@wanadoo.fr>
    Re: Keep getting error with email validation script <hjp-usenet2@hjp.at>
    Re: Keep getting error with email validation script <someone@example.com>
    Re: Keep getting error with email validation script <sbryce@scottbryce.com>
    Re: Keep getting error with email validation script <cdalten@gmail.com>
        Scan forward n lines from specified file offset <robert.dodier@gmail.com>
    Re: Scan forward n lines from specified file offset (reading news)
    Re: Sorted Hash and or Array <bradbrockman@yahoo.com>
    Re: warnings or -w ? <m@remove.this.part.rtij.nl>
    Re: warnings or -w ? <ynl@nsparks.net>
    Re: warnings or -w ? <ynl@nsparks.net>
    Re: warnings or -w ? <ynl@nsparks.net>
    Re: warnings or -w ? <1usa@llenroc.ude.invalid>
    Re: warnings or -w ? <hjp-usenet2@hjp.at>
        www::mechanize and forms kjhjhjhjadsasda@urbanhabit.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 05 Nov 2006 21:18:47 +0000
From: Robert May <rmay@popeslane.clara.co.uk>
Subject: ANNOUNCE: Win32::GUI v1.05
Message-Id: <lsmdnb1OFqiqyNPYnZ2dnUVZ8t2dnZ2d@pipex.net>

I am please to announce that v1.05 of Win32::GUI is available for
download from SourceForge and CPAN.

Win32::GUI is a Perl extension allowing creation of native Win32 GUI
applications.

MORE INFORMATION

   Project Homepage:
   http://perl-win32-gui.sourceforge.net/

   Project summary:
   http://sourceforge.net/projects/perl-win32-gui/

   Downloads:
   - Source and ActiveState Perl PPM distributions:
     http://sourceforge.net/project/showfiles.php?group_id=16572
   - Source only:
     http://search.cpan.org/~robertmay/Win32-GUI-1.04/

   Release notes:
   https://sourceforge.net/project/shownotes.php?release_id=455710

RELEASE NOTES AND CHANGES

NAME
     Win32::GUI::ReleaseNotes::RN_1_05 - release notes for v1.05 of
     Win32::GUI

Release Date
     5th November, 2006

Summary of Changes
     This is a summary of changes between V1.04 and V1.05 See the CHANGELOG
     file in the distribution for the full detail.

     This release is a bug-fix release addressing the issues below.

   New Features
     There are no new features in this release.

   Bug Fixes
     NEM Events for NotifyIcon broken
         Fix NEM events for the NotifyIcon Class (Tracker: 1585293)

     Combobox SetEditSel method
         Fix bug preventing setting the starting index to anything other 
than
         0, and add documentation. (Tracker: 1586617)

     Fix AbsLeft and AbsTop methods
         Fix a bug where AbsLeft and AbsTop were not correctly being
         converted to client co-ordinates for child windows (Tracker:
         1578492)

     Include POD documentation in PPM
         Some time ago it was decided that in order to keep the size of the
         PPM distributions as small as possible we would exclude the POD
         documentation from the PPM files, and only include the HTML
         documentation. From this release both POD and HTML documentation is
         included in the PPM. This fixes a problem with ActiveState Perl PPM
         V4, which re-generates the documentation from the enclosed POD
         documents, apparently ignorig the included HTML documentation.

Deprecated feature status
     This section documents features that have been deprecated in this
     release, or in recent releases, and feature that will be deprecated in
     up-coming releases.

   Win32::GUI::Constants
     The introduction of Win32::GUI::Constants in v1.04 means that we now
     have access to a very large number of constants, so the current
     behaviour of Win32::GUI to export all constants to the calling 
namespace
     by default is no longer appropriate. So, a bare

       use Win32::GUI;

     now generates a warning that the old default behaviour will be
     deprecated - although the export behaviour of Win32::GUI v1.03 is
     maintained except for this warning.

     To eliminate this warning and correct your script, do one of the
     following:

     If you don't need any constants, use the empty list:
           use Win32::GUI();

     If you need some constants, name them explicitly:
           use Win32::GUI qw(ES_WANTRETURN CW_USEDEFAULT); # Two 
constants exported
           use Win32::GUI qw(/^MB_/);   # Export all constants starting 
with MB_

     See the Win32::GUI::Constants documentation for the full allowable
     syntax.

     You are advised to fix your scripts now, as a future version will stop
     exporting any constants by default.

     Although not advised, you can suppress the warnings by turning
     deprecated warnings off:

       no warnings 'deprecated';

     Additionally accessing constants from within the Win32::GUI 
namespace is
     deprecated. I.e.

        -addstyle => Win32::GUI::WS_BORDER,

     will generate a warning with this release, and will stop working with a
     future release. Use one of the following methods instead:

     use the Win32::GUI::Constants namespace instead
           -addstyle => Win32::GUI::Constants::WS_BORDER(),

     use any other namespace you fancy
           use Win32::GUI qw(-exportpkg => A::B -autoload);
           ...
           -addstyle => A::B::WS_BORDER(),

     maintain compatibility of existing scripts
           use Win32::GUI::Constants qw(-exportpkg => Win32::GUI 
:compatibility_win32_gui);
           ...
           -addstyle => Win32::GUI::WS_BORDER,

   Win32::GUI::NotifyIcon
     It is no longer necessary to use the '-id' option to any of the
     Win32::GUI::NotifyIcon methods. The ID is now entirely handled
     internally. You will receive deprecated warnings if you use it.

     In particular, removing Icons from the system tray should be done using

       $NI->Remove();

     and not by the (now deprecated)

       $NI->Delete(-id => 1);

     Use of the "-id" option will generate a warning.

Contributors to this release
     Robert May
     Uwe Kind



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

Date: 5 Nov 2006 11:08:17 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Re: Keep getting error with email validation script
Message-Id: <1162753697.167264.216040@k70g2000cwa.googlegroups.com>


Get Links wrote:
> 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"

I did something like this:
#!/usr/bin/perl
use warnings;

#test value;
my $email = "cdalten\@eecs\.berkeley\.edu";

valid_address($email);

#Yay, the price of nylons at walmart are now $5.07/pair. On top of it,
#they no longer carry the decent thigh highs.
sub valid_address{
    my ($addr) = @_;
    my ($domain, $name, $valid);
    ($name, $domain) = (split/@/,$addr);
    $valid = 0;

#yes I know I should used fork()/exec;
    system("nslookup $domain");
}

$./valid.pl
Note:  nslookup is deprecated and may be removed from future releases.
Consider using the `dig' or `host' programs instead.  Run nslookup with
the `-sil[ent]' option to prevent this message from appearing.
Server:         63.93.96.20
Address:        63.93.96.20#53

Non-authoritative answer:
Name:   eecs.berkeley.edu
Address: 169.229.60.161
Name:   eecs.berkeley.edu
Address: 169.229.60.27



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

Date: 5 Nov 2006 11:24:37 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Re: Keep getting error with email validation script
Message-Id: <1162754677.035195.264230@k70g2000cwa.googlegroups.com>

grocery_stocker wrote:
> Get Links wrote:
> > 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"
>
> I did something like this:
> #!/usr/bin/perl
> use warnings;
>
> #test value;
> my $email = "cdalten\@eecs\.berkeley\.edu";
>
> valid_address($email);
>
> #Yay, the price of nylons at walmart are now $5.07/pair. On top of it,
> #they no longer carry the decent thigh highs.
> sub valid_address{
>     my ($addr) = @_;
>     my ($domain, $name, $valid);
>     ($name, $domain) = (split/@/,$addr);
>     $valid = 0;
>
> #yes I know I should used fork()/exec;
>     system("nslookup $domain");
> }
>
> $./valid.pl
> Note:  nslookup is deprecated and may be removed from future releases.
> Consider using the `dig' or `host' programs instead.  Run nslookup with
> the `-sil[ent]' option to prevent this message from appearing.
> Server:         63.93.96.20
> Address:        63.93.96.20#53
>
> Non-authoritative answer:
> Name:   eecs.berkeley.edu
> Address: 169.229.60.161
> Name:   eecs.berkeley.edu
> Address: 169.229.60.27

This might upset some of the regulars, but I enjoy perl regular
expressions about as much as I enjoy hangovers.

Anyhow, couldn't we then modify the code to something like:
 $valid = system("nslookup $domain");
 return $valid;

Then go like:
my $test = valid_address($email);

if $test is zero, it's valid, otherwise it isn't.

I just ask this because I'm too lazy to read how fork() gets
implemented in Perl. The fact that $test captures the return value of
system() seems to indication the stuff is implemented differently.  I
also figures since the OP is & to invoke the subroutine, we might as
well just continue to screw ourself by using the unsafe system()
function.



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

Date: Sun, 05 Nov 2006 20:41:12 +0100
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: Keep getting error with email validation script
Message-Id: <454e3e4c$0$27366$ba4acef3@news.orange.fr>

Get Links wrote:
> 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)?[

<snip>

You've missed Randal's point, or at least some of it. copy-and-paste is 
not a sensible method of code reuse: use Email::Valid itself to do the 
validation.

 From the docs:

use Email::Valid;
print (Email::Valid->address('maurice@hevanet.com') ? 'yes'  :'no');

It's as simple as that.

Mark


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

Date: Sun, 5 Nov 2006 21:05:19 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Keep getting error with email validation script
Message-Id: <slrneksgvv.k76.hjp-usenet2@yoyo.hjp.at>

On 2006-11-05 19:24, grocery_stocker <cdalten@gmail.com> wrote:
> Anyhow, couldn't we then modify the code to something like:
>  $valid = system("nslookup $domain");
>  return $valid;
>
> Then go like:
> my $test = valid_address($email);

No:

% nslookup hjp.at
Server:         127.0.0.1
Address:        127.0.0.1#53

*** Can't find hjp.at: No answer

However, <hjp-usenet2@hjp.at> is a valid email address. You have to
check both MX and A records (and you would not use nslookup to this,
but the Net::DNS module). If you want to be thorough you can also
try to connect to the SMTP servers of the domain and ask them. There's a
module on CPAN which does this.

> I just ask this because I'm too lazy to read how fork() gets
> implemented in Perl.

What does fork have to do with the validity of email addresses?

	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: Sun, 05 Nov 2006 21:34:52 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Keep getting error with email validation script
Message-Id: <0Os3h.87108$E67.86227@clgrps13>

Get Links wrote:
> 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);
>         }

You can use the Socket module to do DNS lookup:

$ perl -le'
    use Socket;
    my $host = q[link-exchangers.com];
    my $address = inet_aton $host;
    print inet_ntoa $address if $address;
'
216.227.212.185



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: Sun, 05 Nov 2006 14:42:14 -0700
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: Keep getting error with email validation script
Message-Id: <B9ydnXgMdOEyx9PYnZ2dnUVZ_s2dnZ2d@comcast.com>

grocery_stocker wrote:

> This might upset some of the regulars, but I enjoy perl regular
> expressions about as much as I enjoy hangovers.

Then do yourself a big favor and look here:

http://search.cpan.org/~rjbs/Email-Valid-0.176/lib/Email/Valid.pm

This will also handlle your DNS lookup for you, if you ask it to.


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

Date: 5 Nov 2006 14:02:47 -0800
From: "grocery_stocker" <cdalten@gmail.com>
Subject: Re: Keep getting error with email validation script
Message-Id: <1162764167.062873.212140@f16g2000cwb.googlegroups.com>


Peter J. Holzer wrote:
> On 2006-11-05 19:24, grocery_stocker <cdalten@gmail.com> wrote:
> > Anyhow, couldn't we then modify the code to something like:
> >  $valid = system("nslookup $domain");
> >  return $valid;
> >
> > Then go like:
> > my $test = valid_address($email);
>
> No:
>

I was grabbing for air at the time.

> % nslookup hjp.at
> Server:         127.0.0.1
> Address:        127.0.0.1#53
>
> *** Can't find hjp.at: No answer
>
> However, <hjp-usenet2@hjp.at> is a valid email address. You have to
> check both MX and A records (and you would not use nslookup to this,
> but the Net::DNS module). If you want to be thorough you can also
> try to connect to the SMTP servers of the domain and ask them. There's a
> module on CPAN which does this.
>

I was just going with the OP code of using nsloookup.   It seemed like
the cool thing to do at
the time.

> > I just ask this because I'm too lazy to read how fork() gets
> > implemented in Perl.
>
> What does fork have to do with the validity of email addresses?
>

I honestly forgot. Maybe if the email addy gets revoked, would could
say "stick a fork in old email addy because it's been rendered inept".



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

Date: 5 Nov 2006 11:33:02 -0800
From: "Robert Dodier" <robert.dodier@gmail.com>
Subject: Scan forward n lines from specified file offset
Message-Id: <1162755181.996688.27830@f16g2000cwb.googlegroups.com>

Hi,

Given a specified file offset, I want to scan forward n lines, and then
record the current file offset. I'm going to throw away the n lines
that
were read. What is a fast method of reading a number of input lines?
I could read one line at a time and loop n times, but I'm hoping there
is something faster than that.

Thanks for any light you can shed on this problem.

Robert Dodier



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

Date: Sun, 05 Nov 2006 21:46:34 GMT
From: "Mumia W. (reading news)" <paduille.4060.mumia.w@earthlink.net>
Subject: Re: Scan forward n lines from specified file offset
Message-Id: <_Ys3h.2980$0r.2215@newsread1.news.pas.earthlink.net>

On 11/05/2006 01:33 PM, Robert Dodier wrote:
> Hi,
> 
> Given a specified file offset, I want to scan forward n lines, and then
> record the current file offset. I'm going to throw away the n lines
> that
> were read. What is a fast method of reading a number of input lines?
> I could read one line at a time and loop n times, but I'm hoping there
> is something faster than that.
> 
> Thanks for any light you can shed on this problem.
> 
> Robert Dodier
> 

This does not answer your question directly, but you could use Tie::File 
and let issue of seeking through lines be handled internally by that module.


host:~$ perldoc Tie::File


-- 
paduille.4060.mumia.w@earthlink.net



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

Date: 5 Nov 2006 11:44:43 -0800
From: "banker123" <bradbrockman@yahoo.com>
Subject: Re: Sorted Hash and or Array
Message-Id: <1162755883.619216.196050@h48g2000cwc.googlegroups.com>

This works an accomplishes the objective however my code loops
extracting the $box, $job, and $filename, I am not sure how to put
thsese variables into a hash in the format below.  Please help

Also I would like to mantain a seperate hash with the priority, the
priority would be looked up in the hash.

Example Hash:
my %priority=
                    (123456=>2),
                    (999999=>1)

> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my %data = (123456 => { job => '123456N',
>                         file => '110306_123456.bdf',
>                         priority => 2
>                       },
>             999999 => { job => '999999N',
>                         file => '110306_999999.bdf',
>                         priority => 1
>                        }
>             );
>
> for my $box (sort by_priority keys %data) {
>     my @data = ($box, @{ $data{$box} }{qw/job file/});
>     print "@data\n";
> }
>
> sub by_priority {
>     $data{$a}{priority} <=> $data{$b}{priority};> }



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

Date: Sun, 05 Nov 2006 21:06:49 +0100
From: Martijn Lievaart <m@remove.this.part.rtij.nl>
Subject: Re: warnings or -w ?
Message-Id: <pan.2006.11.05.20.06.49.65946@remove.this.part.rtij.nl>

On Sun, 05 Nov 2006 23:55:47 +1100, Sisyphus 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 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.

Even Fedora Core 1 comes with this module (Perl 5.8.3).

M4
-- 
Redundancy is a great way to introduce more single points of failure.



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

Date: Sun, 5 Nov 2006 21:28:23 +0100
From: Yohan N Leder <ynl@nsparks.net>
Subject: Re: warnings or -w ?
Message-Id: <MPG.1fb867d2eeb015fa9898ed@news.tiscali.fr>

In article <slrnekrs94.de7.hjp-usenet2@yoyo.hjp.at>, hjp-usenet2@hjp.at 
says...
> 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
> 

Your right, I've a FC5 box too in the LAN and I'm getting the same 
result :

root@localhost ~]# cat /etc/redhat-release
Fedora Core release 5 (Bordeaux)
[root@localhost ~]# perl -Mwarnings -e 42
Useless use of a constant in void context at -e line 1.
[root@localhost ~]# perldoc -l warnings
/usr/lib/perl5/5.8.8/warnings.pm
[root@localhost ~]# rpm -qf /usr/lib/perl5/5.8.8/warnings.pm
perl-5.8.8-5
[root@localhost ~]#

However, this server was a one in several and it's always possible 
someone (a joker admin) modify something on the others.

Well, I have to check on a simple cgi with -w on a side and use warning 
on another to see if it's at least ok on this FC5 in Perl 5.8.8 and 
warnings.pm presents...


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

Date: Sun, 5 Nov 2006 21:31:03 +0100
From: Yohan N Leder <ynl@nsparks.net>
Subject: Re: warnings or -w ?
Message-Id: <MPG.1fb868734cd725ba9898ee@news.tiscali.fr>

In article <454de076$0$5109$afc38c87@news.optusnet.com.au>, sisyphus1
@nomail.afraid.org says...
> See 'perldoc perllexwarn'.
> I think the short answer is "use warnings, unless the warnings module is not
> available".
> 

OK, noted, thanks !

> 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.

The FC5 comes with Perl 5.8 and I've checked warnings package is 
presents from the Sisyphus's post. So, the problem is elsewhere (why 
does the use warnings seems to fails ; I've to do some checking and will 
be back soon)


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

Date: Sun, 5 Nov 2006 21:48:49 +0100
From: Yohan N Leder <ynl@nsparks.net>
Subject: Re: warnings or -w ?
Message-Id: <MPG.1fb86ca1b80611799898ef@news.tiscali.fr>

In article <slrnekrsmp.dri.tadmc@tadmc30.august.net>, 
tadmc@augustmail.com says...
> Then they likely have a really really old version of perl.
> Lexical warnings (ie. use warnings) have been part of Perl
> for many years.
> 

From the Sisyphus reply in this thread, I've checked on a FC5 server on 
which I've access (not the only one, but a one on which the problem 
occured) and there is Perl 5.8.8... So, the problem comes from something 
else than absence of warnings module.

> "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?

Not necessary to be agressive unless you spent a bad day :)

Well, now, knowing it's close to be sure (based on the FC5 I've in the 
LAN which may be different than others on which I've seen same problem) 
it's not a matter of absence of warnings.pm, I've reduced problem 
through two short cgi scripts :

1) This first one using "-w" works fine (string printed in browser)
#!/usr/bin/perl -w 
use strict; 
print "Content-type: text/html\n\n"; 
print "<HTML>"; 
print "<BODY>"; 
print "<P>Bonjour le monde !</P>"; 
print "</BODY>"; 
print "</HTML>"; 
exit 0; 


2) This second one using warnings module doesn't works (browser empty)
#!/usr/bin/perl 
use strict; 
use warnings; 
print "Content-type: text/html\n\n"; 
print "<HTML>"; 
print "<BODY>"; 
print "<P>Bonjour le monde !</P>"; 
print "</BODY>"; 
print "</HTML>"; 
exit 0;

And the error log of httpd says :
[Sun Nov 05 21:30:25 2006] [error] [client 127.0.0.1] (2)No such file or 
directory: exec of '/var/www/cgi-bin/bonjour.pl' failed, referer: 
http://localhost/
[Sun Nov 05 21:30:25 2006] [error] [client 127.0.0.1] Premature end of 
script headers: bonjour.pl, referer: http://localhost/

Notice that I've ran this test from a browser in the server itself here 
; tomorrow, I'll do it from another station.


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

Date: Sun, 05 Nov 2006 21:35:24 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: warnings or -w ?
Message-Id: <Xns9872A8BAC82DFasu1cornelledu@127.0.0.1>

Yohan N Leder <ynl@nsparks.net> wrote in 
news:MPG.1fb86ca1b80611799898ef@news.tiscali.fr:

> In article <slrnekrsmp.dri.tadmc@tadmc30.august.net>, 
> tadmc@augustmail.com says...
>> Then they likely have a really really old version of perl.
>> Lexical warnings (ie. use warnings) have been part of Perl
>> for many years.
>> 

 ...

>> Please quote the exact text of the message.
>> 
>> Have you seen the Posting Guidelines that are posted here frequently?
> 
> Not necessary to be agressive unless you spent a bad day :)

He wasn't being agressive, just giving good advice.

> 1) This first one using "-w" works fine (string printed in browser)
> #!/usr/bin/perl -w 
> use strict; 

 ...

> 2) This second one using warnings module doesn't works (browser empty)
> #!/usr/bin/perl 
> use strict; 
> use warnings; 

 ...

> And the error log of httpd says :
> [Sun Nov 05 21:30:25 2006] [error] [client 127.0.0.1] (2)No such file
> or  directory: exec of '/var/www/cgi-bin/bonjour.pl' failed, referer: 
> http://localhost/
> [Sun Nov 05 21:30:25 2006] [error] [client 127.0.0.1] Premature end of 
> script headers: bonjour.pl, referer: http://localhost/

I am assuming you are FTP'in these scripts to the FC5 server from a 
Windows computer. In that case, make sure they are transferred in ASCII 
mode.

Your problem very likely has absolutely nothing to do with the warnings 
module, but with the presence of options on the shebang line. For 
example, I am guessing that

#!/usr/bin/perl --

use strict;
use warnings;

# rest of the program

will fix the problem as well.

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://augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html



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

Date: Sun, 5 Nov 2006 22:23:13 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: warnings or -w ?
Message-Id: <slrneksli1.mge.hjp-usenet2@yoyo.hjp.at>

On 2006-11-05 20:48, Yohan N Leder <ynl@nsparks.net> wrote:
> it's not a matter of absence of warnings.pm, I've reduced problem 
> through two short cgi scripts :
>
> 1) This first one using "-w" works fine (string printed in browser)
> #!/usr/bin/perl -w 
> use strict; 
[...]
>
>
> 2) This second one using warnings module doesn't works (browser empty)
> #!/usr/bin/perl 
> use strict; 
> use warnings; 
[...]
>
> And the error log of httpd says :
> [Sun Nov 05 21:30:25 2006] [error] [client 127.0.0.1] (2)No such file or 
> directory: exec of '/var/www/cgi-bin/bonjour.pl' failed, referer: 
> http://localhost/

My crystal ball says you should check your line endings.

	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: 5 Nov 2006 13:47:28 -0800
From: kjhjhjhjadsasda@urbanhabit.com
Subject: www::mechanize and forms
Message-Id: <1162763248.780792.51270@e3g2000cwe.googlegroups.com>

Hi, Im working on using www::mechanize to automatically post to a form
(login) and then scrape the resulting page, see below code. Where does
the resulting page from below get stored?

Thanks



#!/usr/bin/perl
use CGI qw(:cgi-lib :standard);
use WWW::Mechanize;

my $mech = WWW::Mechanize->new();
$url="http://site.com";
$mech->get( $url );
$mech->submit_form(
        form_number => 4,
        fields      => {
            membername    => 'uid',
            password    => 'pass',
        }
);



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

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


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