[11321] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4921 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 17 18:07:27 1999

Date: Wed, 17 Feb 99 15:00:25 -0800
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, 17 Feb 1999     Volume: 8 Number: 4921

Today's topics:
    Re: Calculate yesterdays date (Albert W. Dorrington)
    Re: Datetime manipulation in perl (I R A Aggie)
        export perl variables <georgeb@xylan.com>
        Help needed <massacre@freemail.c3.hu>
    Re: Help needed (Alastair)
    Re: Help needed <admin@chatbase.com>
    Re: Help needed <admin@chatbase.com>
    Re: Help,Perl Script doesn't work! <camerond@mail.uca.edu>
    Re: MASS EMAIL (brian d foy)
    Re: MySQL Perl Interface <bosco@ipoline.com>
    Re: panic: leave_scope inconsistancy (James Olsen)
    Re: Parsing <trenic@nortelnetworks.ca>
    Re: Parsing <trenic@nortelnetworks.ca>
        perl compiled code cacheing (Sam Curren)
    Re: Perl email program (Martien Verbruggen)
    Re: PFR: UTC_to_Epoch (Larry Rosler)
    Re: REGEX $1, $2 ... array? <d-edwards@nospam.uchicago.edu>
    Re: Regular Expression Help (Martien Verbruggen)
        Seeking Java classfile parser. <jdf@pobox.com>
    Re: Speed Up Perl (Abigail)
    Re: STDERR of system call in variable? <tchrist@mox.perl.com>
    Re: Subroutines and variables <jglascoe@giss.nasa.gov>
    Re: Web Browser Setup <jason.holland@dial.pipex.com>
    Re: Windoze Dial up networking with PERL backwardsentropy@my-dejanews.com
    Re: y2k problems with perl (Abigail)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 17 Feb 1999 16:04:08 -0500
From: awdorrin@mail.delcoelect.com (Albert W. Dorrington)
Subject: Re: Calculate yesterdays date
Message-Id: <7afas8$8qu@ws051eng.delcoelect.com>


In article <36C1D80E.4893@jpmorgan.com>, "Michael D. Hofer" <mhofer@jpmorgan.com> writes:
:> M.J.T. Guy wrote:
:> > 
:> > Jarkko Hietaniemi  <jhi@alpha.hut.fi> wrote:
:> > >
:> > >Peter Webb <Peter.Webb@cern.ch> writes:
:> > >
:> > >> Is there a quick way of calculating yesterdays date?
:> > >
:> > >localtime(time()-86400)
:> > 
:> > As I keep repeating, that will give wrong answers for two hours each year
:> > (in most places).
:> > 
:> > Mike Guy
:> 
:> Luckily, neither of those hours span a month boundary (at least in the
:> USA), so by comparing the day-of-the-month of both dates you can
:> determine if you are playing with a ST/DT cusp.

Perhaps I'm missing something here, but I don't see how using
'localtime(time()-86400)' will result in a wrong time as Mike
indicated.

Using this method will produce the number of seconds since
Jan 1 1970 GMT and then subtract 86400 from that value. It will then
take the number of seconds that existed '24 hours ago' 
(time()-86400) and use the 'localtime' function to convert
that number of seconds into a human readable date format presented
in the local time zone.

The number of seconds since Jan 1 1970 GMT does not change when 
daylight savings periods are changed, only the representation
of what the number of seconds means is changed.

For example on my Solaris 2.5.1 system the 
/usr/share/lib/zoneinfo/northamerica file states:

Rule  US   1967    max     -    Oct     lastSun 2:00    0       S
Rule  US   1987    max     -    Apr     Sun>=1  2:00    1:00    D

So on a Solaris system (and the HPUX system I checked) the clocks are
changed at 2am, either forward or backward an hour.

In April the time representation is changed from 2:00am to 3:00am and
in October the time representation is changed from 2:00am to 1:00am.

But, the number of seconds stored from Jan 1, 1970 UTC is not
changed at 2:00am. Here is the output of a perl program I wrote.

# Seconds   UTC                  US/Indiana (noDST)   US/Eastern
---------   ------------------   ------------------   ------------------
923201999 - Sun Apr 4 04:59:59 - Sat Apr 3 23:59:59 - Sat Apr 3 23:59:59
923205599 - Sun Apr 4 05:59:59 - Sun Apr 4 00:59:59 - Sun Apr 4 00:59:59
923209199 - Sun Apr 4 06:59:59 - Sun Apr 4 01:59:59 - Sun Apr 4 01:59:59
923212799 - Sun Apr 4 07:59:59 - Sun Apr 4 02:59:59 - Sun Apr 4 03:59:59
923216399 - Sun Apr 4 08:59:59 - Sun Apr 4 03:59:59 - Sun Apr 4 04:59:59
923219999 - Sun Apr 4 09:59:59 - Sun Apr 4 04:59:59 - Sun Apr 4 05:59:59

A quick modification of this program to see what yesterday was:

