[12114] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5714 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 18 14:07:21 1999

Date: Tue, 18 May 99 11:00:27 -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           Tue, 18 May 1999     Volume: 8 Number: 5714

Today's topics:
        "cat"-ing three files into three files. <dhenders@cpsgroup.com>
    Re: *** What is wrong with this? *** (Michel Dalle)
    Re: ->Folkert Meeuw: syntax error at 1.8.pl line 11, ne <emschwar@rmi.net>
    Re: ->Folkert Meeuw: syntax error at 1.8.pl line 11, ne (Michel Dalle)
        ==> Returnig Filehandles from Subroutines <== <Andreas.Fischer@germany.Sun.COM>
    Re: DBI not thread safe. Another way? <darreld@his.com>
        evalling __END__ and <DATA> jed@glug.hip.berkeley.edu
    Re: FAQ 4.15: How do I find yesterday's date? <bill@fccj.org>
    Re: FAQ 4.15: How do I find yesterday's date? <cassell@mail.cor.epa.gov>
    Re: FAQ 4.40: How can I tell whether a list or array co <aqumsieh@matrox.com>
    Re: fetching specific info from a text file <aqumsieh@matrox.com>
    Re: Find all files regardless of extension <dhenders@cpsgroup.com>
        Help: Win32::Registry (Abhijit Sovakar)
        Help: Win32::Registry (Abhijit Sovakar)
    Re: Help: Win32::Registry (Michel Dalle)
        How to access a https site yong321@yahoo.com
        How to move a directory? <jalil@corp.home.net>
    Re: inserting a byte into a file (Tad McClellan)
        Looking for Phonetic Program in Perl (Effie Rover)
    Re: MacPerl (Chris Nandor)
        need help with installing HiRes module <vparekh@panix.com>
        need pid of process initiated with backticks or system  <dlagarde@dnstelecom.fr>
    Re: negative subscripts (Thomas Wade Vaughan)
    Re: negative subscripts <gellyfish@gellyfish.com>
    Re: No classes.zip file found <emschwar@rmi.net>
        Pel Search Engine Needed (Mind Logic)
    Re: Perl and cookie <cassell@mail.cor.epa.gov>
        Perl Training - Naperville/Chicago skrana@my-dejanews.com
        Perl, OLE, and Excel Graphs <jwarner@tivoli.com>
    Re: Please Help:My script runs on win32, it won't run o <cassell@mail.cor.epa.gov>
    Re: Protecting perl source code <dms@rtp-bosch.com>
        Q: System Call <b-camp@students.uiuc.edu>
    Re: Q: System Call ()
    Re: Reg Exp Q! <rafala@loyolanet.campuscwix.net>
        Simple Alienform / Winmail problem <mike@euromortgage.cc>
    Re: sort non-alpha characters (Tad McClellan)
    Re: Telnet Prompt <jay@rgrs.com>
    Re: use array as keys in a hash <aqumsieh@matrox.com>
    Re: Using split with map, then join <jdporter@min.net>
        what's wrong with my head(er)...? <simp@mail.utexas.edu>
    Re: Y2K.  localtime(time) <ebohlman@netcom.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 18 May 1999 10:47:49 -0500
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: "cat"-ing three files into three files.
Message-Id: <87pv3ypefu.fsf@camel.cpsgroup.com>



I'm trying to concatenate three files into three identical output
files.  

This is what I have so far:

    foreach  $fname (@INFILES){
        open (INFILE,"+<$fname") || die "Can't open $fname: $!";
        flock(INFILE,$LOCK_EX ) || die "Can't lock $fname: $!";
        $file.=<INFILE>;
        truncate(INFILE,0);
        close (INFILE);
    }
     # A crash here will cause data loss :(
    
    foreach $fname (@OUTFILES){
        open (OUTFILE,">$fname") || die "Can't open $fname: $!";
        flock(OUTFILE,$LOCK_EX ) || die "Can't lock $fname: $!";
        print OUTFILE $file;
        close (OUTFILE);
    }


The code above has several inperfections. For one it is prone to data
loss. For another if the data are large, it will take up a large
amount of memory.

Any ideas on how I should improve this code?



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

Date: Tue, 18 May 1999 16:19:34 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: *** What is wrong with this? ***
Message-Id: <7hs3ug$adn$1@news.mch.sbs.de>

In article <373D18C4.4A8E@connect.ab.ca>, Tim <bie@connect.ab.ca> wrote:
>Please tell me what the error is that I can not find

Excellent and very clear question. Thanks for giving us all the 
necessary information to help you out :-)

- what does your browser say ?
- what does the error logfile on your webserver say ?
- what does Perl say when you execute this from a command-line ?
- what does the subparseform.lib do that could go wrong ?
- ...

Michel.
P.S.: you also need a <space> between 'Content-type:' and 'text/html'


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

Date: 18 May 1999 10:45:01 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: ->Folkert Meeuw: syntax error at 1.8.pl line 11, near "$freund ("  	Execution of 1.8.pl aborted due to compilation errors.
Message-Id: <xkfu2taiaya.fsf@valdemar.col.hp.com>

Folkert Meeuw <fmee@lfi.uni-hannover.de> writes:
> #!/usr/local/bin/perl -w
> # 1.8 Lists

use strict;

> open (IN, "friends");

  open (IN, "friends") or die "couldn't open friends: $!";

> $frriends = <IN>;

You read one line from the file into $frriends.

> close IN;
> chomp @friends;

You then chomp @friends, which has never been defined.  Why?

> print "Please, type ypur name:\n";
> $name = <STDIN>;
> chop $name;

Use chomp instead of chop.  You did above, so I assume you know why.

> foreach $friend (@friends)

Set $friend to each element of @friends.  Only @friends is empty (since
you never set it), so this loop will never get executed.

> Who knows ?

If you use the "use strict;" line at the top of all your perl programs,
problems like these will not usually be possible.  Also, fix your code so
that -w gives you no warnings at all-- do NOT ignore them, no matter what
anybody tells you.  If it gives warnings with -w, then fix your code.

