[17203] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4615 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 14 11:05:24 2000

Date: Sat, 14 Oct 2000 08:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <971535907-v9-i4615@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 14 Oct 2000     Volume: 9 Number: 4615

Today's topics:
    Re: *hex editing* in perl <tomp@sci.fi>
        [Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
        A variable menage-a-trois? Too Strict! <michael@GeekTimes.com>
    Re: how can I clear all vars at once? (free memory) lalakaka@my-deja.com
        How to install or run Perl <wkohwl@cgi-experts.com>
    Re: How to install or run Perl <barbr-en@online.no>
        mtime to absolute time <pashwawa@hotmail.com>
    Re: mtime to absolute time <MBalenger@att.net>
    Re: Need help converting lots of Unix times <MBalenger@att.net>
    Re: Need help converting lots of Unix times (Mark-Jason Dominus)
        Newbie: Reading a COOKIE ?! <julien@stokkink.com>
        Problem on apache web server <teissier@ismea.imt-mrs.fr>
    Re: question <jeffp@crusoe.net>
    Re: question <stphw@ihug.com.au>
    Re: Regex for matching e-mail addresses (Gwyn Judd)
    Re: Regex for matching e-mail addresses (Randal L. Schwartz)
    Re: Regex for matching e-mail addresses (Gwyn Judd)
    Re: run system command and return before completion <kistler@gmx.net>
        user-defined operators? <eidheim@hivolda.no>
    Re: Why these 2 simple errors? (Gwyn Judd)
    Re: Why these 2 simple errors? (Gwyn Judd)
    Re: Why these 2 simple errors? (Martien Verbruggen)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 14 Oct 2000 14:24:47 +0300
From: tomp at sci fi <tomp@sci.fi>
Subject: Re: *hex editing* in perl
Message-Id: <39E8427F.77876FA8@sci.fi>

All is working fine with pack now, thanks all.

"Håkon Alstadheim" wrote:

> tomp at sci fi <tomp@sci.fi> writes:
>
> > How do I convert the bytes to characters ? :) Or I just didn't get it how to
> > write those properly because now the '0xFF' goes as ascii in the file.
> >
> > Uri Guttman wrote:
> >
> > > perldoc -f seek
> > > perldoc -f sysread
> > > perldoc -f syswrite
> > > perldoc -f open
> > > perldoc opentut
> > > perldoc binmode
> > >
> > > it's all there and not difficult.
> > >
> > > uri
> >
> Add to that:
> perldoc -f unpack
> (or you might get by with perldoc -f ord)
>
> perldoc -f pack
> (or you might get by with perldoc -f chr)
> --
> Håkon Alstadheim, Montreal, Quebec, Canada



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

Date: Sat, 14 Oct 2000 10:21:32 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage971519045.17149@news.teleport.com>

Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 29 Apr 2000

[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last _major_ update of the Perl FAQ was in Summer
of 1998; of course, ongoing updates are made as needed. ]

For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).

    http://www.cpan.org/doc/FAQs/

Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.

For an alternative way to get answers, check out the Perlfaq website.

    http://www.perlfaq.com/

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.

    perldoc perlfaq
    man perlfaq

If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.

If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.

    http://www.cpan.org/
    http://www.perl.com/CPAN/
    http://www.cpan.org/doc/FAQs/FAQ/html/
    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/

You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)

    California     ftp://ftp.cdrom.com/pub/perl/CPAN/
    Texas          ftp://ftp.metronet.com/pub/perl/
    South Africa   ftp://ftp.is.co.za/programming/perl/CPAN/
    Japan          ftp://ftp.dti.ad.jp/pub/lang/CPAN/
    Australia      ftp://cpan.topend.com.au/pub/CPAN/
    Netherlands    ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
    Switzerland    ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
    Chile          ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/

If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.

Have fun with Perl!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/


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

Date: Sat, 14 Oct 2000 07:53:38 -0700
From: Michael Sattler <michael@GeekTimes.com>
Subject: A variable menage-a-trois? Too Strict!
Message-Id: <michael-34BC64.07533814102000@nntp3.tsoft.net>

I would like to share a bunch of variables declarations between three 
CGIs. For example,