#ofSeconds  US/Eastern                 today minus 86400 (24 hours)
----------  ------------------------   ------------------------
923201999 - Sat Apr  3 23:59:59 1999 - Fri Apr  2 23:59:59 1999 
923202000 - Sun Apr  4 00:00:00 1999 - Sat Apr  3 00:00:00 1999 
923205599 - Sun Apr  4 00:59:59 1999 - Sat Apr  3 00:59:59 1999 
923205600 - Sun Apr  4 01:00:00 1999 - Sat Apr  3 01:00:00 1999 
923209199 - Sun Apr  4 01:59:59 1999 - Sat Apr  3 01:59:59 1999 
923209200 - Sun Apr  4 03:00:00 1999 - Sat Apr  3 02:00:00 1999 
923212799 - Sun Apr  4 03:59:59 1999 - Sat Apr  3 02:59:59 1999 
923212800 - Sun Apr  4 04:00:00 1999 - Sat Apr  3 03:00:00 1999 
923216399 - Sun Apr  4 04:59:59 1999 - Sat Apr  3 03:59:59 1999 
923216400 - Sun Apr  4 05:00:00 1999 - Sat Apr  3 04:00:00 1999 
923219999 - Sun Apr  4 05:59:59 1999 - Sat Apr  3 04:59:59 1999 
923220000 - Sun Apr  4 06:00:00 1999 - Sat Apr  3 05:00:00 1999 

A test of this for Oct 31st indicates it works correctly as well.

If I am misunderstanding something please straighten me out.

- Al
 



-- 
Al Dorrington                                      
FIRMS & Web Admin, Oracle DBA                     Phone: 765-451-9655 
IC-DELCO CIM, Delphi Delco Electronics Systems    Fax:   765-451-8230 


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

Date: 17 Feb 1999 22:31:24 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Datetime manipulation in perl
Message-Id: <slrn7cmgun.5i5.fl_aggie@enso.coaps.fsu.edu>

On Wed, 17 Feb 1999 20:33:05 GMT, Charles_Long@Dell.com
<Charles_Long@Dell.com> wrote:

+ hi, the 2nd ed blue camel lists Time::Local as containing timelocal() to
+ go from textual string to a time() format i.e. mmddyy to ssssssssss UNIX-like
+ stamp. i have searched Activestate and CPAN for this module to no avail.
+ did they depreciate this? does anyone have such a module. again, to do the
+ opposite of localtime().

Have you tried compiling just the 'use Time::Local;' statement? Hint:
Time::Local is part of the standard distribution, and you *should*
already have it.

James


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

Date: Wed, 17 Feb 1999 22:50:43 GMT
From: George Barrinuevo <georgeb@xylan.com>
Subject: export perl variables
Message-Id: <36CB47C3.DC2039B5@xylan.com>

This is a multi-part message in MIME format.
--------------B438BCA84BD6872A5DC107A3
Content-Type: multipart/alternative; boundary="------------257EEDF1D162831753CE8146"


--------------257EEDF1D162831753CE8146
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello,
  I have a question about perl.  I have a perl script which calls bourne
shell scripts.  I want to export variables from the perl to the bourne
shell scripts without modifying anything in the bourne shell script.  In
bourne the command "export var1 var2 ..." does the job.  However, I am
using a perl script to call a bourne shell script.  Does anyone know how
to do this?

Thanks,

--
George Barrinuevo
Principal Software Engineer
Xylan Corporation       http://www.xylan.com
georgeb@xylan.com       (818)878-4739 ext. 4739



--------------257EEDF1D162831753CE8146
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Hello,
<BR>&nbsp; I&nbsp;have a question about perl.&nbsp; I&nbsp;have a perl
script which calls bourne shell scripts.&nbsp; I want to export variables
from the perl to the bourne shell scripts without modifying anything in
the bourne shell script.&nbsp; In bourne the command "export var1 var2
 ..." does the job.&nbsp; However, I am using a perl script to call a bourne
shell script.&nbsp; Does anyone know how to do this?

<P>Thanks,
<PRE>--&nbsp;
George Barrinuevo
Principal Software Engineer
Xylan Corporation&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A HREF="http://www.xylan.com">http://www.xylan.com</A>
georgeb@xylan.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (818)878-4739 ext. 4739</PRE>
&nbsp;</HTML>

--------------257EEDF1D162831753CE8146--

--------------B438BCA84BD6872A5DC107A3
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for George Barrinuevo
Content-Disposition: attachment; filename="vcard.vcf"

begin:          vcard
fn:             George Barrinuevo
n:              Barrinuevo;George
org:            Xylan Corp.
adr:            26679 West Agoura Road;;;Calabasas;CA;91302;USA
email;internet: georgeb@xylan.com
title:          Principal Software Engineer
tel;work:       (818)878-4739
tel;fax:        (818)880-3505
note:           http://www.xylan.com
x-mozilla-cpt:  ;0
x-mozilla-html: TRUE
version:        2.1
end:            vcard