-=Eric


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

Date: Tue, 18 May 1999 17:15:49 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: ->Folkert Meeuw: syntax error at 1.8.pl line 11, near "$freund (" Execution of 1.8.pl aborted due to compilation errors.
Message-Id: <7hs77v$adn$2@news.mch.sbs.de>

In article <37418857.1D116F53@lfi.uni-hannover.de>, Folkert Meeuw <fmee@lfi.uni-hannover.de> wrote:
>Hi Dear Friendly Readers,
>the next day and the next problem.
>I 've got another problem with perl yet.

I'm afraid you have too many friends, freund :-)

        $friends is not @friends 
and
        $friend is not $friends

Unless some of these were a typo (when translating freund into friend) ?

Michel.


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

Date: Tue, 18 May 1999 18:06:09 +0200
From: Andreas Fischer <Andreas.Fischer@germany.Sun.COM>
Subject: ==> Returnig Filehandles from Subroutines <==
Message-Id: <37418FF1.C55021BA@germany.Sun.COM>

Hello,
does anybody know a solution for the following problem?

*************************************************************

open(F, "/usr/text.txt");

 .....
 .....

if(anything)
{
MakeSomthing(*F);
}

sub MakeSomething
{
local(*G)=@_;
while(<G>)
{
  if(anything)
  {  
  .....
  .....
  }
  else
  {
  return(*G);
  }
}

*************************************************************

I want return the filehandle to main on that point where "MakeSomething"
stops.


Thanks in advance

Andi Fischer


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

Date: Tue, 18 May 1999 13:24:41 -0400
From: "Darrel Davis" <darreld@his.com>
Subject: Re: DBI not thread safe. Another way?
Message-Id: <3741a1e9.0@news4.his.com>

Excellent.  After looking through the Perl Cookbook I was going
to use a separate process and communicate via pipes.  I know
how to create the DBI thread but how would I communicate with
the BDI thread from the other threads?  via a global hash?

-darrel

Dan Sugalski <sugalskd@netserve.ous.edu> wrote in message
news:7hqdhq$3kh$1@news.NERO.NET...
> Darrel Davis <darreld@his.com> wrote:
> : I have been blissfully building a multi-threaded server that connects
> : to a database in thread via DBI , messes with data and  builds return
> : strings and sends tem back to the client.  I read last night that DBI is
>
> : not thread safe and is recommended to NOT open DBI with > 1 thread.
>
> Perl itself isn't thread-safe unless you're very careful. (Which is to
> say, explicitly lock *any* variable that might be accessed by multiple
> threads) However...
>
> What you want here is a thread dedicated to DBI, and funnel all your
> database requests through it. You can do this via a queue--have the DBI
> thread sitting around waiting on the queue,and have your other threads
> send their requests into the queue.
>
> Dan




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

Date: 18 May 1999 09:40:43 -0700
From: jed@glug.hip.berkeley.edu
Subject: evalling __END__ and <DATA>
Message-Id: <m3aev2bab8.fsf@glug.hip.berkeley.edu>


Hi, ho.

I'm trying to slurp some perl code out of another file and run it.  If
I eval this code, it halts at an __END__ without reading any DATA.  For 
example, if I run this script:

	open (FILE,"file");

	while (<FILE>) {
	   $code .= $_;   # this is simplified for the sake of example
	}
	eval $code;

 ...on this file:

	for (<DATA>) { print; }
	__END__
	Hello!

I get nothing.  Can anyone help out?

Many thanks,

Jed



-- 
Jed Parsons                      jed@socrates.berkeley.edu
                    http://www.ocf.berkeley.edu/~jparsons/
----------------------------------------------------------
grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6))))}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));


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

Date: Tue, 18 May 1999 11:37:37 -0400
From: "Bill Jones" <bill@fccj.org>
Subject: Re: FAQ 4.15: How do I find yesterday's date?
Message-Id: <3741890e.0@usenet.fccj.cc.fl.us>


----------  Just be more argumentative...


In article <7hqlr2$8dd$1@news.NERO.NET>, stanley@skyking.OCE.ORST.EDU (John
Stanley) wrote:


> In article <3740b51f.0@usenet.fccj.cc.fl.us>, Bill Jones <bill@fccj.org>
wrote:
>>In article <7hq60v$s59$1@news.NERO.NET>, stanley@skyking.OCE.ORST.EDU (John
>>Stanley) wrote:
>>> Except that 24*60*60 isn't always "one day", and thus can give the wrong
>>
>>I am too lazy to look at DejaNews again...
>
> I hope you never tell someone that THEY should go look in DejaNews for
> an answer to something they ask here in this group.

I frequently tell people what they should do :]
(Why should that ability be unique to anyone in this group?)

-Sneex-  :]
______________________________________________________________________
Bill Jones  Data Security Specialist  http://www.fccj.org/cgi/mail?dss
  http://certserver.pgp.com:11371/pks/lookup?op=get&search=0x37EFC00F
  http://www.networksolutions.com/cgi-bin/whois/whois?BJ1936

         Jacksonville Perl Mongers
         http://jacksonville.pm.org
         jax@jacksonville.pm.org


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

Date: Tue, 18 May 1999 10:07:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: FAQ 4.15: How do I find yesterday's date?
Message-Id: <37419E6B.5CCB4149@mail.cor.epa.gov>

Jim The Perl Guy wrote:
> 
> WHAT??????
> 
> No matter what day of the week, month, year, decade or century, there are
> only 86,400 seconds unless it's a daylight savings switch.
                                    ^^^^^^^^^^^^^^^^^^^^^^^
Exactly.  And that comes to 2 hours total in most locales, as
mentioned.

>                                                          In that case,
> you'll have to write a rather large sub to recognize those dates. Doable but

No, you only have to write a rather *small* sub to recognize those
dates, because of the $isdst element in (local|gm)time.  And it's
already been done, so neither of us needs to repeat the process.
Boy, am I a lazy sod...

> it only makes a difference twice a year. Is it that much of a difference?