== start shared.pm ==
  my $foo = 10 ;  # what I first tried
  1;              # required of all packages                                                               
== end shared.pm ==

In each file I say 

== start foo.pl ==
  use strict ;      # bear Perl's full scrutiny
  use diagnostics ; # scrutiny --> verbose diagnostics
  use FileHandle ;  # use explicit FH creation/usage

  use shared ;      # share declarations/definitions

  print $foo ;
== end foo.pl ==

WHAT IS THE CANONICAL WAY TO SHARE DEFINITIONS AND DECLARATIONS between 
several Perl files, be they .pl, .pm, or .cgi? I've been reading about 
import(), and Exporter, but I have this sneaking suspicion that I've 
missed some vital discussion about writing clean code which just shares 
theory (definitions) and practice (constant declarations) between files?



% perl -w foo.pl
Global symbol "$foo" requires explicit package name at foo.pl line 7 (#1)
    
    (F) You've said "use strict vars", which indicates that all variables
    must either be lexically scoped (using "my"), declared beforehand 
using
    "our", or explicitly qualified to say which package the global 
variable
    is in (using "::").
    
Variable "$bar" is not imported at foo.pl line 8 (#2)
    
    (F) While "use strict" in effect, you referred to a global variable
    that you apparently thought was imported from another module, because
    something else of the same name (usually a subroutine) is exported
    by that module.  It usually means you put the wrong funny character
    on the front of your variable.
    
Global symbol "$bar" requires explicit package name at foo.pl line 8 (#1)
Variable "$xyz" is not imported at foo.pl line 9 (#2)
Global symbol "$xyz" requires explicit package name at foo.pl line 9 (#1)

Execution of foo.pl aborted due to compilation errors (#3)
    
    (F) The final summary message when a Perl compilation fails.
    
Uncaught exception from user code:
        Execution of foo.pl aborted due to compilation errors.

Michael

--
Michael "Mickey" Sattler, Geek Times   <mailto:michael@GeekTimes-NOSPAM.com>
San Francisco, California, USA    <http://www.GeekTimes.com/michael/>


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

Date: Sat, 14 Oct 2000 13:59:54 GMT
From: lalakaka@my-deja.com
Subject: Re: how can I clear all vars at once? (free memory)
Message-Id: <8s9osp$jf3$1@nnrp1.deja.com>

In article <39e78807.5190$372@news.op.net>,
  mjd@plover.com (Mark-Jason Dominus) wrote:
>
> When I saw the original article, I thought about referring the author
to
> varvarname.html, but then I decided it would be overkill.  The author
> doesn't need to see my reasons about what $$name=$value is a bad
> idea; he's already found out the hard way!
>

Well...... I do understand the problems and reasons you describe in
varvarname.html why not to use $$name and I agree with all of them,
but.....

 ...the program in which I use $$name processes files - it reads the
content and converts it to something else... I thought it would be a
very powerful feature to allow perl-commands inside the files, so
someone writing such a file could use all the functions of a complete
programming language. a single line like:

$file=~ s/<perl>(.*?)<\/perl>/$1/eegis;

does the job. Now I have some values coming from other files I want them
to give - this is where I use $$name=$value; so they can just use
$Thing instead of $vars{Thing} - its much easier to understand for
people with lesser programming skills..... Ok, you may say, then they
_have_ to learn hashes, but I don't think thats an elegant solution...

so maybe the question is a different one: is there a better way to
provide the described functionality with the easy use of simple scalar
variables without using global symbolic references?

thanks!

best regards,

christoph bergmann


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sat, 14 Oct 2000 12:03:14 +0100
From: "Miyuki" <wkohwl@cgi-experts.com>
Subject: How to install or run Perl
Message-Id: <39e83d7d@news.jakinternet.co.uk>

I have installed ActivePerl-5.6.0.618-MSWin32-x86-multi-thread in my
computer.  I wrote a first.pl file and tried to run it by double clicking
it.  A MS-dos screen showed up and disappeared in less than a second.  I
could never see what is listed in the MS-Dos screen.  So, I never knew
whether it is running correctly.

Is there anyway I could pause the screen?  Or should I say, have I got the
correct program?  Because from where I first learnt Perl, the way of running
the .pl file is different.  I have to first open the Perl Window, then type
the command "perl first.pl -w".  After that, I'll see the "Hello, world!"
listed below the command.  Unfortunately, this doesn't work in the Perl I
installed in my computer.

Could anyone help me please?




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

Date: Sat, 14 Oct 2000 14:06:34 +0200
From: =?iso-8859-1?Q?K=E5re_Olai_Lindbach?= <barbr-en@online.no>
Subject: Re: How to install or run Perl
Message-Id: <R_XF5.5713$W31.87834@news1.online.no>


"Miyuki" <wkohwl@cgi-experts.com> skrev i melding
news:39e83d7d@news.jakinternet.co.uk...
> I have installed ActivePerl-5.6.0.618-MSWin32-x86-multi-thread in my
> computer.  I wrote a first.pl file and tried to run it by double
clicking
> it.  A MS-dos screen showed up and disappeared in less than a second.
I
> could never see what is listed in the MS-Dos screen.  So, I never knew
> whether it is running correctly.

Appearently your .PL-fileextension is associated to something. Maybe
your perl?

> Is there anyway I could pause the screen?  Or should I say, have I got
the
> correct program?  Because from where I first learnt Perl, the way of
running
> the .pl file is different.  I have to first open the Perl Window, then
type
> the command "perl first.pl -w".  After that, I'll see the "Hello,
world!"
> listed below the command.  Unfortunately, this doesn't work in the
Perl I
> installed in my computer.

So you have tried to open a command-line (CLI) window ("MS-Dos screen")
and it doesn't work when you write (mind the order):

DOS> perl -w first.pl

What error do you receive?

Is your perl in your PATH?
Is the script "first.pl" in your working dir? Or in your PATH?

Useful documentation comes along with ActivState installation.
Either CLI: perldoc xxxxx
Or HTML-docs: Start->Programs->ActivePerl->Documentation.
Look around :-)


Regards Kåre.



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

Date: Sat, 14 Oct 2000 18:40:18 +0800
From: "Kit" <pashwawa@hotmail.com>
Subject: mtime to absolute time
Message-Id: <8s9d6l$oeq2@imsp212.netvigator.com>

I got stuck trying to write some code to convert the $mtime in stat() to
absolute date
(October 14, 2000), can anyone give me a pointer where to look at?

Many thanks.






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

Date: Sat, 14 Oct 2000 13:51:26 GMT
From: "Mike Balenger" <MBalenger@att.net>
Subject: Re: mtime to absolute time
Message-Id: <yxZF5.28646$tl2.1850167@bgtnsc07-news.ops.worldnet.att.net>


Kit <pashwawa@hotmail.com> wrote in message
news:8s9d6l$oeq2@imsp212.netvigator.com...
> I got stuck trying to write some code to convert the $mtime in stat() to
> absolute date
> (October 14, 2000), can anyone give me a pointer where to look at?
>
> Many thanks.

If by "absolute time" you mean GMT, here's the answer.  (Aside:  I live in
such a relative world, it's hard for me to wrap my mind arount the term
"absolute time"...  :-)


$mtime = (stat("filename"))[9];

# In an array context, you get back a list like the C language internal
structure.
@time_struct = gmtime $mtime;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime $mtime;

# Watch out for 0-based indices.  Jan => 0 for $mon

# In a scalar context, you get back a 31 character string like the unix
date(1) command.
$time_string = gmtime $mtime;

# Be careful in a print statement.  Since it wants an arrary context, you'll
have to supply the scalar context yourself.
print  "The file was modified: ", scalar(gmtime($mtime)), "\n";


There's also a localtime function that has the same return values +/- your
offset from the prime meridian.

Here's the Camel book documentation (I love the "The Perl CD Bookshelf"
http://www.oreilly.com/catalog/perlcdbs/ - electronic searching of 6
books -- yeah).  It's my local FAQ.


 Chapter 3
Functions

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

3.2.70 gmtime
gmtime EXPR
This function converts a time as returned by the time function to a
9-element list with the time correct for the Greenwich time zone (aka GMT,
or UTC, or even Zulu in certain cultures, not including the Zulu culture,
oddly enough). Typically used as follows:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
        gmtime(time);
All list elements are numeric, and come straight out of a struct tm (that's
a C programming structure - don't sweat it). In particular this means that
$mon has the range 0..11, $wday has the range 0..6, and the year has had
1,900 subtracted from it. (You can remember which ones are 0-based because
those are the ones you're always using as subscripts into 0-based arrays
containing month and day names.) If EXPR is omitted, it does gmtime(time).
For example, to print the current month in London:

$london_month = (qw(Jan Feb Mar Apr May Jun
        Jul Aug Sep Oct Nov Dec))[(gmtime)[4]];
The Perl library module Time::Local contains a subroutine, timegm(), that
can convert in the opposite direction.

In scalar context, gmtime returns a ctime(3)-like string based on the GMT
time value.





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

Date: Sat, 14 Oct 2000 14:26:51 GMT
From: "Mike Balenger" <MBalenger@att.net>
Subject: Re: Need help converting lots of Unix times
Message-Id: <L2_F5.28665$tl2.1852569@bgtnsc07-news.ops.worldnet.att.net>


> I frequently use something like this:
>
>         perl -pe 's/\d{9}/localtime $&/ge' thefile

I'd change it to match "at least one digit at the beginning of the line.
perl -pe 's/^\d+/localtime $&/ge' thefile

Beware of 9->10 decimal-digit rollover!  It's a Y2K-like problem.  (I've
heard it referred to by some cute name - U9D for Unix-9-digit, perhaps?
Does anyone know?)

Don't inject this subtle bug into your code.  The magic moment is soon
enough that you're likely to be at your current job using this code when it
attacks.  We've been in 9-digits so long (my entire career - heck, more than
my entire adult life) that it's easy to get lulled into thinking that times
are 9-digit numbers.  Period.  Wrong!

A Y2K review of my code revealed that (even though I knew the problem) I too
had coded the 9-digit bug into my code.

You're free, of course, to assume a 32-bit number for representing time.
Primarily because there's no alternative.  Alternatively because it's more
than 2 years away so (almost) nobody's thinking/working on it.  And also
because you'll likely be retired in 38 hears when the 32bit rollover
happens - you can let some young whiper-snappers hack the code that gets you
your pension check, keeps the banks going, powers the electric generators,
and keeps the world safe for democracy (oops, I wax Y2Kish)


    This code:
printf "Last 8-decimal-digit:        %s GMT\n", scalar gmtime(99_999_999);
printf "First 9-decimal-digit:       %s GMT\n", scalar gmtime(100_000_000);
printf "Last 9-decimal-digit:        %s GMT\n", scalar gmtime(999_999_999);
printf "First 10-decimal-digit:      %s GMT\n", scalar
gmtime(1_000_000_000);
printf "Last 32-bit before rollover: %s GMT\n", scalar gmtime(0x7FFF_FFFF);
printf "32-bit rollover to:          %s GMT\n", scalar gmtime(0x7FFF_FFFF +
1);

    Produces this output:
Last 8-decimal-digit:        Sat Mar  3 09:46:39 1973 GMT
First 9-decimal-digit:       Sat Mar  3 09:46:40 1973 GMT
Last 9-decimal-digit:        Sun Sep  9 01:46:39 2001 GMT
First 10-decimal-digit:      Sun Sep  9 01:46:40 2001 GMT
Last 32-bit before rollover: Tue Jan 19 03:14:07 2038 GMT
32-bit rollover to:           GMT

Note that on my PC, the rollover doesn't work.  No negative times allowed.
On a Unix box, it backs up to somewhere in 1901.

Enjoy,
Mike Balenger





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

Date: Sat, 14 Oct 2000 14:48:37 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Need help converting lots of Unix times
Message-Id: <39e87244.724c$bd@news.op.net>
Keywords: Loren, energetic, face, mustang


In article <L2_F5.28665$tl2.1852569@bgtnsc07-news.ops.worldnet.att.net>,
Mike Balenger <MBalenger@att.net> wrote:
>
>> I frequently use something like this:
>>
>>         perl -pe 's/\d{9}/localtime $&/ge' thefile
>
>I'd change it to match "at least one digit at the beginning of the line.
>perl -pe 's/^\d+/localtime $&/ge' thefile

I frequently use that too.  But it wasn't going to work in this case.

>Beware of 9->10 decimal-digit rollover!  

I should have mentioned that, thanks.

>You're free, of course, to assume a 32-bit number for representing time.
>Primarily because there's no alternative. 

That's not true; some unix systems have a 64-bit time_t value.

>Note that on my PC, the rollover doesn't work.  No negative times
>allowed.  On a Unix box, it backs up to somewhere in 1901.

Fri Dec 13 15:45:52 1901


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

Date: Sat, 14 Oct 2000 14:48:16 GMT
From: "Julien Stokkink" <julien@stokkink.com>
Subject: Newbie: Reading a COOKIE ?!
Message-Id: <Qm_F5.791016$Kw2.7373711@flipper>

Hello,

can anyone tell me how to read a cookie ?
This is my code for writing the cookie:
========
    use CGI qw/:standard/;
    use CGI::Cookie;

    $koekje = new CGI::Cookie(-name => 'lovecarrousel',
        -value   => '12345',
        -expires  => '+25m',
        -domain  => '.mydomain.com',
        -path   => '/web/cgi-bin/datingbox'
    );
    print "Set-Cookie: $koekje\n";
========

Writing the cookie works fine, but reading failed !
This is my code for reading the cookie:
========
    use CGI qw/:standard/;
    use CGI::Cookie;

    %cookies = fetch CGI::Cookie;
    $id = $cookies{'lovecarrousel'}->value;

    print $id;
========

I can't figure out what is wrong !
Julien Stokkink





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

Date: Sat, 14 Oct 2000 14:59:20 +0200
From: "Nicolas Teissier" <teissier@ismea.imt-mrs.fr>
Subject: Problem on apache web server
Message-Id: <8s9le7$25sp$1@news4.isdnet.net>

Hello,

I have installer on my computer a web server apache 1.3 on windows98
It works well but It doesn't read my scripts in Perl even if Perl is
installed on my computer
In the error.log, I have :
"2)No such file or directory: couldn't spawn child process:
d:/apache/cgi-bin/formulaire.pl

Could you explain to me?
Thanks






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

Date: Sat, 14 Oct 2000 09:46:36 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: question
Message-Id: <Pine.GSO.4.21.0010140938340.14163-100000@crusoe.crusoe.net>

[posted & mailed]

On Oct 14, Joe Schaefer said:

>You're not shortsighted enough to see that this example is of no more 
>complexity than opening/closing the files in sequence.  I'm sure that 
>in your experience you've needed to keep multiple files open, and read/write 
>to them at a number of different places in your code. I'll even bet you've 
>written a few scripts that required debugging? If not, they I guess I'm 
>never going to get the KISS principle across to you.  

I have had to debug programs.  I have had to print to lots of filehandles
at once, and all... I don't see where the problem comes in, though.

>If we all taught people shortcuts from the very beginning, you'd wind up 
>with little more than spaghetti code after the complexity of a project reached
>a few hundred lines.  Scenario: if you were a project manager that was 
>training new perl programmers, and were responsible for maintaining their 
>code long after they left your employ, I think you'd know that teaching your 
>coders to sprinkle their scripts with perl shortcuts (*especially $_*) is 
>very foolish. People make mistakes, and it's much easier to debug code that 
>reflects the programmers intentions- if there's a problem with $., you'll 
>have quite along day tracking back to which file you read from last.  
>Even worse, you might not know if the program is supposed to be counting lines 
>from that last read file, or from some other file.  And *god forbid* you 
>decide to add another code segment a few months after you've "completely" 
>debugged it, and guess what- that segment opens/reads another file and 
>screws up the count in $. that you previously pristine script relies on. 
>OOPS!

Do you not know that $. returns the number of the line of the most
recently read filehandle?  And I can't exactly visualize how I'd write a
program that depends on $. like you're suggesting.  I use it ONLY for its
purpose of telling me what line I'm on in the current filehandle [1].  I
wouldn't use elmer's glue to keep a poor construction worker's helmet
stuck to a metal beam [2]... 

Oh well.

[1] eh, white lie, when it comes to code obufuscation ;)
[2] you know, the crazy glue commerical...

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





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

Date: Sun, 15 Oct 2000 01:53:00 +1000
From: Neo James Crum <stphw@ihug.com.au>
Subject: Re: question
Message-Id: <39E8815C.12A29901@ihug.com.au>

Joe Schaefer wrote:

> 
> > Which is simpler?  Using $. or making a counter variable for each file,
> > and incrementing it when you need to?
> 
> IMHO, shortcuts like $. are for experienced perl programmers.
> The original poster does not fit that bill. Shortcuts are good things, but
> they should remain shortcuts, not standard coding practice.

On that logic, newbies shouldn't use the print statement either.

Neo.

--
We wouldn't care so much what people thought of us if we knew how seldom
they did.
SJW: http://www.ozemail.com.au/~stphw


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

Date: Sat, 14 Oct 2000 11:39:22 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Regex for matching e-mail addresses
Message-Id: <slrn8ughf5.tds.tjla@thislove.dyndns.org>

I was shocked! How could Jim Kipp <jkipp5@home.com>
say such a terrible thing:
>$a =~ /[\w\-]+\@[\w\-]+\.[\w\-]+/)