--------------B438BCA84BD6872A5DC107A3--



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

Date: Wed, 17 Feb 1999 22:30:41 +0100
From: "Massacre" <massacre@freemail.c3.hu>
Subject: Help needed
Message-Id: <7afcj8$c5k$1@bolka.matav.net>

Hi!

I'm using RedHat Linux 5.0 with version 2.0.32 kernel and PERL 5.004.

I've got a problem with the following code (I'm using O'Reilly's Book of
Perl Programming I.):

#!usr/bin/perl
%szavak = qw(
joe  apple
eve juice
);

print("What's Your Name?");
$nev = <STDIN>;
Chomp($nev);

if ($nev = /^randal\b/i)

 Print("Hello, Randall! It's good to see you!\n");
} else

print("hello $nev!\n");  #second problem
$titok = $szavak{$nev};
if ($titok eq "")
  $titok = "donald";
}
etc.

The problem starts here:
if ($nev = /^randal\b/i) {

If I enter the Word `randal` or `Randal` then it have to write out Hello
Randal! It's good to..., but it don't want to. (use of uninitialized value
<STDIN> ...)
Also if I write anything else like "crap" then it just writes out `Hello !`
not `Hello crap!`.

What causes this problem?

P.S.: Please also send the answers also into my mailbox.

Thanks in Advance.

Fatline




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

Date: Wed, 17 Feb 1999 21:51:41 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Help needed
Message-Id: <slrn7cmei0.54.alastair@calliope.demon.co.uk>

Massacre <massacre@freemail.c3.hu> wrote:
>Hi!
>
>I'm using RedHat Linux 5.0 with version 2.0.32 kernel and PERL 5.004.

Your code doesn't even compile. Why not post the _real_ code? It is riddled
with errors.

>I've got a problem with the following code (I'm using O'Reilly's Book of
>Perl Programming I.):
>
>#!usr/bin/perl

I assume you mean '#!/usr/bin/perl -w'?

>%szavak = qw(
>joe  apple
>eve juice
>);
>
>print("What's Your Name?");
>$nev = <STDIN>;
>Chomp($nev);

What's 'Chomp'?

>if ($nev = /^randal\b/i)

Do you _really_ mean '=' here?
Where's the opening brace ('{')?

>
> Print("Hello, Randall! It's good to see you!\n");
What's 'Print'?

>} else

Where's the opening brace ('{')?

>print("hello $nev!\n");  #second problem
>$titok = $szavak{$nev};
>if ($titok eq "")
>  $titok = "donald";
>}
>etc.

Try adding a '-w' and fixing the code. Take a close look at what you're copying.

HTH.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: Wed, 17 Feb 1999 14:24:46 -0800
From: TRG Software <admin@chatbase.com>
Subject: Re: Help needed
Message-Id: <36CB41AE.C5928458@chatbase.com>

Massacre wrote:
> I've got a problem with the following code (I'm using O'Reilly's Book of
> Perl Programming I.):

Did you type it all exactly as the book tells you? Have you considered
on buying "Learning Perl" first?

There's toomany errors here. Firstly, I don't know about your real code
(obviously you say it works), but this one is all wrong. Note that
"print" is NOT "Pring", and "chomp" is NOT "Chomp". There are no Upper
CASE letters there. The path to perl is screwy, and:
 if ($nev = /^randal\b/i)

should be 

 if ($nev =~ /^randal\b/i) {

and:

 } else

Should be:
 } else
       {
or:

 } else {

Whatever you prefer...


Sorry, there's a lot more wrong with the little code you provided. Post
the working code you have.. exactly, and then maybe someone will be able
to help you. Most likely, you simply made a typo, or one of the above
mistakes somewhere else, and that's why it's not working properly for
you. I.e., Watch the CaSe of what you type on everything!
-- 
Regards,
Tim Greer - admin@chatbase.com
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


Copyright ) 1999 TRG Software, Chat Base and The Link Worm.


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

Date: Wed, 17 Feb 1999 14:28:13 -0800
From: TRG Software <admin@chatbase.com>
Subject: Re: Help needed
Message-Id: <36CB427D.DA1207A8@chatbase.com>

Massacre wrote:
> I've got a problem with the following code (I'm using O'Reilly's Book of
> Perl Programming I.):

Did you type it all exactly as the book tells you? Have you considered
on buying "Learning Perl" first?

There's too many errors here. Firstly, I don't know about your real code
(obviously you say it works), but this one is all wrong. Note that
"print" is NOT "Print", and "chomp" is NOT "Chomp". There are no Upper
CASE letters there. The path to perl is screwy, and:
 if ($nev = /^randal\b/i)

should be 

 if ($nev =~ /^randal\b/i) {

and:

 } else