Not for any code I'm writing *today*...  But what happens to
your program that has to simulate cron?  Or your meeting
scheduler?  "Urr, sorry boss, how was I supposed to know the
CEO would schedule a meeting the day after the switch to DST?"

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 18 May 1999 11:08:04 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: FAQ 4.40: How can I tell whether a list or array contains a certain element?
Message-Id: <x3y1zgewh4c.fsf@tigre.matrox.com>


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

> In article <373f009a@cs.colorado.edu> on 16 May 1999 11:30:02 -0700, Tom 
> Christiansen <perlfaq-suggestions@perl.com> says...
> ...
> > 
> >         @primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31);
> >         undef @is_tiny_prime;
> >         for (@primes) { $is_tiny_prime[$_] = 1; }
> 
> How boring.  :-)  Why not write this one as:
> 
>           @istiny_prime[@primes] = (1) x @primes;
> 
> Give 'slices' a chance!

In my opinion, examples in the FAQs/docs shouldn't be too
complicated. In fact, I think they should be as simple and clear as
possible to convey the main point, not any clever coding
trick. Array/Hash slices are a beautiful thing, but they confuse a lot
of beginners at first sight.

On the other hand, some people would be delighted to learn some new
coding styles/constructs/tricks just by browsing the online docs. So,
I suggest to include examples to please all tastes. If there is a
space limitation (??), then the simpler/clearer examples should be
given priority.

My two cents,
Ala



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

Date: Tue, 18 May 1999 11:40:23 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: fetching specific info from a text file
Message-Id: <x3yyaimv120.fsf@tigre.matrox.com>


"Brian Altman" <ba@iamd.com> writes:

> Right now I am wondering if it is possible to 'get' specific data from an
> existing file (any text based file), and write it to a new file.

Just open() it and read what you want.
Checkout the documentation for open() in perlfunc.



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

Date: 18 May 1999 11:52:54 -0500
From: Dale Henderson <dhenders@cpsgroup.com>
Subject: Re: Find all files regardless of extension
Message-Id: <87ogjipbfd.fsf@camel.cpsgroup.com>

>>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:

    Larry> The 'or something :-)' meant 'or any other method that
    Larry> works in your environment to distinguish a PoB system from
    Larry> a Unix system'.  In my production code, I actually use this
    Larry> heuristic:

    Larry>       my $PoB = !$ENV{TZ};

    Larry> because my empirical observation is that $ENV{TZ} is set by
    Larry> default in Unix but not in DOS/Windows.  I don't try to
    Larry> parse $^O because that variable isn't available in the perl
    Larry> 5.002 that I have to use on some of the (internal HP
    Larry> <blush>) webservers.

     Not all Unixes set the TZ variable. I believe TZ is set only on
     the more AT&T-ish breeds. Linux for one doesn't set the TZ
     variable. 

     


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

Date: Tue, 18 May 1999 18:47:12 +0200
From: 0241968890-0001@t-online.de (Abhijit Sovakar)
Subject: Help: Win32::Registry
Message-Id: <37419990.D7B497E5@yahoo.com>

Hi,

I'm a Perl novice, just started a few hours ago. I guess, I have a very
simple problem. I just want to read out a value from the registry using
the QueryValue() function of the key-object.
The key exists, the value exists, but the function does not return the
value.

What I did:

  use Win32::Registry;
  $key = "SOFTWARE\\TEST";
  $name = "TestValue"

  $main::HKEY_LOCAL_MACHINE->Open($key, $CurrVer) || die   "Open: $!";

  $CurrVer->QueryValue($name, $value);

I tried also

  $CurrVer->QueryValue($name, \$value);

It doesn't matter what I do, $value is always undefined. What am I doing
wrong?

Thanks,

Abi





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

Date: Tue, 18 May 1999 18:55:16 +0200
From: 0241968890-0001@t-online.de (Abhijit Sovakar)
Subject: Help: Win32::Registry
Message-Id: <37419B74.3991598B@yahoo.com>

This is a multi-part message in MIME format.
--------------834C3A5A125A1DE65C69CBFE
Content-Type: multipart/alternative;
 boundary="------------3D9B7EE4C17E7EE51205B3CC"


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

Hi again,

Sorry to fill up the message stack. Somehow a wrong email address got
into the mesage header. My email is a_sovakar@yahoo.com.

Hi,

I'm a Perl novice, just started a few hours ago. I guess, I have a very
simple problem. I just want to read out a value from the registry using
the QueryValue() function of the key-object.
The key exists, the value exists, but the function does not return the
value.

What I did:

  use Win32::Registry;
  $key = "SOFTWARE\\TEST";
  $name = "TestValue"

  $main::HKEY_LOCAL_MACHINE->Open($key, $CurrVer) || die   "Open: $!";

  $CurrVer->QueryValue($name, $value);

I tried also

  $CurrVer->QueryValue($name, \$value);

It doesn't matter what I do, $value is always undefined. What am I doing

wrong?

Thanks,

Abi



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

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi again,
<p>Sorry to fill up the message stack. Somehow a wrong email address got
into the mesage header. My email is <b>a_sovakar@yahoo.com</b>.
<p>Hi,
<p>I'm a Perl novice, just started a few hours ago. I guess, I have a very
<br>simple problem. I just want to read out a value from the registry using
<br>the QueryValue() function of the key-object.
<br>The key exists, the value exists, but the function does not return
the
<br>value.
<p>What I did:
<p>&nbsp; use Win32::Registry;
<br>&nbsp; $key = "SOFTWARE\\TEST";
<br>&nbsp; $name = "TestValue"
<p>&nbsp; $main::HKEY_LOCAL_MACHINE->Open($key, $CurrVer) || die&nbsp;&nbsp;
"Open: $!";
<p>&nbsp; $CurrVer->QueryValue($name, $value);
<p>I tried also
<p>&nbsp; $CurrVer->QueryValue($name, \$value);
<p>It doesn't matter what I do, $value is always undefined. What am I doing
<br>wrong?
<p>Thanks,
<p>Abi
<br>&nbsp;
<br>&nbsp;</html>