Check the FAQ:

perldoc -q 'How do I check a valid mail address?'

I suspect that this is far too lenient, allowing through many invalid
email addresses such as 'i.love.cabbage@some.place.far.away@my.host'. If
you anchored the regex at either end then it fails for being too strict.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Fortune's real live weird band names #100:

Bozo Porno Circus


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

Date: 14 Oct 2000 05:37:22 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Regex for matching e-mail addresses
Message-Id: <m1lmvr8upp.fsf@halfdome.holdit.com>

>>>>> "Gwyn" == Gwyn Judd <tjla@guvfybir.qlaqaf.bet> writes:

Gwyn> I was shocked! How could Jim Kipp <jkipp5@home.com>
Gwyn> say such a terrible thing:
>> $a =~ /[\w\-]+\@[\w\-]+\.[\w\-]+/)

Gwyn> Check the FAQ:

Gwyn> perldoc -q 'How do I check a valid mail address?'

Gwyn> I suspect that this is far too lenient, allowing through many invalid
Gwyn> email addresses such as 'i.love.cabbage@some.place.far.away@my.host'.

But that's a legal email address!  You can't distinguish a syntactically
legal email address from a semantically valid address without actually
sending mail, and even that might not work.

Did you even READ the FAQ that you quoted?

-- 
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: Sat, 14 Oct 2000 13:21:26 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Regex for matching e-mail addresses
Message-Id: <slrn8ugneg.ue5.tjla@thislove.dyndns.org>