Should be:
 } else
       {
or:

 } else {

Whatever you prefer...


Sorry, there's a lot more wrong with the little code you provided. Post
the working code you have.. exactly, and then maybe someone will be able
to help you. Most likely, you simply made a typo, or one of the above
mistakes somewhere else, and that's why it's not working properly for
you. I.e., Watch the CaSe of what you type on everything!
-- 
Regards,
Tim Greer - admin@chatbase.com
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


Copyright ) 1999 TRG Software, Chat Base and The Link Worm.


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

Date: Wed, 17 Feb 1999 15:23:53 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Help,Perl Script doesn't work!
Message-Id: <36CB3369.72C4C1DA@mail.uca.edu>

Larry Rosler wrote:
> 
> In article <Webmaster-1602992208550001@whaserv.demon.co.uk> on Tue, 16
> Feb 1999 22:08:55 +0000, Simon Roulstone <Webmaster@KILL-MEquorndon-
> mag.org.uk> says...
> > Do I take it `perldoc -f binmode` is a bit of code I should insert into my
> > script somewhere?, like I said I'm very new at all this stuff.
> 
> It is shorthand used in this newsgroup, aiming you at the documentation
> of the Perl function 'binmode'.  As written, it is a command that
> executes on a Unix-based system.

Works on my Win95, Win98, and WinNT systems running either 5.00402 (GS)
or 5.005 (509). At least that's one thing we don't have to grumble about
not having.

Cameron
camerond@mail.uca.edu


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

Date: Wed, 17 Feb 1999 16:31:39 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: MASS EMAIL
Message-Id: <comdog-ya02408000R1702991631390001@news.panix.com>

In article <7af9sj$3oe$1@news0-alterdial.uu.net>, gward@cnri.reston.va.us (Greg Ward) posted:

> open (SENDMAIL, "|/usr/lib/sendmail @addresses") ||
>    die "couldn't open pipe to sendmail: $!\n";

don't ever do that!  that means never! never! never!  sendmail
has a -t switch for a reason!

open (SENDMAIL, "|/usr/lib/sendmail -odq -oi -t") or <error_checking>;

print <<"SENDMAIL";
To: your\@address
From: your\@address
Bcc: $multiple-recipients-addresses

message body
SENDMAIL

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>


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

Date: Wed, 17 Feb 1999 21:06:11 GMT
From: Bosco Tsang <bosco@ipoline.com>
To: slinberg@crocker.com
Subject: Re: MySQL Perl Interface
Message-Id: <7afavs$n47$1@nnrp1.dejanews.com>

As my RedHat 4.2 is a production system, and I cannot upgrade it to 5.2. I
have upgraded gcc to 2.8.1 without error, but have encountered the following
error when I tried to re-make the module,

> cc: dbdimp.o: No such file or directory
> cc: mysql.o: No such file or directory

Both file is under the Mysql directory. Just wonder why it's not found.

Anyone got any fix for this?

Please reply via email if possible.

--
In article <slinberg-1602991548530001@cc11620-a.lwmrn1.pa.home.com>,
  slinberg@crocker.com (Steve Linberg) wrote:
> In article <7aaeur$fq1$1@nnrp1.dejanews.com>, Bosco Tsang
> <bosco@ipoline.com> wrote:
>
> > /usr/lib/crt1.o: In function `_start':
> > /usr/lib/crt1.o(.text+0x57): undefined reference to `main'
> >
> > Anyone got an idea on how to fix this? Or, know where can I obtain a
workable
> > copy of Msql-Mysql-modules-1.2017 for RedHat 4.2?
>
> My first suggestion would be to upgrade to 5.2.  Failing that, you'll
> probably need to update your gcc to 2.7.2.3.  There may be other things
> wrong, but I'd start there.
>
> MySQL and the DBI stuff is a cinch on RH 5.2; I compiled from source and
> everything is going swimmingly.
>

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


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

Date: Wed, 17 Feb 1999 22:07:51 GMT
From: jolsen.ns@multi-ad.ns.com (James Olsen)
Subject: Re: panic: leave_scope inconsistancy
Message-Id: <36ce3da6.33769819@news.supernews.com>

On 3 Dec 1998 09:50:17 GMT, ilya@math.ohio-state.edu (Ilya
Zakharevich) wrote:

>[A complimentary Cc of this posting was sent to Peter Hamilton
><peter@cityc.co.uk>],
>who wrote in article <36657b09.27759546@gateway1>:
>> Occasionally, we get the following errors:
>>  "panic: leave_scope inconsistancy at job_queue.p line 215.":
>>      &read_em;
>> 
>Of the cuff: Do you process signals in these scripts?  Then it may be
>it.  Signals-n-Perl is a dangerous mix.  Though a part of the problem
>would be gone with (I think) 5.004_something, where signals were made
>many times "more secure" (but without removing the core reason).

What exactly about using signals causes this problem? We are using
signals in our perl program which is running under mod_perl, and we
have to listen to signals so Apache can terminate the process if the
web user hits the "stop" button, otherwise we have runaway processes
that don't seem to die.

But, after implementing signals, we're getting 

panic: leave_scope inconsistancy

and