--------------3D9B7EE4C17E7EE51205B3CC--

--------------834C3A5A125A1DE65C69CBFE
Content-Type: text/x-vcard; charset=us-ascii;
 name="a_sovakar.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Abhijit Sovakar
Content-Disposition: attachment;
 filename="a_sovakar.vcf"

begin:vcard 
n:Sovakar;Abhijit
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:a_sovakar@yahoo.com
end:vcard

--------------834C3A5A125A1DE65C69CBFE--



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

Date: Tue, 18 May 1999 17:53:59 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Help: Win32::Registry
Message-Id: <7hs9fh$dl8$1@news.mch.sbs.de>

In article <37419990.D7B497E5@yahoo.com>, 0241968890-0001@t-online.de (Abhijit Sovakar) wrote:
>Hi,
>
>I'm a Perl novice, just started a few hours ago. I guess, I have a very
>simple problem. I just want to read out a value from the registry using
>the QueryValue() function of the key-object.
>The key exists, the value exists, but the function does not return the
>value.
>
>What I did:
>
>  use Win32::Registry;
>  $key = "SOFTWARE\\TEST";
>  $name = "TestValue"
You seem to be missing a ; after this line (but then Perl should have
told you that when you try to execute this, no ?).

F:\Perl>perl -w testreg
Scalar found where operator expected at testreg line 5, at end of line
        (Missing semicolon on previous line?)
syntax error at testreg line 5, near "$main::HKEY_LOCAL_MACHINE"
Execution of testreg aborted due to compilation errors.

>  $main::HKEY_LOCAL_MACHINE->Open($key, $CurrVer) || die   "Open: $!";
>
>  $CurrVer->QueryValue($name, $value);
Good

>I tried also
>
>  $CurrVer->QueryValue($name, \$value);
Bad

Otherwise, it should work as advertised :-)

Michel.


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

Date: Tue, 18 May 1999 16:40:30 GMT
From: yong321@yahoo.com
Subject: How to access a https site
Message-Id: <7hs55u$f76$1@nnrp1.deja.com>

I want to write a simple Perl script to access a Web page using Secure
Socket Layer. But lwp-request doesn't support https. All I want is to
go to https://ourserver/ and send a username/password to see if our
database is down again. I want to run it every midnight for this check
until I find the real problem with our database.

Can anyone tell me how to access a SSL web page? Thanks.

Yong
Email:yong321@yahoo.com


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 18 May 1999 17:49:06 GMT
From: "Jalil Feghhi" <jalil@corp.home.net>
Subject: How to move a directory?
Message-Id: <927049746.368521@zeppelin.svr.home.net>

Is there a function for moving directories in Perl?

Thanks,

-Jalil





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

Date: Tue, 18 May 1999 07:40:56 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: inserting a byte into a file
Message-Id: <8kjrh7.pt9.ln@magna.metronet.com>

Stephen Warren (swarren@www.wwwdotorg.org) wrote:
: Alexandre Kuhn <akuhn@iphysiolsg1.unil.ch> wrote in message
: news:374141CD.5373664B@iphysiolsg1.unil.ch...

: > Does a command exist with which I would be able to easily insert
: > something in my file?

: Not that I'm aware of, but it would only take maybe 10-20 lines of Perl,
: depending on exactly how you determine where/what to insert and whether you
: want locking etc. etc.


   If you can use the diamond input operator instead of a named
   filehandle, then the -i command line switch can do that
   for you.

   Read all about it in your friendly neighborhood perlvar.pod.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 18 May 1999 17:09:49 GMT
From: null@effierover.com (Effie Rover)
Subject: Looking for Phonetic Program in Perl
Message-Id: <37419d75.260741252@news.iinc.com>


I'm looking for a Perl program that will take English (American) and
break the words down into syllables, then convert the syllables to a
phonic equivalent. Eventually, what I want this program to do is
create rebuses (the picture puzzles you played when you were a kid
where a picture of a steak followed by "-s" equals the word 'take').
To make it flexible, I'd rather base the pictures on phonetic lookups
rather than have a large word database.

I'll program the bugger myself if I need to, but not being a great
linguistic expert, I was hoping that a basic set of tools would
already exist.

Can anyone point me in the direction of this or a similar animal that
I might modify?

TIA ... Loy

Loy Ellen Gross AKA Effie Rover
The email address above goes straight to /dev/null :-)
effie -at- effierover -dot- com * http://www.effierover.com
Effie Rover's Fantasy Role Playing Gamer's Library
---------------------------------------------------------------
Protect privacy, boycott Intel: http://www.bigbrotherinside.org
---------------------------------------------------------------


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

Date: Tue, 18 May 1999 16:53:15 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: MacPerl
Message-Id: <pudge-1805991253170001@192.168.0.77>

In article <1dry4sj.hl3ald1j7ippmN@[192.168.0.1]>, kpreid@ibm.net (Kevin
Reid) wrote:

# Chris Nandor <pudge@pobox.com> wrote:
# 
# > Its biggest problem, though, is that the GUI modules are still kinda buggy
# > in some ways.  I would much rather do a GUI in MacPerl than C, if it were
# > more stable.
# 
# My experience is that the GUI modules are stable if your code is
# well-written (checks for errors and handles them, disposes of memory,
# etc.).

You've done more than me with it, so I'll defer to you.  Most of my
experience with it, actually, is from 5.1.9r4, and there were a bunch of
fixes for 5.2.0r4 (mostly from you and Alan Fry).  I still find some
gremlins here and there, but I confess I find it to be more stable now. 
Here and I thought it was because I had learned how to code around the
bugs!  :)

Anyway, one of the big problems I had when working on the book, mostly
with 5.1.9r4, is that if you do make a mistake, you could crash hard and
often.  I still get some hard crashes when I do something "bad" in other
toolbox modules, too.  I suppose this is just part of Mac programming,
though.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 18 May 1999 16:37:10 GMT
From: Vic Parekh <vparekh@panix.com>
Subject: need help with installing HiRes module
Message-Id: <7hs4vm$ng7$1@news.panix.com>