I was shocked! How could Randal L. Schwartz <merlyn@stonehenge.com>
say such a terrible thing:
>>>>>> "Gwyn" == Gwyn Judd <tjla@guvfybir.qlaqaf.bet> writes:
>
>Gwyn> I was shocked! How could Jim Kipp <jkipp5@home.com>
>Gwyn> say such a terrible thing:
>>> $a =~ /[\w\-]+\@[\w\-]+\.[\w\-]+/)
>
>Gwyn> Check the FAQ:
>
>Gwyn> perldoc -q 'How do I check a valid mail address?'
>
>Gwyn> I suspect that this is far too lenient, allowing through many invalid
>Gwyn> email addresses such as 'i.love.cabbage@some.place.far.away@my.host'.
>
>But that's a legal email address!  You can't distinguish a syntactically
>legal email address from a semantically valid address without actually
>sending mail, and even that might not work.
>
>Did you even READ the FAQ that you quoted?

I surely did! I then ran it through the ckaddr script mentioned in that
very faq that Tom Christiansen had written and it failed the rfc822
checker. Does that mean that the script is wrong and it is a valid
rfc822 address in which case it should be corrected or removed from the
faq? Is there a better way to check for a syntactically valid email
address?

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
How many QA engineers does it take to screw in a lightbulb?