panic: leave_scope inconsistancy (#2)

messages in our Apache error log. Unfortunately, we aren't sure which
line this error is occuring on, let alone what the message actually
means and how we go about fixing our code to behave better.

Any pointers to documentation that discusses this error message and
solutions/work arounds in detail is very greatly appreciated. A search
of the web only seemed to turn up the "perldoc perldiag" man page.

Thank you for your time and advice..

--James
jolsen.ns@multi-ad.ns.com
To send me email, remove both "no-spam" abbreviations.


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

Date: Wed, 17 Feb 1999 15:57:02 -0500
From: Tom Renic <trenic@nortelnetworks.ca>
To: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Parsing
Message-Id: <36CB2D1E.A961DF4@nortelnetworks.ca>

I would like to thank you for your help. The code works!!!!

Once again thanks for your patience - I'm very grateful!

Bart Lateur wrote:

> Tom Renic wrote:
>
> >Thank you both for your help but for some reason it still won't work,
> >the output I get is:
> >
> >Tom Renic~trenic@nortelnetworks.com~123456~Tom Renic~123 Easude Way
> >,Dallas, Texas
> >,1232~Tom Renic~...
> >
> >Rather than:
> >
> >Tom Renic~trenic@nortelnetworks.com~123456~Tom Renic~123 Easude Way,
> >Dallas,
> >Texas, 1232~Tom Renic~...
>
> Probably there's still a CR in there. Kill 'em. Kill'em all.
>
>         tr/\r//d;
>
> But personally, I'd prefer replacing newlines with a space, not wit ha
> comma.
>
>         tr/ \r\n/ /s;
>
> The "s" makes sure there are no two spaces in a row.
>
>         Bart.



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

Date: Wed, 17 Feb 1999 15:57:35 -0500
From: Tom Renic <trenic@nortelnetworks.ca>
Subject: Re: Parsing
Message-Id: <36CB2D3F.BFF188EC@nortelnetworks.ca>

I would like to thank you for your help. The code works!!!!

Once again thanks for your patience - I'm very grateful!

Larry Rosler wrote:

> [Posted and a courtesy copy mailed.]
>
> In article <36CAD625.BFF2AA21@nortelnetworks.ca> on Wed, 17 Feb 1999
> 09:45:57 -0500, Tom Renic <trenic@nortelnetworks.ca> says...
> > Thank you both for your help but for some reason it still won't work,
> > the output I get is:
> >
> > Tom Renic~trenic@nortelnetworks.com~123456~Tom Renic~123 Easude Way
> > ,Dallas, Texas
> > ,1232~Tom Renic~...
> >
> > Rather than:
> >
> > Tom Renic~trenic@nortelnetworks.com~123456~Tom Renic~123 Easude Way,
> > Dallas,
> > Texas, 1232~Tom Renic~...
> >
> > I used the tr code you provided it still didn't work. Any clues?
>
> Can you post the exact code and data that "still won't work"?  A
> few lines that constitute a complete program would be best.  Please cut-
> and-paste them into your response, to avoid gratuitous typos.
>
> I'm sure we can work it out from there.
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Company
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com



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

Date: Wed, 17 Feb 1999 13:10:45 -0800
From: samc@empirewest.com (Sam Curren)
Subject: perl compiled code cacheing
Message-Id: <MPG.1134d022b7424d039896df@news.sonic.net>

It seems to me that if the perl engine would cache compiled code between 
runs, then a script would run faster, eliminating the need to recompile 
each run. I understand about mod_perl, but it seems as though it's a 
solution that avoids the problem.

The engine could just check to see if the file has been recently updated, 
and if so, recompile the script before running it.

This is probably a long-dead horse, but perhaps it deserves some thought.

-Sam


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

Date: Wed, 17 Feb 1999 22:25:15 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Perl email program
Message-Id: <flHy2.91$Up1.635@nswpull.telstra.net>

In article <7adh0b$4ip$1@nnrp1.dejanews.com>,
	julzrulz@my-dejanews.com writes:
> I program perl using UNIX.
> I am looking for a good example of a simple
> email html form that runs on Windows NT.
> I'm not sure of the syntax differences between the
> two operating systems.

There is no syntax difference in HTML for Unix or NT. There is no
syntax difference between perl programs for the different platforms.
There is no syntax difference for CGI.

What you should do is look on dejanews, www.cgi-resources.com, and
other places on the web if you want to find software.

For HTML, the mailto: URL will do what you want.

Martien
-- 
Martien Verbruggen                  | My friend has a baby. I'm writing down
Interactive Media Division          | all the noises the baby makes so later
Commercial Dynamics Pty. Ltd.       | I can ask him what he meant - Steven
NSW, Australia                      | Wright


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

Date: Wed, 17 Feb 1999 12:59:06 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PFR: UTC_to_Epoch
Message-Id: <MPG.1134cd74d19095a8989a53@nntp.hpl.hp.com>

In article <36CB0E65.3E1F9B15@silk.gsfc.nasa.gov> on Wed, 17 Feb 1999 
13:45:57 -0500, Tom McGlynn <tam@silk.gsfc.nasa.gov> says...
 ...
> However since in most applications the existence of leap-seconds do not matter,
> I would not suggest changing the code.  I would simply add an additional
> sentence to the above along the lines of:  
>   "Leap seconds are not handled by this routine (or other Unix time functions)."

I would suggest to Daniel Grisinger that he add this line to the 
description:

    "Leap seconds are not handled by this function or by other Perl 
functions that deal with Unix-epoch time."

We surely have other things to waste bandwidth about.  :-)