(this is on a Linux system)

Here is the sequence that I go through:

1)
perl Makefile.PL INSTALLDIRS=site \                            
INSTALLSITELIB=/home/venture1/libwww/lib \                            
INSTALLSITEARCH=/home/venture1/libwww/lib/arch

2)
edit the makefile , meaning:

 Change:
 
 XSUBPPARGS = -nolinenumbers -typemap $(XSUBPPDIR)/typemap
 
 To:
 
 XSUBPPARGS = -typemap $(XSUBPPDIR)/typemap

3)
make
(this runs fine)

4)
make test
(this runs fine)

5)
make install
(here is what I get:

gold:~/libwww/Time-HiRes-01.20$ make install
Warning: You do not have permissions to install into
/usr/lib/perl5/man/man3 at
/usr/lib/perl5/ExtUtils/Install.pm line 57.
Installing /home/venture1/libwww/lib/arch/./auto/Time/HiRes/HiRes.so
Installing /home/venture1/libwww/lib/arch/./auto/Time/HiRes/HiRes.bs
Installing /home/venture1/libwww/lib/./Time/testtime.pl
Installing /home/venture1/libwww/lib/./Time/HiRes.pm
Installing /usr/lib/perl5/man/man3/./Time::HiRes.3
Writing /home/venture1/libwww/lib/arch/auto/Time/HiRes/.packlist
/bin/sh: /usr/lib/perl5/i686-linux/5.00401/perllocal.pod: Permission
denied
make: *** [doc_site_install] Error 1
gold:~/libwww/Time-HiRes-01.20$

6)
in any case, I have a directory tree created under lib, like

/home/venture1/libwww/lib

7)
I go into my script and try the following to be included as lib:

use lib '/home/venture1/libwww/lib/perl/lib',
'/home/venture1/libwww/lib/perl/arch',
'/home/venture1/libwww/lib/arch';

8)
When I execute it, I get this:

gold:~/libwww$ ./get_img
Can't locate Time/HiRes.pm in @INC (@INC contains:
/home/venture1/libwww/lib/perl/lib /home/venture1/libwww/lib/perl/arch
/home/venture1/libwww/lib/arch /usr/lib/perl5/i686-linux/5.00401
/usr/lib/perl5 /usr/lib/perl5/site_perl/i686-linux
/usr/lib/perl5/site_perl .) at ./get_img line 42.
BEGIN failed--compilation aborted at ./get_img line 42.
gold:~/libwww$

9)
so this means that either the library is not compiled correctly, or
that I am calling it incorrectly. 

Please help. 



-- 
------------------------------------------------------------------
Vic Parekh
http://www.pobox.com/~vparekh   ||  email: vparekh@pobox.com
------------------------------------------------------------------


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

Date: Tue, 18 May 1999 17:18:29 +0200
From: "Denis Lagarde" <dlagarde@dnstelecom.fr>
Subject: need pid of process initiated with backticks or system call
Message-Id: <374185ae@news.jet-net.net>

How do I get the pid of the process I initiated with
`wget -O file.html www.perl.com `

(the backticks are important there.)

Please answer  to dlagarde@dnstelecom.fr

Thnax ;)

Denis LAGARDE




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

Date: 18 May 1999 15:58:55 GMT
From: vaughan@well.com (Thomas Wade Vaughan)
Subject: Re: negative subscripts
Message-Id: <7hs2nv$5hv$1@its.hooked.net>

J|rgen Exner (juex@my-dejanews.com) wrote:
: Thomas Wade Vaughan <vaughan@well.com> wrote in message
: news:7hpojf$3v0$1@its.hooked.net...
: > A co-worker wanted to know if we could start the index of an array
: > with a negative value. Initially I said no, but later thought of

: Use a hash instead.
: A hash is functionally the same as an array, except that the domain is not
: fixed to a continous subset of the natural numbers starting at 0.

Doesn't the $[ variable change where the index begins? It seemed to until
I iterated with a for loop.

Tom


: jue
: --
: J|rgen Exner





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

Date: 18 May 1999 17:11:09 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: negative subscripts
Message-Id: <3741911d@newsread3.dircon.co.uk>

Thomas Wade Vaughan <vaughan@well.com> wrote:
> J|rgen Exner (juex@my-dejanews.com) wrote:
> : Thomas Wade Vaughan <vaughan@well.com> wrote in message
> : news:7hpojf$3v0$1@its.hooked.net...
> : > A co-worker wanted to know if we could start the index of an array
> : > with a negative value. Initially I said no, but later thought of
> 
> : Use a hash instead.
> : A hash is functionally the same as an array, except that the domain is not
> : fixed to a continous subset of the natural numbers starting at 0.
> 
> Doesn't the $[ variable change where the index begins? It seemed to until
> I iterated with a for loop.
> 

Perhaps but the behaviour is only documented for values of 0 and 1 and
fiddling with this is highly deprecated anyhow - therefore I dont think
you are going to get much sympathy if it starts to behave in a peculiar
manner.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>



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

Date: 18 May 1999 10:28:09 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: No classes.zip file found
Message-Id: <xkfwvy6ibqe.fsf@valdemar.col.hp.com>

cederstrom@kolumbus.REMOVE_THIS.fi (Juho Cederstrom) writes:
> BTW, I made a little research that you might be interested in. Check
> this:

This is buggy.

> 	print "$_ is Perl!\n"		if	/Perl/;

This will print:

PerlScript is Perl!

Which it obviously isn't.  Add some anchors to that regexp, and we'll 
all be happy. :^)

-=Eric


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

Date: Tue, 18 May 1999 16:36:21 GMT
From: mike@mindlogic2.com (Mind Logic)
Subject: Pel Search Engine Needed
Message-Id: <37419723$0$216@nntp1.ba.best.com>