3: 1 to screw it in and 2 to say "I told you so" when it doesn't work.


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

Date: Sat, 14 Oct 2000 11:55:53 +0200
From: Per Kistler <kistler@gmx.net>
To: Joel Mackay <j.mackay@biochem.usyd.edu.au>
Subject: Re: run system command and return before completion
Message-Id: <39E82DA9.595E59AA@gmx.net>

The CGI script can start another perl script, which does a fork and the
demonizing commands. Then it detaches. The main script could do this
too,
but then it may print the CGI stuff again. So I used a separate script:

use strict;
use POSIX;

my $pid;

close STDIN;
close STDOUT;

$pid =3D fork();

if ( $pid > 0 ){

        # Parent
        exit 0;

} elsif ( $pid =3D=3D 0 ){
        # Child

        POSIX::setsid();  # This detaches it completely

	# Your activity her <<<=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
	# Arguments from @ARGV

        exit 0;

} else {

        # Error
        die "Could not fork: $!";
}

Per.


Joel Mackay wrote:

> `dyana &`
> =E0nd a number of variations thereof, but the browser always waits till=

> the program is finished running before continuing.


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

Date: Sat, 14 Oct 2000 16:39:14 +0200
From: Ole Christian Eidheim <eidheim@hivolda.no>
Subject: user-defined operators?
Message-Id: <39E87011.F5EAB471@hivolda.no>