How about some thought on the following issues -- raised by Abigail -- 
which affect the implementation and description of various time-related 
functions, including UTC_to_Epoch:

What is the range in Perl of Unix-epoch time?  Is it a 32-bit signed 
integer (in which case the range is ~1902 to ~2038) or unsigned (1970 to 
~2106) or either, relying on the program context to provide the 
semantics?  Or is it really a 31-bit non-negative integer (1970 to 
~2038)?

The HP-UX and MS VC++ C implementations define time_t as a 'long' (hence 
signed), but the ANSI/ISO C Standard requires only that it be 'an 
arithmetic type capable of representing times'.

Standard C includes a function difftime that returns the difference
of two calendar times as a *double*; the HP-UX implementation does
signed floating-point subtraction:  difftime(0x80000001, 0x7FFFFFFF)
is -4294967294, not +2 as for an integer subtraction.

How would a time interval be calculated in Perl, if 32-bit signed or 
unsigned values are permitted?  Waht Perl expression can specify which 
is 'larger' -- 0x80000001 or 0x7fffffff?  In C, one can cast integers to 
floating-point and force floating-point arithmetic.  How does one do 
that in Perl?

I haven't seen a thorough discussion of these questions, but with the 
Y2038 problem coming on us next, it's not too soon to worry!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 17 Feb 1999 22:12:20 GMT
From: Darrin Edwards <d-edwards@nospam.uchicago.edu>
Subject: Re: REGEX $1, $2 ... array?
Message-Id: <tgsoc465ob.fsf@noise.bsd.uchicago.edu>

lr@hpl.hp.com (Larry Rosler) writes:

> You may have been thinking of the white space in the substitution, but 
> that is irrelevant, as it is within a Perl expression; in any case, /x 
> wouldn't affect the substitution part in any way.

D'oh!  Didn't occur to me to try /ge by itself.
So 1) /e is even smarter than I realized, and
   2) I _still_ haven't (need|want)ed to use /x.

Darrin


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

Date: Wed, 17 Feb 1999 22:14:54 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Regular Expression Help
Message-Id: <ybHy2.90$Up1.635@nswpull.telstra.net>

In article <36cb2f2f.0@news.vcss.k12.ca.us>,
	"Dan Kubilos" <dkubilo@oxnardsd.org> writes:
> First,  I have checked the FAQ, the perlre man page, and "Learning Perl"

Thanks for that. However, don't give up on reading them. They really
contain the answers.

> 1.  I want to force a username between 3 and 8 alpha characters
>   I tried  $variable =~ /[a-z]{3,8}?/

You need to anchor your regex to the beginning and the end of the
string.

/^[a-z]{3,8]$/

but, are you really sure you want to limit your users to lowercase
alpha names only? Allowing caps and digits may not be a bad idea. But
that's beside the issue.

> 2.  I want to force full name as First Last with no middle initial

Some people do have names that contain of more than two names. Some
people have names that are only one 'word'. Some people don't
capitalise their names. Examples of all three can be found in the
group of regular posters here.

But, if you want to be tough about it and only allow western style
traditional names:

>   $variable =~ /[A-Z]\D+\s[A-Z]/   matches with Dan C Kubilos  ??

Of course it matches that. It matches the 'Dan C' part. Anchors again,
and you need to try to match the whole thing..

Why the \D? I suppose that you really wanted to match alphas, right?
Do you care about any alpha that falls outside of the [A-Za-z] class?
Probably not, seeing that you match a 'capital' alpha with [A-Z]..

Thus: the simplistic approach, and again, you need to anchor:

/^[A-Z][a-z]+ [A-Z][a-z]+$/

Better character classes can be constructed with a negation of a
character class. It gets more complex though. I don't think I would do
this with a regexp anyway. But then, I wouldn't force any spelling on
people's names.

> 3.  Probably not regex,  but again me the newbie dude is stumped.
> 
> I want to check that group number entered is valid.
> 
> tried  $varible == 30...230     to no avail
> tried   $variable =~ /^[2-3]{1}[0-9]{1,2}/

Do you want to check wether the entered group id is a valid group id,
or do you just want to see if the number you are getting is of a
certain form?

What is a valid group id in your case? Anything between 30 and 230?

if ($num >= 30 and $num <= 230)

Of course, this only checks for a range, and doesn't actually check
for validity against the system. It's probably a good idea to follow
this up with a getgrgid call.