Does anyone know of any Perl search scripts I can install into my web page 
that will only search directories I specify and will only search the data I 
want it to search. I.E. I have a web page with a lot of data in it but I 
include a tag something like <search></search> and it will only search the data 
in-between those tags. The more features it includes the better.

Please CC any replies to me. Thanks.


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

Date: Tue, 18 May 1999 10:52:25 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Cplee5570 <cplee5570@aol.com>
Subject: Re: Perl and cookie
Message-Id: <3741A8D9.725DB0EB@mail.cor.epa.gov>

[courtesy cc sent to poster]

Cplee5570 wrote:
> 
> Hello Friend
> How to use perl script to write cookie and read cookie
> please respond thank you
> Andrea

In Perl it's easy.  Just make sure you have the CGI and
CGI::Cookie modules.  They both have nice documentation,
which includes useful examples.

BTW, Lincoln Stein, the author of the CGI.pm module, has 
a book on using CGI.pm to do web programming.  You might
look for it.

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 18 May 1999 17:39:01 GMT
From: skrana@my-dejanews.com
Subject: Perl Training - Naperville/Chicago
Message-Id: <7hs8jl$hj6$1@nnrp1.deja.com>



Can someone impart Perl Training to me on individual basis?

I am in Naperville, IL.

Pls contact me at 630-983-7774 ext 26 (S K Rana) or
e-mail me at rana@ostint.com.

S K Rana


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 18 May 1999 09:40:40 -0500
From: John Warner <jwarner@tivoli.com>
Subject: Perl, OLE, and Excel Graphs
Message-Id: <37417BE8.4A036FB4@tivoli.com>

Warning:  Only quasi-Perl related.  I've already posted this to several
OLE oriented groups so no flames please!

I am working on a project where I read information from an Oracle server
using Perl (DBI&DBD::Oracle), manipulate the returned data, and then
crank it into an Excel spreadsheet (based on a template) via
Win32::OLE.  All of this works quite well.  However, there is a graph
sheet that references a data
sheet in the workbook.  Since this workbook is based on a template with
some pre-existing values, I need to update the data, series, and
category ranges for the graph after I have manipulated the data sheet.
Unfortunately, I haven't had much luck in finding OLE documentation on
graph objects (yes, I have RTFM and checked FAQs) so I don't know what
properties or methods are available to me.  Can anyone give me a
pointer?  Is this the easiest approach or is there a better way?  Along
the same vein, what are some good OLE programming resources (on-line or
hard copy)?

--

John Warner                           Tivoli Systems Inc.
Sales Support Engineer           9442 Capital Of Texas Hwy North
Sales Infrastructure Group       Austin, TX 78759
john_warner@tivoli.com




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

Date: Tue, 18 May 1999 10:20:42 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Please Help:My script runs on win32, it won't run on Unix
Message-Id: <3741A16A.4411F98F@mail.cor.epa.gov>

Lazer wrote:
> 
> Hi,
> I have written a perl script based on a tutorial which I downloaded, in
> this tutorial, the author suggested i use win32 (Activeperl) to debug my
> perl scripts. The script runs without any glitches on a windows-based
> system. When I try it on a unix server, it just returns an error message
> - I do not have access to the log files, so i can't get any more
> information than that.
> 
> Does anyone have any ideas as to why it won't run, or is there any Url
> where i can see the dfferences(or how to modify a script for unix)?

Since you have ActiveState Perl, you can look in the HTML docs
which came with your install and read a fairly complete discussion
of your problem.  Look in the ActivePerl FAQ section, under the
heading "Web Server Config".  Then click on the question
"My program runs fine from the command line, but bombs out when 
run as a CGI script."

The info there is more complete than you would get in a Usenet
group.  But there is one additional point not covered in that
question.  If you're ftp'ing a file from a win32 box to a unix
box, you have to make sure that you ftp it in ASCII (not binary)
mode, or it won't be transferred properly.
 
> Thanx

Yr welcome
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 18 May 1999 12:37:47 -0400
From: Doug Seay <dms@rtp-bosch.com>
To: Matthias Lohmann <ml-home@gmx.net>
Subject: Re: Protecting perl source code
Message-Id: <3741975B.61CE88A5@rtp-bosch.com>

[posted and mailed]

Matthias Lohmann wrote:
> 
> Hello world,
> 
> we've written a project in perl, and have to protect our source from
> being viewed and edited by our customer.
> 
> Is there a way, and how, to do this ?
> Any reference to a "howto" welcome.

Go look around Deja[News].com for old discussions about this.  There are
certain things that you can do, but they rarely seem to be worth the
effort.  Most of us would say "just let the client see the source".

Tell your boss to fire your sysadmin and hire a good replacement.  He is
obviously unqualified for his job since he didn't install the online
docs that came with the distribution.  I'm assuming that if you had the
docs, you would have read them.  This is a good assumption, isn't it?

Here is the response from perlfaq3 that came with perl 5.004 patch 4.

- doug


--< perlfaq3 >---

How can I hide the source for my Perl program?
 
Delete it. :-) Seriously, there are a number of (mostly unsatisfactory)
solutions with varying levels of "security".
 
First of all, however, you can't take away read permission, because the
source code has to be readable in order to be compiled and interpreted. 
(That doesn't mean that a CGI script's source is readable by people on
the web, though.)
 
So you have to leave the permissions at the socially friendly 0755
level.
 
Some people regard this as a security problem.  If your program does
insecure things, and relies on people not knowing how to exploit those
insecurities, it is not secure. It is often possible for someone to
determine the insecure things and exploit them without viewing the
source.  Security through obscurity, the name for hiding your bugs
instead of fixing them, is little security indeed.

You can try using encryption via source filters (Filter::*from CPAN). 
But crackers might be able to decrypt it.  You can try using the byte
code compiler and interpreter described below, but crackers might be
able to de-compile it.  You can try using the native-code compiler
described below, but crackers might be able to disassemble it.  These
pose varying degrees of difficulty to people wanting to get at your
code, but none can definitively conceal it (this is true of every
language, not just Perl).
 