Is it possible to create user-defined operators in Perl?

Thanks,
oce



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

Date: Sat, 14 Oct 2000 11:27:50 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Why these 2 simple errors?
Message-Id: <slrn8uggph.tds.tjla@thislove.dyndns.org>

I was shocked! How could BUCK NAKED1 <dennis100@webtv.net>
say such a terrible thing:
>#!/usr/local/bin/perl 
>print "Content-type: text/html\n\n";
>use lib 'modules/Archive-Tar-0.22'; 
>use Tar;
>$tar = Tar->new();
>$tar->extract_archive("module.tar.gz",1);
>print "File Has Been Extracted";
>
>Why am I getting these errors?
>1. Compression not available at line 4
>2. Cannot locate object "new" at line 5

Not sure about the second, but do you have Compress::Zlib installed?

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
lagnaf, n.:
	Let's All Get Naked And Fuck!


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

Date: Sat, 14 Oct 2000 11:29:15 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Why these 2 simple errors?
Message-Id: <slrn8uggs7.tds.tjla@thislove.dyndns.org>

I was shocked! How could BUCK NAKED1 <dennis100@webtv.net>
say such a terrible thing:

>That's what I thought, and you're right, Compress::Zlib is not
>installed... BUT the docs say it isn't necessary unless you're using
>compression. I'm extracting, not compressing. 