# perldoc -f getgrgid

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | Little girls, like butterflies, need no
Commercial Dynamics Pty. Ltd.       | excuse - Lazarus Long
NSW, Australia                      | 


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

Date: Wed, 17 Feb 1999 16:52:30 -0500
From: "Jonathan Feinberg" <jdf@pobox.com>
Subject: Seeking Java classfile parser.
Message-Id: <7afdm8$jmt$1@news.panix.com>

I'd be grateful for pointers to an existing Perl module that parses Java
class files.

--
jdf@pobox.com




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

Date: 17 Feb 1999 22:06:29 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Speed Up Perl
Message-Id: <7afeh5$5c1$1@client2.news.psi.net>

pvdkamer@inter.NL.net (pvdkamer@inter.NL.net) wrote on MCMXCVI September
MCMXCIII in <URL:news:36caa3c2.10005684@news.wxs.nl>:
\\ Does anyone have a sulution to speed up perl scripts ?

Put a Porche engine in your computer.



Abigail
-- 
perl  -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
          for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
          print chr 0x$& and q
          qq}*excess********}'


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

Date: 17 Feb 1999 07:50:14 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: STDERR of system call in variable?
Message-Id: <36cad726@csnews>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Stefan Etschberger <ste@hl.siemens.de> writes:
:I've got a system call of a UNIX program in a perl script. How do i
:redirect the STDERR output of this program to a perl variable?

You do *not* have a system call; system calls are things from section
2 of the manual, like getpid(), gettimeofday(), etc.  Instead, you're
using the function named system(), which is but one of many ways to run
an external command in Perl.  In particular, system() does *not* capture
any output whatsoever.  For that, you want backticks or a pipe open.

And you didn't read the FAQ.  There's a reason it exists, and 
a reason it comes with every version of Perl.  

NAME
    perlfaq8 - System Interaction 
	($Revision: 1.36 $, $Date: 1999/01/08 05:36:34 $)

DESCRIPTION
    ....

  How can I capture STDERR from an external command?

    There are three basic ways of running external commands:

        system $cmd;                # using system()
        $output = `$cmd`;           # using backticks (``)
        open (PIPE, "cmd |");       # using open()

    With system(), both STDOUT and STDERR will go the same place
    as the script's versions of these, unless the command redirects
    them. Backticks and open() read only the STDOUT of your command.

    With any of these, you can change file descriptors before the call:

        open(STDOUT, ">logfile");
        system("ls");

    or you can use Bourne shell file-descriptor redirection:

        $output = `$cmd 2>some_file`;
        open (PIPE, "cmd 2>some_file |");

    You can also use file-descriptor redirection to make STDERR a duplicate
    of STDOUT:

        $output = `$cmd 2>&1`;
        open (PIPE, "cmd 2>&1 |");

    Note that you *cannot* simply open STDERR to be a dup of STDOUT
    in your Perl program and avoid calling the shell to do the
    redirection. This doesn't work:

        open(STDERR, ">&STDOUT");
        $alloutput = `cmd args`;  # stderr still escapes

    This fails because the open() makes STDERR go to where STDOUT was
    going at the time of the open(). The backticks then make STDOUT
    go to a string, but don't change STDERR (which still goes to the
    old STDOUT).

    Note that you *must* use Bourne shell (sh(1)) redirection
    syntax in backticks, not csh(1)! Details on why Perl's system()
    and backtick and pipe opens all use the Bourne shell are in
    http://www.perl.com/CPAN/doc/FMTEYEWTK/versus/csh.whynot . To capture
    a command's STDERR and STDOUT together:

        $output = `cmd 2>&1`;                       # either with backticks
        $pid = open(PH, "cmd 2>&1 |");              # or with an open pipe
        while (<PH>) { }                            #    plus a read

    To capture a command's STDOUT but discard its STDERR:

        $output = `cmd 2>/dev/null`;                # either with backticks
        $pid = open(PH, "cmd 2>/dev/null |");       # or with an open pipe
        while (<PH>) { }                            #    plus a read

    To capture a command's STDERR but discard its STDOUT:

        $output = `cmd 2>&1 1>/dev/null`;           # either with backticks
        $pid = open(PH, "cmd 2>&1 1>/dev/null |");  # or with an open pipe
        while (<PH>) { }                            #    plus a read

    To exchange a command's STDOUT and STDERR in order to capture the
    STDERR but leave its STDOUT to come out our old STDERR:

        $output = `cmd 3>&1 1>&2 2>&3 3>&-`;        # either with backticks
        $pid = open(PH, "cmd 3>&1 1>&2 2>&3 3>&-|");# or with an open pipe
        while (<PH>) { }                            #    plus a read

    To read both a command's STDOUT and its STDERR separately, it's
    easiest and safest to redirect them separately to files, and then
    read from those files when the program is done:

        system("program args 1>/tmp/program.stdout 2>/tmp/program.stderr");

    Ordering is important in all these examples. That's because the
    shell processes file descriptor redirections in strictly left to
    right order.

        system("prog args 1>tmpfile 2>&1");
        system("prog args 2>&1 1>tmpfile");

    The first command sends both standard out and standard error to the
    temporary file. The second command sends only the old standard output
    there, and the old standard error shows up on the old standard out.