If you're concerned about people profiting from your code, then the
bottom line is that nothing but a restrictive licence will give you
legal security.  License your software and pepper it with threatening
statements like "This is unpublished proprietary software of XYZ Corp. 
Your access to it does not give you permission to use it blah blah
blah."  We are not lawyers, of course, so you should see a lawyer if you
want to be sure your licence's wording will stand up in court.


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

Date: Tue, 18 May 1999 11:33:08 -0500
From: Bryan Camp <b-camp@students.uiuc.edu>
Subject: Q: System Call
Message-Id: <Pine.SOL.3.96.990518112620.22134A-100000@ux12.cso.uiuc.edu>

Hello,

I'm having trouble getting a system call
to work within my perl script.

Here's the system call:

system("nawk '{print $$PND_COUNTER, $$DEVICE_COUNTER }' $File_Names[$c]");

The reason for the problem is that I can't figure out the proper escaping
characters to using between the two "$$'s" so that nawk will recognize
this is the field number to print, and perl will recognize that
$PND_COUNTER, and $DEVICE_COUNTER are variables containing the numbers of
the field I need to print.

The system call works fine when I substitue numbers in for $PND_COUNTER
and $DEVICE_COUNTER, i.e.:

system(" nawk '{print $1, $2}' $FileNames[$c]);

Does someone know what I'm doing wrong, or what I need to do to fix this
problem?

Thank you very much.

Bryan



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

Date: 18 May 1999 16:49:22 GMT
From: bdwheele@indiana.edu ()
Subject: Re: Q: System Call
Message-Id: <7hs5mi$r9n$1@jetsam.uits.indiana.edu>

In article <Pine.SOL.3.96.990518112620.22134A-100000@ux12.cso.uiuc.edu>,
	Bryan Camp <b-camp@students.uiuc.edu> writes:

$'s in " quoted strings are treated as perl variables.  To get a real
$ in a string, use \$.

so...

> 
> system("nawk '{print $$PND_COUNTER, $$DEVICE_COUNTER }' $File_Names[$c]");
> 

would become:

system("nawk '{print \$\$PND_COUNTER, \$\$DEVICE_COUNTER}' $File_Names[$c]");

Brian Wheeler
bdwheele@Indiana.edu


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

Date: Mon, 17 May 1999 20:37:39 -0000
From: "Rafala" <rafala@loyolanet.campuscwix.net>
Subject: Re: Reg Exp Q!
Message-Id: <7hs8h3$jn6$1@news.campuscwix.net>

A phone number with optional area code and optional extension:
1-555-555-1234 x1234

mike

Bill Jones wrote in message <3740579d.0@usenet.fccj.cc.fl.us>...
>I started to give up and ask what this matches -
>
>/(?:(?:(1)[.-]?)?\(?(\d{3})\)?[.-]?)?(\d{3})[.-]?(\d{4})(x\d+)?/i;
>
>but I am not; I will post what I think the answer is shortly...
>
>Embarrassing, huh?,
>-Sneex-  :]
>______________________________________________________________________
>Windows is a 32-bit extension for a 16-bit patch for a 8-bit operating
>system which was originally coded for a 4-Bit microprocessor by a
>2-bit company that can't stand 1-bit of competition. :)
>
>         Jacksonville Perl Mongers
>         http://jacksonville.pm.org
>         jax@jacksonville.pm.org




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

Date: Tue, 18 May 1999 16:04:34 +0100
From: "Michael Dransfield" <mike@euromortgage.cc>
Subject: Simple Alienform / Winmail problem
Message-Id: <37418105@news.jakinternet.co.uk>

Please can you help me, I have installed Alienform onto my server and I am
trying to set it up at the moment.  I have used the formats supplied
(changed only slightly).  When I click submit the open or save to disk
dialogue appears if I choose open file from current location I get the
following

 windmail -y flush
Switches:
   -n <input file>   ( d:\inputfile.txt    )  --  Use File for Input
   -o <output file>  ( d:\outputfile.txt   )  --  Use File for Log Output
   -g <log level>    ( 5                   )  --  Set level of logging
   -t                                         --  Parse Header for To and
From
   -a <attachment>   ( d:\anyfile.doc      )  --  MIME Encode Binary
Attachment
   -l <dist-list>    ( d:\distlist.txt     )  --  Distribution List
   -u <address>      ( sender@domain.com   )  --  Specify Sender Address
   -b <Subject>      ( "The Subject"       )  --  Specify Subject
   -r <Priority>     ( 1                   )  --  1 (Highest) - 5 (Lowest)
   -c <char set>     ( iso-8544            )  --  Specify character set
   -m <content-type> ( text/enriched       )  --  Specify MIME Content-Type
   -e <encoding>     ( base64)             )  --  Set Content-Transfer
Encoding
   -s <servername>   ( mailhost.domain.com )  --  Specify SMTP Server
   -p <SMTP Port>    ( 25                  )  --  Specify SMTP Port
   -q <directory>    ( d:\temp\queue       )  --  Specify queue directory
   -y flush          --  Flush message queue
   -y hold          --  Don't send queued messages
   -z                                         --  Queue Only Mode (Do Not
Send)
   -i                                         --  Interactive Mode (prompts)
Content-Type: text/html

Mail Send Error
 An error occurred when sending the email: 256. Please check the email's
headers.

If this is a simple problem of the email.txt being wrong please can you tell
me the correct format for Winmail

Thank you

Mike

Please reply to

mike@euromortgage.cc            http://www.euromortgage.cc






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

Date: Tue, 18 May 1999 07:48:55 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: sort non-alpha characters
Message-Id: <73krh7.pt9.ln@magna.metronet.com>

Henry Vermeulen (hvermeulen@correctnl.com) wrote:

: I'm trying to sort a list like this:

[snip data, repeated below]

