[11906] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5506 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 28 14:07:23 1999

Date: Wed, 28 Apr 99 11:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 28 Apr 1999     Volume: 8 Number: 5506

Today's topics:
    Re: "learning perl" does not seem to be written well (David Cantrell)
    Re: "learning perl" does not seem to be written well <cassell@mail.cor.epa.gov>
    Re: complaints about debugger (M.J.T. Guy)
    Re: count associate array <cassell@mail.cor.epa.gov>
        embedding perl into bash functions (Eric Smith)
    Re: form2email with file attachment <cassell@mail.cor.epa.gov>
    Re: GIF in web page <hartleh1@westat.com>
        How can I use asynchronous I/O from tty (using SIGIO) b_rosser@yahoo.com
    Re: How do i print something using perl? <cassell@mail.cor.epa.gov>
        How to change the HTTP_REFERER?? Tim@Globalvision.com
    Re: how to setup cgi <kperrier@blkbox.com>
    Re: How to use Net::FTP in perl?? <dimitrio@fantom.com>
    Re: Many hashes with same keys <tonylabb@infonline.net>
    Re: Many hashes with same keys <rick.delaney@home.com>
    Re: Multiline comments in perl <cassell@mail.cor.epa.gov>
    Re: newbie: Replace \n with <br>\n <scott@simsbury.com>
    Re: PERL & Y2K (I R A Aggie)
    Re: PERL & Y2K (Sam Holden)
    Re: PERL & Y2K <cassell@mail.cor.epa.gov>
    Re: Perl Editor... <cassell@mail.cor.epa.gov>
    Re: Perl Weekday Script <hartleh1@westat.com>
        perldoc HELP, Was How to use Net::FTP in perl?? <e.h.bogart@larc.nasa.gov>
    Re: perldoc HELP, Was How to use Net::FTP in perl?? <tim@timbury.com>
    Re: perldoc HELP, Was How to use Net::FTP in perl?? <Tony.Curtis@vcpc.univie.ac.at>
        PerlMagick Question (Garrett Casey)
    Re: Simple one? <Allan@due.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 28 Apr 1999 16:44:38 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <37273a65.189049438@news.insnet.net>

On Wed, 28 Apr 1999 06:58:07 -0600, "bowman" <bowman@montana.com>
enlightened us thusly:

>                                  What the little ORA handbook needs is
>fifty or so blank pages for user notes.

What the handbook needs is not just 50 or so blank pages, but it
should alternate printed/blank/printed/blank/... so my notes are
immediately available next to the reference.

Or - TMTOWTDI - a pad of post-it notes included with every book, so I
can put my notes on them ;-)

[Copying newsgroup posts to me by mail is considered rude]

-- 
David Cantrell, part-time Unix/perl/SQL/java techie
                full-time chef/musician/homebrewer
                http://www.ThePentagon.com/NukeEmUp


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

Date: Wed, 28 Apr 1999 09:48:19 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <37273BD3.1A4C4C9@mail.cor.epa.gov>

bowman wrote:
> 
> David Cassell <cassell@mail.cor.epa.gov> wrote in message
> news:37267167.E811BAB@mail.cor.epa.gov...
> > When I first started tinkering with Perl, I wrote down a lot of the
> > cute idioms that I saw, and sort of used that as a cheat-sheet for
> > a bit.  I wonder what happened to it...
> 
> I definitely see that in my life. What the little ORA handbook needs is
> fifty or so blank pages for user notes. I'm reminded of learning natural
> languages and the little opaque idioms one must master to insure the waiter
> brings a mug of beer and not a bowl of Cream of Octopus soup.

Ah yes.  For fun, try to say "I am full" after eating with a European.
The literal translation is (in several languages) a euphemism for
"I am pregnant."  Oops!  

Breaks the ice at any party!

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 28 Apr 1999 16:54:38 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: complaints about debugger
Message-Id: <7g7ege$t31$1@pegasus.csx.cam.ac.uk>