How many times a day do I have to post these answers, answers
which are sitting right there ON YOUR OWN SYSTEM!

--tom
-- 
An Inteligent terminal is not a smart-ass terminal; it is one you can educate.
	     --Rob Pike


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

Date: Wed, 17 Feb 1999 15:57:37 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: cory@techlounge.com
Subject: Re: Subroutines and variables
Message-Id: <36CB2D41.62A4137@giss.nasa.gov>

[cited author, cory, emailed courtesy copy of post]

cory@techlounge.com wrote:
> 
> I have written one subroutine that calls another (see below).
<mega snip>

I don't see any problem.  Let me reduce your code here:

sub main 
{
	$FORM{'action'} = "archive";
	&Refresh($FORM{'action'});
	&Refresh("project");
}

sub Refresh { my($action) = @_; Sort($action); }

sub Sort { my($action) = @_; print "action is now '$action'\n"; }

main();

# The output is:
# action is now 'archive'
# action is now 'project'


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

Date: Wed, 17 Feb 1999 21:42:37 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: Bob Laflamme <rlaflamm@sscinc.com>
Subject: Re: Web Browser Setup
Message-Id: <36CB37CD.140996F6@dial.pipex.com>

Hello Bob,


Bob Laflamme wrote:
> 
> I have some perl scripts which run on NT IIS. When I access the url from
> Internet Explorer 4.x, everything works fine. However, when using Netscape
> or older versions of IE, the user gets prompted with the "Save As" dialog.
> 
> I aruge that the problem is with the web client, others say the server is
> the issue. I don't agree because it works with some clients and jnot others.
> Are there settings in the browser that need to change?
> 

I seem to remember having an intermittent problem like this a while
back. Check to make sure that the scripts ARE returning the correct
Content-type headers. Secondly, check to make sure that the browser is
correctly configured. Ensure that it is not trying to post-process the
data with an external application in some stupid way...


> The url is something like:  /www.myinternet.com/cgi-bin/dosomething.pl
> 
> Thank you in advance,
> 
> bob laflamme
> rlaflamm@sscinc.com


Personally I think the fault probably lies with the client's not be
correctly set up...


Just a couple of ideas, bye!

-- 
sub jasonHolland {
    my %hash = ( website =>
'http://dspace.dial.pipex.com/jason.holland/',
                 email   => 'jason.holland@dial.pipex.com' );
}


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

Date: Wed, 17 Feb 1999 21:59:37 GMT
From: backwardsentropy@my-dejanews.com
Subject: Re: Windoze Dial up networking with PERL
Message-Id: <7afe43$q1h$1@nnrp1.dejanews.com>

In article <36c79cd1.12144733@news.nycap.rr.com>,
  beenz@nycap.rr.com (Joseph Java) wrote:
> On Thu, 04 Feb 1999 08:38:09 +0000, ursa@ici.net wrote:
>
> >Gary Robson wrote:
> >
> >> I have a script (using libnet) for inspecting my pop3 e-mail account and
> >> downloading e-mail with certain subjects for processing.  While Windows
> >> automatically dials up my ISP automatically when the script I can't find
any
> >> way of closing the Dial-up connection afterwards (somthing I need because
> >> the script will be run hourly with a scheduler).  Any help or advice
> >> (especially with a small example, I still a PERL novice) would be greatly
> >> appreciated.
> >>
> >>                                     Cheers
> >>                                             gary@altmedia.freeserve.co.uk

Not sure but if you wrote a .bat file that ran the script and then did echo
com* "+++ATH" where * is the number of the port your modem is on it might
work.  We used to do this to force disconnects when I worked for an ISP
helpdesk.  Also, its been a while so I may not be remembering the commands
right but it did work for us.

Brian Werner
werner@cs.wvu.edu

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


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

Date: 17 Feb 1999 22:17:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: y2k problems with perl
Message-Id: <7aff57$5c1$2@client2.news.psi.net>

Ravindran_Abhilash (Abhilash.Ravindran@compaq.com) wrote on MCMXCV
September MCMXCIII in <URL:news:36C9F037.2175F6FC@compaq.com>:
// Hi,
// 
// 
// Functions gmtime and localtime seems to have problems with year >= 2000.
// For example the time corresponding to year 2000, the year is returned as
// 100 instead of 00.

Oh boy! Years, and years of testing, and noone has found this yet!
My goodness. You mean that all those programs that follow the
documentation and add 1900 to the year are wrong?

// Does anybody have more information on this?

Did you look in the documentation that comes with Perl?




Abigail
-- 
perl -wlne '}for($.){print' file  # Count the number of lines.


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

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

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