: Only with about 600 lines.
: It must be sorted on the names between > and </option>.
: Almost every piece of documentation is about nummeric sort.
: Or is much to complicated for me.
: (Or i'm too stupid too understand and is very easy)


   You need change only one line of the code given in the answer
   to this FAQ from part 4:

      "How do I sort an array by (anything)?"


: Who can give me a push in the right direction?


   Change the regex from the FAQ, and you're finished!


----------------------------------
#!/usr/bin/perl -w
use strict;

my @data = <DATA>;

my @idx = ();
for (@data) {
   my($item) = /<option[^>]*>([^<]+)/;
   push @idx, uc($item);
}
my @sorted = @data[ sort { $idx[$a] cmp $idx[$b] } 0 .. $#idx ];

foreach (@sorted) {
   print;
}

__DATA__
<option value="verzend_biljet/psion_nederland.html">Psion Nederland</option>
<option value="verzend_biljet/abms.html">ABMS</option>
<option value="verzend_biljet/itcs.html">I.T.C.S. bv</option>
<option value="verzend_biljet/deltron.html">Deltron</option>
----------------------------------


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 18 May 1999 12:55:43 -0400
From: Jay Rogers <jay@rgrs.com>
Subject: Re: Telnet Prompt
Message-Id: <82n1z2mi5s.fsf@shell2.shore.net>

"Puddister, Shannon" <pdncoop@americasm01.nt.com> writes:

> I'm writing a program to connect to a remote server by way of Telnet,
> and having a little diffculty understanding the Prompt construct of the
> Telnet module.  Does this prompt refer to the expected prompt of my
> computer, or that of the host?

These and other questions are answered in the manpage that comes
with Net::Telnet.  Checkout the section "What To Know Before
Using" and the specific section for prompt().


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

Date: Tue, 18 May 1999 11:25:55 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: use array as keys in a hash
Message-Id: <x3yzp32v1q4.fsf@tigre.matrox.com>


"Jim Bell" <jbell@263.net> writes:

> # I have an array like this
> my @arr = ( a,b,c );
> # then I have a hash like this
> my %ha = (
>             'a' => '1',
>             'b' => '2',
>             'c' => '3' )
> # so now, can I do something like this in order to print all %ha?
> print $ha{@a};

Very close. That should've been:

	print @ha{@arr};

This only prints the values though. If you want to print everything,
just do:

	print %ha;

Of course, you might need to format the output in some nice way.

HTH,
Ala



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

Date: Tue, 18 May 1999 16:00:10 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Using split with map, then join
Message-Id: <7hs2q9$dk6$1@nnrp1.deja.com>

In article <7hq85h$78f$1@nnrp1.deja.com>,
  lou@visca.com wrote:
>
> #!/usr/local/bin/perl
>
> use strict;
> use diagnostics;
>
> my $data = 'database3.txt';
>
> open DAT, $data or die $!;
> my @data = <DAT>;
> close DAT or die $!;
>
> my @newdata = map {(split /\|/)[0,3..6], "\n"} @data;
> my $new = join '|', @newdata;
> $new =~ s/\|\n\|?/\n/g;
>
> print $new;

No no no.  First of all, you should deal with the input data
on a line-by-line basis.
For each line, split it into fields, select the fields you want,
and print them out as a line.

  while(<>) {
    my @fields = split /\|/;
    print join( '|', @fields[ 0, 3..$#fields ] ), "\n";
  }

Here's a shorter way:

  #!/usr/local/bin/perl -anF/\|/
  BEGIN { $, = '|' }
  print @F[0,3..$#F];

--
Put it on a plate, son.  You'll enjoy it more.


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Tue, 18 May 1999 12:19:11 -0500
From: "brent" <simp@mail.utexas.edu>
Subject: what's wrong with my head(er)...?
Message-Id: <7hs7e0$ft$1@geraldo.cc.utexas.edu>

admitted newbie has following headache --

trying to learn some perl for CGI stuff. I've been using variations of the
following code to print to the browser with no success. When I debug it from
the command line it keeps closing the <body> & <html> tags before putting
any of my content in ... what up with that?

Any advice would be greatly appreciated ...

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

 print $query->header;

        print $query->start_html(-title=>'Votes Returned',
                                -BGCOLOR=>'blue');

         h2('Percentages'),

        print p("The percentage of those who answered Yes is :
$yes_percent."),
        print p("The percentage of those who answered No is :
$no_percent."),
        print p("The percentage of those who answered Maybe is :
$maybe_percent."),
        print p("$total people have voted so far."),

        print $query->end_html;

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


brent
digital information literacy office
University of Texas at Austin
simp@mail.utexas.edu
"shift happens"




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

Date: Tue, 18 May 1999 16:05:07 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Y2K.  localtime(time)
Message-Id: <ebohlmanFBxrCJ.BrF@netcom.com>

Hans Xie <hans.xie@its.CSIRO.AU> wrote:
: I am in the middle of our Y2K testing.  I am puzzled by the localtime() return 
: value.  Out system date is: Sun Jan  2 10:10:51 EST 2000

: I noticed a strange thing.  I put it in the below script to make the 
: situation simple and clear:
:   #!/usr/local/bin/perl
:   ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
:   print $year;

: It prints 100, instead of 2000 or 00.

: Any idea?  Thanks in advance.

The documentation for localtime says, and I quote: "$year is the number 
of years since 1900."

How many years since 1900 is Jan 2, 2000?

a) 100
b) 2000
c) zero

I'd really like to know *why* so many people have a mental block about 
this.  The description in localtime()'s documentation leaves not the 
slightest room for interpretation, but for a lot of people it goes in one 
eye and out the other.  It's like trying to get people to spell my last 
name right; if I dictate it to them letter by letter, about half the 
people will suddenly lose their ability to write down the letter "m"; 
it's as if they have some sort of mental rule about "no more than two 
consonants in a row."

I'm sorry to have to say this, but if you do not know how localtime()
returns date information, and you either do not know how to consult the
documentation to find out how it does so, or cannot understand what "$year
is the number of years since 1900, that is, $year is 123 in year 2023, and
*not* simply the last two digits of the year"  means, then you are 
simply not competent to be doing Y2K testing on Perl code.  And yes, that 
holds even if your problem with the documentation is that it's not 
written in your first language.



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

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

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