Peter Brooker  <ra5589@email.sps.mot.com> wrote:
>Consider the simple program below:
>
>#!/usr/local/bin/perl -dw
>$aa = join('',"00",$hash_table);
>print "$aa";
>
>Note that $hash_table is not defined. When I run the program I get
   [snip]
>Name "main::hash_table" used only once: possible typo at test.prl line 2.
   [snip]

>Nothing tells me that $hash_table is undefined.

Why should anything?   "Use of uninitialized value" is a runtime error,
and you haven't executed the statement yet.

Perhaps you are confusing the concepts of "defined" and "declared"?
Perl doesn't require you to declare your variables, unless you
"use strict;" (which you should do).

>If you really want to have some fun, try stepping through the program with the
>"s" command.
>After 100 lines, you finally get the warning

That bug is mended in more recent versions of Perl.


Mike Guy


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

Date: Wed, 28 Apr 1999 10:57:53 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: count associate array
Message-Id: <37274C21.231ED616@mail.cor.epa.gov>

Randal L. Schwartz wrote:
> 
> >>>>> "Jason" == Jason  <robobob@blech.mindwell.com> writes:
> 
> Jason> $count = scalar(keys %hash);
> 
> Useless use of "scalar".

In this, umm, `context', I would call it *explanatory*, rather
than useless.

Although more explanation might have made it unnecessary...

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 28 Apr 1999 16:03:50 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: embedding perl into bash functions
Message-Id: <slrn7iecb5.o9a.eric@plum.fruitcom.com>

Hi

Instead of littering my bin (no pun intended) directory with little
scriplets, I define them as functions in a bashrc file which is then
sourced, loading the function into ram.

I have failed so far to have perl embedded in the functions so that the
perl will accept arguments, I have tries both the perl $ARGV[0] and the bash
$1 etc syntax.

Is there a way?

This works:

forex () {
perl -MNumber::Forex -e '$out=Number::Forex->convert("$1", "$2",\ 
"$3");print $out ."\n"'
}

and this don't accept the args.

testing () {
perl -e 'print "Hello World testing"'
}

TIA
-- 
Eric Smith
<eric@fruitcom.com> 
Tel. 021 236 111


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

Date: Wed, 28 Apr 1999 10:16:44 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: form2email with file attachment
Message-Id: <3727427C.C6A1822B@mail.cor.epa.gov>

Santiago Fainstein wrote:
> 
> Hi, I'm new to this group and also new to perl.

Welcome.  Be sure to read the e-mail from gnat which is coming your 
way.  It is filled with useful Perl tips that any Perl user should
learn about.

> Does anybody know a form2mail script in perl with file attachment
> capability?

There are a *ton* of useful Perl modules which will do all the pieces
for you.  Go to CPAN and look.  CGI.pm handles most of your CGI needs.
There are several mail modules, depending on your system.  And file
attachments to mail are a MIME issue.  The MIME::Lite module should
cover all your requirements there.

>            it can't be soupermail.

Why not?  I've never heard of it, but if it is a working
program, what's wrong with it?

> Thanks a lot!

You're welcome,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Wed, 28 Apr 1999 12:05:52 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: GIF in web page
Message-Id: <372731DF.3AB741E0@westat.com>

I've done this without any actual temporary files being created.  Depending
on what you really want to do in the creation of the GIFs, you can use the
GD module (and possibly the GIFgraph module).  I have in a perl script that
draws an html page:

<img src="TextGif.cgi?x=$x1&y=$y1&text=$TextToPrint" alt="" border="0"
width="$x1" height="$y1">

Then, I have another perl script (TextGif.cgi) that draws a simple $x1 pixel
by $y1 pixel white rectangle with the $TextToPrint in black.  Obviously,
replace TextGif.cgi with whatever you need to generate your GIF and pas the
appropriate parameters to it.  If you need to see what happens in
TextGif.cgi, let me know but install GD.pm first so you'll know what I'm
talking about.

Henry Hartley


Kaare Rasmussen wrote:

> I have a problem that seemed small, but I can't seem to find the elegant
> solution. Does it exist?
>
> I want to make a GIF file and present it in a web page. Both are made
> dynamically. So I imagine I have to create the GIF file with a temporary
> name (eg. $$.gif or so) and make a <IMG SRC="$$.gif". But then I have to
> run a cron job every so often to purge old files.
>
> Does a more elegant solution exist, something that will automatically
> purge the GIF file?



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

Date: Wed, 28 Apr 1999 17:33:42 GMT
From: b_rosser@yahoo.com
Subject: How can I use asynchronous I/O from tty (using SIGIO)
Message-Id: <7g7gpm$g4g$1@nnrp1.dejanews.com>

Hi.  I have a perl script to which I would like to add functionality
whereby it will react to single-keystroke commands - 'q' to quit, etc.
I'm running perl 5.004_04 on HP-UX 10.20.

I'd like to do this by setting the terminal/stdin to work in
asynchronous mode, sending SIGIO signals to the script, which
would catch the signal and take the appropriate action.

I initially experimented with a quick C program, which sets
the process pid to which the signals will be sent with the
FIOSSAIOOWN ioctl() function, and then sets the terminal into
async mode with FIOSSAIOSTAT, as follows:

    if (ioctl (0, FIOSSAIOOWN, &pid) == -1)
        error ("Failed in own");

    if (ioctl (0, FIOSSAIOSTAT, &pid) == -1)
        error ("Failed in iostat");

Everything works beautifully for the C program, but I've run up
against the limits of my perl expertise in trying to port it over
to my perl script.

I'm aware of POSIX::Termios, and use it in the script to get into
non-canonical mode with vmin = vtime = 0 (so single-characters
will fire off a SIGIO).  But my attempt to translate the above
two ioctl() calls as below doesn't work:

    my $FIOSSAIOOWN = 0x80046678;
    my $FIOSSAIOSTAT = 0x8004667a;

    my $pid = POSIX::getpid();
    my $pidpacked = pack ("i", $pid);

    ioctl 0, $FIOSSAIOOWN, $pidpacked  or die "Could not set tty owner\n";
    ioctl 0, $FIOSSAIOSTAT, 1          or die "Could not set async io\n";

I get the die on the first ioctl(), the FIOSSAIOOWN.

There's a couple of things I'm not clear about:

1)  Are they the correct constants for FIO*?  I printed them straight out of
    my test C program.

2)  The ioctl() calls expect as an argument a pointer to an integer.
    perlfunc(1) says that a scalar argument with a string will be passed
    as a pointer to the string, but a scalar with an integer value will
    be passed as that value.  How do I pass a pointer to an integer?

This is the first time I've had to go to the POSIX interface, everything
else I've had to do has had nice perl equivalents.

Many thanks for any help,



Brad Rosser
b_rosser@yahoo.com

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 28 Apr 1999 10:50:30 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How do i print something using perl?
Message-Id: <37274A66.FDA4DC61@mail.cor.epa.gov>

smnayeem@my-dejanews.com wrote:
> 
> In article <3726D0B9.EF843CF@gmx.net>,
>   "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net> wrote:
> > Greg McCann wrote:
> > >
> > > If that doesn't print out a page with the word "test" at the top, you
> > > need to review your assumptions about the printer.
> >
> > It might, for example, be a "pure PostScript" printer. Or some weird
> > WinPrinter with absolutely no DOS support[1]. But we can't tell from
> > here.
> >
> > Cheers,
> > Philip
> i have an HP LaserJ6MP
> do u think theres any way to print the postscript fonts?
> i can only print the normal fonts...

Yes.  Have you read the hardcopy docs that came with the printer?
This is really not a Perl question, but if you want to ask on UseNet
try one of the postscript or printer newsgroups.

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Wed, 28 Apr 1999 16:31:12 GMT
From: Tim@Globalvision.com
Subject: How to change the HTTP_REFERER??
Message-Id: <7g7d4g$cck$1@nnrp1.dejanews.com>

Hi There

 Is it possible to trick the CGI script of a foreign host to think that the
HTTP_REFERER is some thing different than what it really is. I have this
script that links to another script on a different server, but the foreign
script checks the referer and thus refuses to compute the data sent from my
script

      Hope that you can help me


          Tim


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 28 Apr 1999 11:21:23 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: how to setup cgi
Message-Id: <ysiogk8vhq4.fsf@blkbox.com>

mk@best.com (mk) writes:

> Hi everybody,
> 
> Please help me on this matter, I try to run perl script on my system,
> it works with pl files, but when I run cgi, it just displays the
> content of the files, any info will help, tia.

This is not a perl related question.  The is a cgi/server configuration related
question.  Check either:
comp.infosystems.www.authoring.cgi
comp.infosystems.www.servers.*

Kent


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

Date: Wed, 28 Apr 1999 16:09:45 GMT
From: Dimitri Ostapenko <dimitrio@fantom.com>
Subject: Re: How to use Net::FTP in perl??
Message-Id: <3727330E.87DE883@fantom.com>


see working demo/source  @ www.perlnow.com -> ftp

Dimitri



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

Date: Wed, 28 Apr 1999 12:36:32 -0400
From: Tony Labbiento <tonylabb@infonline.net>
Subject: Re: Many hashes with same keys
Message-Id: <37273910.48E54641@infonline.net>

Perl hashes, like most hashes, do not allow duplicate keys. Trying to
create a duplicate key will over write the original. You are allowed to
have duplicate values.

Rob Clark wrote:
> 
> Hello,
> 
> Can anyone tell me whether Perl does any storage optimisation on many hashes
> that share the same set of keys?
> 
> Many thanks
> Rob

-- 
			****************************************
			*    Tony Labbiento                    *
			*    Infinity Online, Inc.             *
			****************************************


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

Date: Wed, 28 Apr 1999 17:31:50 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Many hashes with same keys
Message-Id: <372745A6.60953B3D@home.com>

[posted & mailed]

Rob Clark wrote:
> 
> Can anyone tell me whether Perl does any storage optimisation on many 
> hashes that share the same set of keys?

>From perl5004delta (or perldelta if you're still using 5.004):

    Each unique hash key is only allocated once, no matter how many
    hashes have an entry with that key. So even if you have 100
    copies of the same hash, the hash keys never have to be
    reallocated.

So the answer is yes, as long as you are using 5.004 or greater.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Wed, 28 Apr 1999 10:53:05 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Multiline comments in perl
Message-Id: <37274B01.8993D96B@mail.cor.epa.gov>

Philip 'Yes, that's my address' Newton wrote:
> 
> Jerome O'Neil wrote:
> >
> > David Cassell wrote:
> > >
> > > Jerome O'Neil wrote:
> > > > Ye Gods!  Why has thou forsaken C-style comments?!!!
> > >
> > > It's fine by me.  But then when I write C code, I do it in an
> > > analogous way to my Perl code...
> > >
> > > ############################################################
> > > #  I put stuff in boxes anyway, so readers can see it.     #
> > > ############################################################
> >
> > /************************
> > Ook!
> > *************************/
> 
> /*********************************************************************
>  * some people like it                                               *
>  * other people do it because of some team's "programming standards" *
>  *********************************************************************/

Err, umm, actually that's how I routinely write header comments in SAS.
No programming standards body makes me do it.  I guess that says 
something revealing about me...

:-)
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Wed, 28 Apr 1999 12:50:07 -0700
From: "Scott Oseychik" <scott@simsbury.com>
Subject: Re: newbie: Replace \n with <br>\n
Message-Id: <7g7eh9$7t4@news.dns.microsoft.com>

<snip>

> > > Here's my code so far, but I can't seem to get it to work:
> > >
> > > #!c:\perl\bin -w

> > Am I missing something here, oris c:\perl\bin a good program?

</snip>


On Win32, this is valid...thanks for the feedback.


--Scott




Vincent Vanbiervliet <vvb@ibm.net> wrote in message
news:37270d30@news.uk.ibm.net...
>
> Larry Rosler <lr@hpl.hp.com> wrote in message
> news:MPG.118fcbca99e8f06e989958@nntp.hpl.hp.com...
> > [Posted and a courtesy copy mailed.]
> >
> > In article <7g56tg$fu1@news.dns.microsoft.com> on Tue, 27 Apr 1999
> > 16:27:52 -0700, Scott Oseychik <scott@simsbury.com> says...
> > > I would like to pre-pend every newline character (\n) with <br>, so
the
> > > final result would be:    <br>\n
> >
> > OK, good.  We answer Perl questions even when they deal with HTML.  :-)
> >
> > > Here's my code so far, but I can't seem to get it to work:
> > >
> > > #!c:\perl\bin -w
> >
> > Good.  Next add 'use strict;'
> Am I missing something here, oris c:\perl\bin a good program?
>
>
> >
> > > print ("Type in a file name: ");
> > > chomp($file = <STDIN>);
> > > open(FILEHANDLE,"+<$file") || die "Can't find $file!!\n";
> >
> > Do you really want to open that file with write permission also?
> > Also, include $! in your error message, to see why the open fails.
> >
> > > # for every newline character, replace it with
> > > # <br>, then a newline character
> > >
> > > while (<FILEHANDLE>)
> > > {
> > >     $_ =~ s/\\n/<br>\\n/;
> >
> > '$_ =~' is the default, and looks jarring to an experienced Perl
> > programmer.  Just 's/\n/<br>\n/;' will do fine.
> >
> > > }
> > >
> > > close(FILEHANDLE);
> > >
> > > This script doesn't seem to do anything, but doesn't generate any
> errors,
> > > either.  Sorry if this is a dumb question...
> >
> > It is an easy question.  It isn't a dumb question, because you tried to
> > solve it first before asking.
> >
> > 1.  I hope your code does more than you show, because changing $_ every
> > time through the loop affects nothing after the loop is completed.  You
> > have to do something with the result each time (print it, store it in an
> array,
> > whatever).
> >
> > 2.  Your regex is trying to match the two characters backslash-n.  To
> > match the single character \n (newline), just use \n.   Also in the
> > substitution side.
> >
> > An even shorter way would be:
> >
> >     s/$/<br>/;
> >
> > because '$' matches before the \n at the end of the string.
> >
> > --
> > (Just Another Larry) Rosler
> > Hewlett-Packard Company
> > http://www.hpl.hp.com/personal/Larry_Rosler/
> > lr@hpl.hp.com
>
> Vinc
>
>




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

Date: 28 Apr 1999 15:49:23 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: PERL & Y2K
Message-Id: <slrn7iebl0.k8d.fl_aggie@stat.fsu.edu>

On 28 Apr 1999 15:03:11 GMT, Abigail
<abigail@fnx.com>, in <7g77vf$4f7$3@client2.news.psi.net> wrote:
+ Sam Holden (sholden@pgrad.cs.usyd.edu.au) wrote on MMLXVI September

+ ^^ If you don't know how to read documentation, or even th recent posts that
+ ^^ have Y2K in there subject then you won't be able to fix anything it
+ ^^ find anyway. So what does it matter.

+ I think you're confused. Are you saying there's nothing to be fixed in:

+      printf "The year is 19%d\n", (localtime) [5];

I think Sam is saying that if you don't know what localtime() provides
you, you will be hard pressed to fix the problem. First instinct might
be to "fix" your example like this:

      printf "The year is %d\n", (localtime) [5]; # we don't like 19's

when what you *might* want is:

      printf "The year is %d\n", 1900+(localtime) [5]; 

Someone who hasn't read the documentation would be puzzled. "1900? why
add 1900? isn't that going to be *just* 1900 next year? doesn't localtime
return a 2 digit year? isn't _that_ the root problem in Y2K??"

If you don't know where you're at, its hard to arrive at your desired
destination.

James


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

Date: 28 Apr 1999 16:36:08 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: PERL & Y2K
Message-Id: <slrn7iee7o.4l6.sholden@pgrad.cs.usyd.edu.au>

On 28 Apr 1999 15:03:11 GMT, Abigail <abigail@fnx.com> wrote:
>Sam Holden (sholden@pgrad.cs.usyd.edu.au) wrote on MMLXVI September
>MCMXCIII in <URL:news:slrn7idoke.42r.sholden@pgrad.cs.usyd.edu.au>:
>^^ On Wed, 28 Apr 1999 10:24:58 +0100, David Evans <davevans69@hormail.com> wrote:
>^^ >I'm doing some research into PERL and the Year 2000 and was wondering if
>^^ >anyone knows of an existing product that scans PERL script for Y2K
>^^ >compliance?
>^^ 
>^^ If you don't know how to read documentation, or even th recent posts that
>^^ have Y2K in there subject then you won't be able to fix anything it
>^^ find anyway. So what does it matter.
>
>
>I think you're confused. Are you saying there's nothing to be fixed in:
>
>
>     printf "The year is 19%d\n", (localtime) [5];

Of course there is something to fix in that. I didn't say there wasn't
I said (obviously badly) that since the original poster was too stupid to
read the documnetation that comes with perl on the subject. And too stupid
to do a simple search of the subjects of the days posts to find their answer.
Then even if they do find a magical tool that 'scans PERL script for Y2K
compliane' they are obviously too stupid to fix anything it finds.

Thus why does it matter if such a tool exists, since the poster is 
obviouslt too stupid to use it.

-- 
Sam

You are bordering on ridiculous if you think you need to support your
premises.  Such an argument is an infinite regression.
 	--George Reese in <wv0O1.1521$Ge.4809664@ptah.visi.com>


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

Date: Wed, 28 Apr 1999 10:42:52 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: PERL & Y2K
Message-Id: <3727489C.594C135B@mail.cor.epa.gov>

David Evans wrote:
> 
> I'm doing some research into PERL and the Year 2000 and was wondering if
> anyone knows of an existing product that scans PERL script for Y2K
> compliance?

Perl is Y2K-compliant.  It's a FAQ.  You can read the FAQ and see the
relevant info.

But Perl code is not necessarily Y2K-compliant.  Still, it's so
easy to check that no one has bothered writing immense wads of
code to do so.  You just check to see if someone has used one of
(gmtime, localtime) in the code.  If so, you parse the code
to find what the name of the $year variable is.  Then you check to see
if something stupid was done with $year, like appending 19 in front
of it instead of adding 1900 to it. 

So why try to market that?

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Wed, 28 Apr 1999 10:07:14 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Perl Editor...
Message-Id: <37274042.9D21ECEF@mail.cor.epa.gov>

Darren Bennett wrote:
> 
>     Can anyone suggest a decent NT/95 based Perl editor/debugger?? Also,

Go to www.perl.com and look at the page on editors.  There's a good list
there.  And Perl has its own debugger.  So, for all practical purposes,
you could write your code in WordPad and debug in the command prompt.
Many people do.  Perl doesn't have the dreaded code-compile-link-run-
curse-debug cycle of C/C++ .

> does anyone have any NT Server admin scripts or links to such?? Please
> e-mail me them if you do.

There are a ton of such scripts all over the net.  And there are lots
of such scripts in O'Reilly books, like the octopus book (NT Admin.).

In general, it is considered bad Netiquette to ask for spoon-feeding.
And people expect that if you ask here, you should be willing to get
the answers here.

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Wed, 28 Apr 1999 12:37:35 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: Perl Weekday Script
Message-Id: <3727394F.6A3756D1@westat.com>

I'm not sure if they had five day work weeks in the year 99.  Or did you mean
1899?  1999?  2099?

Henry

Cyberine2k wrote:

> Has anyone had experience writing a script to return relative dates?  I'm
> attempting to write a simple Perl script that when given the arguments:
>
> <specific date>, <offset in days>
>
> it will return the non-Saturday/Sunday date.
>
> For example, given '4/27/99' and an offset of 3, it should return '4/22/99'.
>
> Any ideas appreciated.  I'm writing this for HP/UX OS, but I would expect the
> solution would work on most UNIX platforms.
>
> -cyb



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

Date: Wed, 28 Apr 1999 11:57:27 -0400
From: Ed Bogart <e.h.bogart@larc.nasa.gov>
Subject: perldoc HELP, Was How to use Net::FTP in perl??
Message-Id: <37272FE7.BEA2A0C3@larc.nasa.gov>

Tony Curtis wrote:
> 
> Re: How to use Net::FTP in perl??, steve
> <losteven@yahoo.com> said:
> 
> steve> I need some info on how to use net::FTP??
> steve> Any sample codes or explaination is helpful.
> 
> Almost the very first thing in
> 
>     perldoc Net::FTP
> 
> is an example of its use.
> 
> tony

I have asked this before with no answers so here goes again. I am using
perl version 5.004_04 built for IP19-irix on an SGI 02 and have not been
able to get perldoc to work with any modules. Trying the above, using
all 3 forms from perldoc perldoc, I get;

physio% perldoc Net::FTP
No documentation found for "Net::FTP".
physio% perldoc Net/FTP
No documentation found for "Net/FTP".
physio% perldoc FTP
No documentation found for "FTP".

So what is wrong?

Ed


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

Date: Wed, 28 Apr 1999 12:45:24 -0400
From: "Tim" <tim@timbury.com>
Subject: Re: perldoc HELP, Was How to use Net::FTP in perl??
Message-Id: <925317921.333.58@news.remarQ.com>

This may seem like a silly question, but has the module been installed?
Tim K.


Ed Bogart wrote in message <37272FE7.BEA2A0C3@larc.nasa.gov>...
>Tony Curtis wrote:
>>
>> Re: How to use Net::FTP in perl??, steve
>> <losteven@yahoo.com> said:
>>
>> steve> I need some info on how to use net::FTP??
>> steve> Any sample codes or explaination is helpful.
>>
>> Almost the very first thing in
>>
>>     perldoc Net::FTP
>>
>> is an example of its use.
>>
>> tony
>
>I have asked this before with no answers so here goes again. I am using
>perl version 5.004_04 built for IP19-irix on an SGI 02 and have not been
>able to get perldoc to work with any modules. Trying the above, using
>all 3 forms from perldoc perldoc, I get;
>
>physio% perldoc Net::FTP
>No documentation found for "Net::FTP".
>physio% perldoc Net/FTP
>No documentation found for "Net/FTP".
>physio% perldoc FTP
>No documentation found for "FTP".
>
>So what is wrong?
>
>Ed




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

Date: 28 Apr 1999 19:00:14 +0200
From: Tony Curtis <Tony.Curtis@vcpc.univie.ac.at>
Subject: Re: perldoc HELP, Was How to use Net::FTP in perl??
Message-Id: <83pv4o1y01.fsf@vcpc.univie.ac.at>

Re: perldoc HELP, Was How to use Net::FTP in perl??,
Ed <e.h.bogart@larc.nasa.gov> said:

Ed> I have asked this before with no answers so here
Ed> goes again. I am using perl version 5.004_04
Ed> built for IP19-irix on an SGI 02 and have not
Ed> been able to get perldoc to work with any
Ed> modules. Trying the above, using all 3 forms
Ed> from perldoc perldoc, I get;

Maybe this version of perl was built with no
documentation installed (you can do this during the
configuration with the reply "none" at the
appropriate point)?


tony


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

Date: Tue, 27 Apr 1999 17:46:01 GMT
From: remove_this_prefix_adms1@cts.com (Garrett Casey)
Subject: PerlMagick Question
Message-Id: <3725f7b8.777653626@nntp.cts.com>

PerlMagick Question

I would like to dynamically generate gif files via Perl.  I installed
the GD module but found that the text fonts are VERY limited.  After
visiting the ImageMagick site, I decided to try PerlMagick.

I downloaded ImageMagick-4.2.3 and tried to install it on my FreeBSD
machine.  The computer is NOT running any X Windows system.  I noticed
in the documentation that it is possible to compile ImageMagick
without having X Windows. Also, there is an option to install
PerlMagick during the ImageMagick installation.  

I used:

 ./configure --enable-lzw=yes --with-perl=yes --with-x=no
make
make install

Then I followed with:

make check

The compile and install looked like it went fine.  When I ran "make
check" everything passed except PerlMagick which failed a couple of
tests.

Failed Test  Status Wstat Total Fail  Failed  List of failed 
t/read.t          0   139    44    7  15.91%  38-44
t/write.t         0   139    32    4  12.50%  29-32 

When I went to the test directory I tried to run an individual test.
I tried executing:
perl getattribute.t

I got the error message:
Can't locate Image/Magick.pm in @INC

Yet this was one of the tests that passed.

I created a simple script that just uses Image::Magick and the same
error popped up.  
It seems that an executable was installed at
/usr/local/bin/PerlMagick, but Image::Magick was not installed.

So what I am doing wrong?  How do I get the module Image::Magick
installed and working?

Any help is appreciated

-Garrett Casey


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

Date: Wed, 28 Apr 1999 13:50:02 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: Simple one?
Message-Id: <7g7hoj$h9t$1@nntp3.atl.mindspring.net>

Andy Cantrell wrote in message <37269FC7.E6E36D30@agcs.com>...
:Consider the following:
: $m = "" ;
: foreach $str ("hi", "hi", "bye") {
:    print "A $str\n" if ($str !~ /$m/);
:    print "B $str\n" if ($str !~ /h/);
: };
: If I run this as is, I get the following:
:  A bye
:  B bye
: If I comment out the second print statement (print "B $str\n"),
: rerunning the program will not print anything.  Why do I loose
: the "A bye" output?  I'm guessing there is something left over
: in the regular expression special variables, but I'm not sure
: what.


Although Larry's answer is quite adequate I am going to expand a tad just in
case it is not clear what is happening.

The behavior you describe can sneak up and bite you in a number of ways so
using Larry's solutions are quite advisable.  Perhaps unexpectadly, when the
pattern is the null string perl uses the last successful match (which is
stored in the special var $&).  Consider the following:

#!/usr/bin/perl -w
use strict;
my $temp = 'foo';
print "match\n" if $temp=~/fo/;
#$& is set to fo above

my $m = "" ;
foreach my $str ("hi", "hi", "bye") {
    print "A $str [$&]\n" if ($str !~ /$m/);
};

we get a match in line 4.  Then in the loop, when perl encounters the empty
string in the match, it uses $& which happens to be 'fo' so we print all
three times.  If you comment out line 4 then nothing will be printed as
there is no $&.  In your example (slightly modified),

$m = "" ;
foreach my $str ("hi", "hi", "bye") {
 print "[$&]   \n";
    print "A $str [$&]\n" if ($str !~ /$m/);
    print "B $str [$&]\n" if ($str !~ /h/);
};


the first time through the loop there is no $& so no match for the A line.
On the B line there is a match (therefore no print) and $& becomes h.  In
the next loop, in the A line, $& is h and str is hi so we match and nothing
is printed.  In the B line we again match so $& is again h (but no output).
The last time through $& is h but str is bye so we print on the A and B
lines.  When you remove the B line we never have a match, so no $& and
therefore nothing is ever printed.

Remember, as long as we have had a match somewhere in our script $& will
equal something and any use of the null string in a match will lead you to
head scratching results unless you remember how perl handles the null
string.

:From perlop:  "If the PATTERN evaluates to the empty string, the last
:successfully matched regular expression is used instead."



HTH
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
Numbers are tools, not rules.
 - Ashley-Perry Statistical Axioms[0]




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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5506
**************************************

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