Same thing, only sdrawkcab.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Personifiers of the world, unite!  You have nothing to lose but Mr. Dignity!
		-- Bernadette Bosky


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

Date: Sun, 15 Oct 2000 00:38:29 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Why these 2 simple errors?
Message-Id: <slrn8ugoel.294.mgjv@martien.heliotrope.home>

On Sat, 14 Oct 2000 02:27:20 -0500 (CDT),
	BUCK NAKED1 <dennis100@webtv.net> wrote:
> 
> >uri@sysarch.com (Uri Guttman) wrote:
> >so you are using the wrong class
> >name which is why new is not found.
> 
> Hmmm... I thought you could just call out the module name to use a
> module in a local directory. When I change use Tar;
> $tar = Tar->new();   to  use Archive::Tar;
> $tar = Archive::Tar->new();   ...then my BEGIN fails, and it doesn't
> find the module.

You should INSTALL the modules, not just unpack the distribution files.

# perldoc perlfaq8
[snip]
How do I install a module from CPAN?
[snip]
How do I keep my own module/library directory?
[snip]
How do I add the directory my program lives in to the
module/library search path?
[snip]

> >and you haven't installed
> >Compress::Zlib which is why it
> >says compression not available.
> 
> That's what I thought, and you're right, Compress::Zlib is not
> installed... BUT the docs say it isn't necessary unless you're using
> compression. I'm extracting, not compressing.

But if you want to extract a compressed tar file, you will either need
Compress::Zlib, or use gzip directly.

> >so rtfm.
> 
> I have... many times, including the section you quoted. Any more ideas?

Euhmm... Read more FM? :)

The Perl FAQ quoted above tells you how to install modules. The
Archive::Tar documentation tells you how to use it. 

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | 
Commercial Dynamics Pty. Ltd.   | What's another word for Thesaurus?
NSW, Australia                  | 


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4615
**************************************


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