[7012] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 637 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 19 21:18:06 1997

Date: Thu, 19 Jun 97 18:00:33 -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           Thu, 19 Jun 1997     Volume: 8 Number: 637

Today's topics:
     Re: a perl mode in emacs that does a better job with qu <rra@stanford.edu>
     Re: Accessing Win 95 Registry w/Perl (David Whitmarsh)
     Re: Binary conversion (reading a gif header) (Randy J. Ray)
     Re: Broken Pipe (Charles DeRykus)
     Re: Can't find *** in @INC ....Help Please (Shelle)
     Re: Can't find *** in @INC ....Help Please (Shelle)
     Case-matching substitution? (William C Ralph)
     Re: delayed Output <rra@stanford.edu>
     Re: Displaying a Web Site Tree? (Philip Barone)
     Re: Echo Etc. Q <rra@stanford.edu>
     errors compiling perl5.004 on Solaris 2.4 (Philip Barone)
     filehandle/subroutine <kamiya@cse.ucsc.edu>
     Re: how could I print or whatever a character one by on (kEQNql(Gil))
     int function <mwendl@watson.wustl.edu>
     Java, perl and PERLLIB <dtshield@asic.sc.ti.com>
     Re: Julian Date Function Needed (David  Bell)
     Re: Julian Date Function Needed (Steffen Beyer)
     Re: Llama question (beryte)
     Re: PERL to Oracle <billc@tibinc.com>
     print "Hi", last ... (Peter Scott)
     reading end-of-line in a string <maelstrom@deathsdoor.com>
     Re: Reading from STDIN pipe & Keyboard (Charles DeRykus)
     Re: recursive <jefpin@bergen.org>
     Rounding a Random Number <scott@moriah.com>
     Re: Script to verify email addresses? <rra@stanford.edu>
     Search all /home2/user/WWW/index.htm(l) <lauri@samoilu.net>
     SOCKS5 and Perl 5 (Malcolm Hoar)
     Re: Sorting Associative Array? (Urgent) <wesley@woais.com>
     Re: Unexpected -X filetest behavior <rra@stanford.edu>
     Re: Use and code in 2 files (beryte)
     Re: WANTED: perl script for base64 MIME decoding (Shelle)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 19 Jun 1997 16:52:23 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: a perl mode in emacs that does a better job with quotes?
Message-Id: <m3yb865ex4.fsf@windlord.Stanford.EDU>

In comp.lang.perl.misc, Tim Gray <tim@hcirisc.cs.binghamton.edu> writes:
> ilya@math.ohio-state.edu (Ilya Zakharevich) writes:

>> First of all, you can backwack bad guys.  Second, if you have fresh
>> enough emacs (starting from Apr 15 1997 RMS Emacs), cperl will do it.

> What I really want to see is a font-lock-mode for perl that can deal
> with here documents and alternate quoting mechanisms.

Ilya's actually does a fairly decent job, and from what he's said
apparently it will be even better once 19.35 has been released and us
lowly peons can use it rather than just the development types.  :)

(The latest version of Ilya's cperl-mode is at ftp.math.ohio-state.edu in
/pub/users/ilya/emacs, BTW.)

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Thu, 19 Jun 1997 19:55:59 GMT
From: david.whitmarsh@dial.pipex.com (David Whitmarsh)
Subject: Re: Accessing Win 95 Registry w/Perl
Message-Id: <33a91f50.22310517@news.dial.pipex.com>

dagcs@knuth.mtsu.edu wrote:

>
>I am trying set up a script to modify generic install during a PC 95
>platform build.  When I try using the command ' use registry',
>refering to the file registry.pm in the perl5\bin directory.  The
>directory is in the path.  The error I get says, ' can't  locate
>registry.pm in @INC . . .'.  
>

try

use Win32::Registry




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

Date: 19 Jun 1997 13:53:10 -0600
From: rjray@tremere.ecte.uswc.uswest.com (Randy J. Ray)
Subject: Re: Binary conversion (reading a gif header)
Message-Id: <uow9106gyjd.fsf@tremere.ecte.uswc.uswest.com>

nvp@shore.net (Nathan V. Patwardhan) writes:
> Nick Holmes (nick@bluewave.co.uk) wrote:
> 
> : I am trying to read the dimension data from the top of a .gif file, I
> : can read in the requisite number of bytes, but cannot then convert the
> [snip]
> 
> If you're just trying to get the size of the image, why not use
> Image::Size available from a CPAN near you?
> 
> http://www.perl.com/CPAN/modules/by-module/Image/

Not only that, but the sizing code for GIFs was contributed by Dan Klein,
whose code accounts for multi-frames in GIF89a, and still returns the correct
size for the full overall image.

Randy
-- 
===============================================================================
Randy J. Ray -- U S WEST Technologies IAD/CSS/DPDS         Phone: (303)595-2869
                Denver, CO                                     rjray@uswest.com
"It's not denial. I'm just very selective about the reality I accept." --Calvin


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

Date: Thu, 19 Jun 1997 17:13:29 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Broken Pipe
Message-Id: <EC196I.DDx@bcstec.ca.boeing.com>

In article <33A94719.4FD6@informatik.tu-muenchen.de>,
Alex `Taker` Pircher  <pircher@informatik.tu-muenchen.de> wrote:
>> Since my telepathic senses are failing me today (due to a sinus
   >> infection), please post some code to this newsgroup, and we'll all try
   >> and analyze it.  :-)
   >
 >The problem is I try to send for example Netscape a file, but
 >if the User cancel's the Downloading process my perl-script
 >stops with "Broken pipe". 
 >

In the spirit of plumbing, perhaps catching a SIGPIPE 
will help, e.g.,

  $SIG{PIPE} = sub {die "broken pipe"};  
  eval { "... send file somewhere ..." }; 
  if ($@ =~ /^broken pipe/) {  # probably cancelled 
    ...
  } elsif ($@) {    # weird eval error
    croak "...";
  }


HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.com



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

Date: Thu, 19 Jun 1997 21:50:05 GMT
From: shelle@interaccess.com (Shelle)
Subject: Re: Can't find *** in @INC ....Help Please
Message-Id: <5oc9id$o4_002@interaccess.interaccess.com>

Joseph Allen Dane <jdane@hawaii.edu> wrote:
>shelle@interaccess.com (Shelle) writes:
>
>> Having been through all of the manuals, FAQs, and online documents regarding 
>> Perl on Windows95, I have yet to find a suitable answer for why I get errors 
>> such as:
>> 
>>    Can't locate XXXXX/XXXX.pm in @INC at filename.pl line ##.
>
>Pretty simple:  you are trying to use/require a module that perl can't
>find.  You'll need to add the directory the use'd modules are in to
>the search path.  In a unix environment, you can set the PERLLIB env
>variable, but I don't know about W95.  You can also say
>
>use lib 'path\to\the\directory';
>
>in your script, before you try to import anything, which might be a
>better idea anyway.

That didn't work for me, but I am happy to report SUCCESS!  Here's the one 
that FINALLY did it:

BEGIN {
     unshift(@INC,'c:\\perl\\lib');
      }

I could swear I tried this 20 times but today it decided to work as it's 
supposed to and "so far" it looks good! :)

I truely appreciate the time you took to help me. Thanks.

Michelle ----,-'-(@

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Michelle Feigen      ----,-'-(@      shelle@interaccess.com
                     MEAN PEOPLE SUCK!    
          http://homepage.interaccess.com/~shelle/
       http://homepage.interaccess.com/~shelle/grafx/       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Thu, 19 Jun 1997 21:52:27 GMT
From: shelle@interaccess.com (Shelle)
Subject: Re: Can't find *** in @INC ....Help Please
Message-Id: <5oc9mr$o4_004@interaccess.interaccess.com>

Dave.Cross@gb.swissbank.com (Dave Cross) wrote:
>shelle@interaccess.com (Shelle) writes:
>
>> Having been through all of the manuals, FAQs, and online documents regarding 
>> Perl on Windows95, I have yet to find a suitable answer for why I get errors 
>> such as:
>> 
>>    Can't locate XXXXX/XXXX.pm in @INC at filename.pl line ##.
>
>One of your scripts is trying to include a module (with a 'use' or
>'require' command) that it can't find. To find where Perl is looking
>for the module run a short script to print the contents of the @INC array,
>somthing like:
>
>perl -e 'print(join("\n", @INC), "\n")'
>
>should do it. Then compare the list of directories you get from this to the 
>directory where your XXXXX/XXXX.pm module is actually installed. If you
>find a discrepancy you can address it in one of two ways, either move
>XXXXX/XXXX.pm into one of the @INC directories or change @INC to include
>the directory that contains XXXXX/XXXX.pm. The easiest way to do this is
>by setting a PERL5LIB environment variable that contains the names of the
>directories you need to add (not sure how this is achieved under Win95).
>
>Hope this helps, if you need any more details please shout.

I am happy to report SUCCESS!  Adding the following to my scrpits FINALLY did 
it for me:

BEGIN {
     unshift(@INC,'c:\\perl\\lib');
      }

I could swear I tried this 20 times but today it decided to work as it's 
supposed to and "so far" it looks good! :)

I truely appreciate the time you took to help me. Thanks.

P.S.  You don't want me to shout; They always said I don't need a 
microphone...  :)

Michelle ----,-'-(@

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Michelle Feigen      ----,-'-(@      shelle@interaccess.com
                     MEAN PEOPLE SUCK!    
          http://homepage.interaccess.com/~shelle/
       http://homepage.interaccess.com/~shelle/grafx/       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Thu, 19 Jun 1997 12:45:32 -0500 (CDT)
From: ralphwc@mail.auburn.edu (William C Ralph)
Subject: Case-matching substitution?
Message-Id: <Pine.SOL.3.95.970619124212.5025C-100000@wood2>

I'm looking for a case-matching substitute commmand for words in a long
string of text.

For example:
I want to substitue all the instances of the word cat with the word
feline.  The regular substitute operator works grand if all instances are
lowercase.

$text = <STDIN>;
$find = "cat";
$replace = "feline";
$text =~ s/ $find / $replace /g;

But what happens when someone inputs Cat, or CAT.  I don't want to have to
type in every variation of every word into my find and replace file.  Is
there some kind of tag (-i just replaces Cat and CAT with feline instead
of Feline and FELINE) that I can use in the substitute operator.  Even if
I could find a way to cap the first letter, that might be sufficient.

Carter Ralph
ralphwc@mail.auburn.edu





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

Date: 19 Jun 1997 16:50:13 -0700
From: Russ Allbery <rra@stanford.edu>
To: a4431ndm@pcserv.univie.ac.at (J|rgen Mangler)
Subject: Re: delayed Output
Message-Id: <m33eqe6tl6.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

J|rgen Mangler <a4431ndm@pcserv.univie.ac.at> writes:

> I want to create a cgi-programm that prints characters (e.g. 10) into
> the browser window with a delay of 1 second. But the browser always
> waits until the whole document is created (for example 10 seconds for
> these 10 characters) and then he loads in the whole page in one
> peace. Is there a way to reach this 'slowly-reading-the-characters-in'
> effect?

Yes, you need to unbuffer your output.  Add the line:

        $| = 1;

to the beginning of your Perl script.  See man perlvar for more details.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 19 Jun 1997 21:52:39 GMT
From: pbarone@rsa.hisd.harris.com (Philip Barone)
Subject: Re: Displaying a Web Site Tree?
Message-Id: <PBARONE.97Jun19175239@sursafu>

In article <EBD6DJ.4Jo@rc.gc.ca> rbarkhou@rc.gc.ca (Rick Barkhouse) writes:


You have got to see this site. It's not perl but javascript and is
pretty cool.

http://www.geocities.com/Paris/LeftBank/2178

>  Does anyone know of a program or script (preferably in Perl) that I can 
>  use on our Unix web server to give a tree-like display of the web site?  
>  It would take an index file and recursively branch off with each local html 
>  file it finds referenced.

>  --
>  Rick Barkhouse <rbarkhou@rc.gc.ca>
>  Data Administration Specialist
>  Revenue Canada, Internet Services Division - IHID
>  Work: 613.952.0189

--
Phil Barone
pbarone@harris.com


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

Date: 19 Jun 1997 17:02:38 -0700
From: Russ Allbery <rra@stanford.edu>
To: bgjohnso@unix.amherst.edu (Brad Johnson)
Subject: Re: Echo Etc. Q
Message-Id: <m3rady5eg1.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

Brad Johnson <bgjohnso@unix.amherst.edu> writes:

> I'm trying to write a little specialized ftp-automater on perl for dos
> (sample code below), but I'd like to be able to echo system commands to
> the screen; i.e. I use the line `ftp -s:ftpscript.txt $server1`; which
> tells the ftp to use ftpscript.txt for commands but I don't get to see
> the messages ftp generates.

No wonder.  You're capturing them all and discarding them.  This is a
common problem.  From man perlfaq8:

     What's wrong with using backticks in a void context?

     Strictly speaking, nothing.  Stylistically speaking, it's
     not a good way to write maintainable code because backticks
     have a (potentially humungous) return value, and you're
     ignoring it.  It's may also not be very efficient, because
     you have to read in all the lines of output, allocate memory
     for them, and then throw it away.  Too often people are
     lulled to writing:

         `cp file file.bak`;

     And now they think "Hey, I'll just always use backticks to
     run programs."  Bad idea: backticks are for capturing a
     program's output; the system() function is for running
     programs.

     Consider this line:

         `cat /etc/termcap`;

     You haven't assigned the output anywhere, so it just wastes
     memory (for a little while).  Plus you forgot to check $? to
     see whether the program even ran correctly.  Even if you
     wrote

         print `cat /etc/termcap`;

     In most cases, this could and probably should be written as

         system("cat /etc/termcap") == 0
             or die "cat program failed!";

     Which will get the output quickly (as its generated, instead
     of only at the end ) and also check the return value.

     system() also provides direct control over whether shell
     wildcard processing may take place, whereas backticks do
     not.

In other words, you want to use:

        system ('ftp', '-s:ftpscript.txt', $server1);

instead.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: 19 Jun 1997 22:01:22 GMT
From: pbarone@rsa.hisd.harris.com (Philip Barone)
Subject: errors compiling perl5.004 on Solaris 2.4
Message-Id: <PBARONE.97Jun19180122@sursafu>

Hi,
I am having some trouble compiling I thought somebody might help
be able to help me out with.

I get similar errors with perl versions perl5.004.tar.gz and 
perl5.004_01.tar.gz I got from CPAN On Sun Sparc5 Solaris 2.4 box.

I am currently using 5.002 with no problems.

This is an instance of what I'm seeing when doing just the make:

 .
 .  Some lines cut here
 . 
       Making DynaLoader (static)
Prototype mismatch: sub ExtUtils::MakeMaker::prompt ($;$) vs ($;$) at (eval 1) line 29.
Writing Makefile for DynaLoader
mkdir ../../lib/auto/DynaLoader
cp DynaLoader.pm ../../lib/DynaLoader.pm
AutoSplitting DynaLoader (../../lib/auto/DynaLoader)
cp dl_dlopen.xs DynaLoader.xs
 ../../miniperl -I../../lib -I../../lib ../../lib/ExtUtils/xsubpp -noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs >xstmp.c && mv xstmp.c DynaLoader.c
 .
 .  Some lines cut here
 .

        Making IO (dynamic)
Prototype mismatch: sub ExtUtils::MakeMaker::prompt ($;$) vs ($;$) at (eval 1) line 29.
Writing Makefile for IO
mkdir ../../lib/auto/IO
cp lib/IO/File.pm ../../lib/IO/File.pm
cp lib/IO/Select.pm ../../lib/IO/Select.pm
cp lib/IO/Socket.pm ../../lib/IO/Socket.pm
 .
 .  Some lines cut here
 .

These are the errors I get during make test:

 .
 .  Some lines cut here
 .
comp/multiline....ok
comp/package......ok
comp/proto........ok
comp/redef........FAILED on test 0
comp/script.......ok
comp/term.........ok
comp/use..........ok
 .
 .
 .
op/sort...........ok
op/split..........ok
op/sprintf........ok
op/stat...........FAILED on test 4
op/study..........ok
op/subst..........ok
 .
 .  Some lines cut here
 .
lib/io_xs.........ok
lib/ndbm..........ok
lib/odbm..........ok
lib/opcode........Prototype mismatch: sub Opcode::opset_to_hex ($) vs ($) at ../lib/Opcode.pm line 40.
Prototype mismatch: sub Opcode::opdump (;$) vs (;$) at ../lib/Opcode.pm line 50.
ok
lib/open2.........ok
lib/open3.........ok
lib/ops...........Prototype mismatch: sub Opcode::opset_to_hex ($) vs ($) at ../lib/Opcode.pm line 40.
Prototype mismatch: sub Opcode::opdump (;$) vs (;$) at ../lib/Opcode.pm line 50.
ok
lib/parsewords....ok
lib/posix.........ok
lib/safe1.........Prototype mismatch: sub Opcode::opset_to_hex ($) vs ($) at ../lib/Opcode.pm line 40.
Prototype mismatch: sub Opcode::opdump (;$) vs (;$) at ../lib/Opcode.pm line 50.
ok
lib/safe2.........Prototype mismatch: sub Opcode::opset_to_hex ($) vs ($) at ../lib/Opcode.pm line 40.
Prototype mismatch: sub Opcode::opdump (;$) vs (;$) at ../lib/Opcode.pm line 50.
ok
lib/sdbm..........ok
lib/searchdict....ok
lib/selectsaver...ok
lib/socket........ok
lib/soundex.......ok
lib/symbol........ok
lib/texttabs......ok
lib/textwrap......ok
lib/timelocal.....ok
lib/trig..........ok
Failed 2 test scripts out of 152, 96.05% okay.
   ### Since not all tests were successful, you may want to run some
   ### of them individually and examine any diagnostic messages they
   ### produce.  See the INSTALL document's section on "make test".
   ###
   ### Since most tests were successful, you have a good chance to
   ### get information with better granularity by running
   ###     ./perl harness
   ### in directory ./t.
u=1.78  s=2.99  cu=90.59  cs=75.62  scripts=147  tests=4136
*** Error code 1 (ignored)
--
Phil Barone
pbarone@harris.com


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

Date: 19 Jun 1997 17:28:45 -0700
From: Fumiaki Kamiya <kamiya@cse.ucsc.edu>
Subject: filehandle/subroutine
Message-Id: <a2u3ium81u.fsf@sundance.cse.ucsc.edu>


Hi, I'm having trouble reading a non-local filehandle inside
a subroutine.  Perl complains as 

	Use of uninitialized value at pop3.pl line 52, <SOCK> chunk 1.

The code at line 52 of the file is

	print SOCK "$_\n";

which is simply to send the string passed to the subroutine
to the socket SOCK.

SOCK is opened in the main routine, and works fine there as
I can read and write to it without any problems.  It's only
that when I try to read or write to it inside a subroutine
that I get the above error message.

Could someone explain to me why this is so and how I can get
around this problem?

Thanks,

Fumi Kamiya


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

Date: Fri, 20 Jun 1997 00:19:50 GMT
From: mingtian@hotmail.com (kEQNql(Gil))
Subject: Re: how could I print or whatever a character one by one from $string, not from @array?
Message-Id: <33a9cc0e.3181271@usenet.kornet.nm.kr>

>well yes but...
>($big5str=$GBstr)=~s/[\x80-\xFF]./&big5toGB($1)/seg;

yes, looks like more perly,
but what  is $1? is it [\x80-\xFF]. ?

and Big5's first character starts from A1 to FE =)

 ...
Gil (Hangul:@11fA_, EUC-KR: kEQNql, HZ: ~{R|<*VX~}, BIG5: $(&N-+, GB: R|<*VX)
Computer Science, Sejong University.
Homepage: http://soback.kornet.nm.kr/~chlang/
Cute Chat: http://soback.kornet.nm.kr/~chlang/cutechat
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">
!F 1W4k 3*?!0T4B >pA&3* GQ<[@L 2I@L?4@84O 0q8q1f 59>F3*?@4B  !F
">   594c ?6?!<- H/Hw 9L<RA~0m @V4B 5i2I GQ<[@L?M55 00>F    ">
!F     H%@Z@V>n >5>5GQ 3*@G 0!=??! Hq8A@; @|GXAV4x 2I        !F
!F                  "4^7!<- >HAV8i ;/>n6s"                   !F
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">


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

Date: Thu, 19 Jun 1997 16:24:06 -0500
From: Mike Wendl <mwendl@watson.wustl.edu>
Subject: int function
Message-Id: <33A9A376.6452@watson.wustl.edu>

I couldn't find a rounding function in PERL so I thought I'd
roll my own simple version, but ran into trouble with the "int"
function. Anyone out there experienced this? Any workarounds?

thanks

Here's the problem:
 
>> perl
$val = 5.015;
$arg = 100.0*$val+0.5;
$val = int ($arg);
print "ARG IS $arg and RESULT IS $val\n";
ARG IS 502 and RESULT IS 501

-----------------------------------------------------------------------
Michael C. Wendl, ScD                 |  Email: mwendl@watson.wustl.edu
Genome Sequencing Center    Box 8501  |  Phone: 314-286-1831
Washington University Medical School  |
4444 Forest Park Blvd.                |
St. Louis, MO  U.S.A.  63108          |
-----------------------------------------------------------------------


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

Date: Thu, 19 Jun 1997 16:23:16 -0500
From: Dorwin Shields <dtshield@asic.sc.ti.com>
Subject: Java, perl and PERLLIB
Message-Id: <33A9A344.10B7@asic.sc.ti.com>

Hi, 

I'm calling some perl programs from java but I can't
figure out how to set PERLLIB--there doesn't seem
to be a command line option to set this variable.
--I can't modify the environment from java--
Any suggestions?

Thanks
Dorwin


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

Date: 19 Jun 1997 13:54:50 -0700
From: dbell@azstarnet.com (David  Bell)
Subject: Re: Julian Date Function Needed
Message-Id: <5oc6aq$57d@web.azstarnet.com>

In article <33a8bbbb.1597349@news.earthlink.net>,
Frank Fisher <frank@primemail.com> wrote:
>I need to count days into the future; example, today() + 45 days to
>get a mm/dd/yy date.  Is there a julian date function I can use or
>some other perl function that will do the same thing?
>

You can just add a 45 day offset (in seconds) to the value returned by
time and then use localtime to convert, like this:

sub futuredate {  		# return date string for N days in future
        my ($dd, $mm, $yy) = (localtime (time + $_[0]*24*60*60))[3,4,5];
        $mm++;                  # adjust for zero-based months
        $yy %= 100;             # 2000+ ok
        return sprintf "%.2d/%.2d/%.2d", $mm, $dd, $yy;
}

print &futuredate(45), "\n";


Hope this helps,

Dave


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

Date: 19 Jun 1997 19:56:47 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Julian Date Function Needed
Message-Id: <5oc2tv$cu5$1@en1.engelschall.com>

Mike Stok <mike@stok.co.uk> wrote:

> In article <33a8bbbb.1597349@news.earthlink.net>,
> Frank Fisher <frank@primemail.com> wrote:
> >I need to count days into the future; example, today() + 45 days to
> >get a mm/dd/yy date.  Is there a julian date function I can use or
> >some other perl function that will do the same thing?

Actually, that function was one of the main reasons for developing the
"Date::DateCalc" module!

(Among others like never to have to re-write date functions again for
every application where they were needed. I've seen too much bad code
in this area I couldn't bear it any longer...)

> There are several Date and Time manipulating functions in modules
> available from CPAN, the comprehensive perl archive network (on the web
> point your browser at http://www.perl.com/CPAN/ ) 

The "Date::DateCalc" module can also be downloaded from my website at

http://www.engelschall.com/u/sb/download/

where you can also find a description of this module and an illustrating
logo for it (which addresses your problem mentioned above, BTW!).

> If you want to use julian day numbers then Time-modules-97.011701 might be
> the thing for you (though the DateCalc module has more goodies in it, and

Thanks a lot for advocating my module and supporting me in my efforts,
Mike! :-)

Yours sincerely,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: Thu, 19 Jun 1997 21:50:36 GMT
From: beryte@leb.net (beryte)
Subject: Re: Llama question
Message-Id: <33a9a992.7619864@news.telecom.at>

On 19 Jun 1997 14:28:00 -0400, glm@panix.com (Gilbert Midonnet) wrote:
>Hello all, 
>
>I'm having a problem with the questions at the end of chapter 3. 
>I've searched through deja news. I don't think anybody has asked
>this question in a while :>
>
>The concept is simple. Take some inputted strings and print out the
>list in reverse.

Hi, start first with something simple such as:

#!/path/to/perl
@list = ("?","working ","this ","is ");
print reverse(@list);


>I set up my own little script. It didn't work, nor did any of the 
>modifications. I copied Randal Schwartz' example. That too did not
>work.
>
>The script is as follows. (from page 199)
>
>#!/usr/local/bin/perl5
>print "Enter the list of strings:\n";
>@list = <STDIN>;
>@reverselist = reverse(@list);
>print @reverselist;
>
>The problem in this example is in the input of information. There
>is no end to the list desired. 

Try maybe Ctrl+D

>If I input the data using a scalar variable and then put the scalar
>variable into an array, and ask the program to print out the array
>variable, that too doesn't work.
>
>EXAMPLE:
>
>$a = <STDIN>;
>

it does, take a look at the following:

#!/path/to/perl
print "Enter the list of strings - terminate with a blank line:\n";
$list = " ";
while($list ne "") {
  $list = <STDIN>;
  chop($list);
  push(@list, $list);
 }
print reverse(@list);

>...
>
>@a = ($a,$b,$c);
>print @a;
>
>
>TIA
>
>
>Gilbert Midonnet

salut,

beryte


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

Date: Thu, 19 Jun 1997 20:55:09 -0400
From: Bill Cowan <billc@tibinc.com>
To: "C. Duncan Hudson" <duncan.hudson@us.gases.boc.com>
Subject: Re: PERL to Oracle
Message-Id: <33A9D4ED.17CA@tibinc.com>

C. Duncan Hudson wrote:
> 
> I have a need to read a file off a Windows NT machine and update an Oracle
> 7 (also NT) database from the records contained in the file.  Is this
> something that I can do with PERL, without having to buy canned software?
> If so, how would I go about doing it?  Thanks in advance,
> 
> C. Duncan Hudson
> duncan.hudson@us.gases.boc.com

On NT, you can use Win32 Perl to read the input file and then use SQL
INSERTs to load the Oracle database via ODBC with Win32::ODBC module.

Useful URLs for Win32 Perl (NT Perl)
------------------------------------
Win32 Perl for Windows NT:
    http://www.activeware.com/    [also online web pages]
    http://www.perl.com/CPAN/ports/win32/Perl5/

Searchable Archive for Perl-Win32-users Mailing List:
    http://www.divinf.it/perl-win32/index.sht
    (Does not include messages for last 2 to 3 months.)

Evangelo's Frequently Asked Questions (FAQ):
    http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html

Database access via ODBC by Dave Roth's Win32::ODBC module:
    Win32::ODBC Home Page with Online Documentation:
        http://www.roth.net/odbc/
    Also see FAQ for database questions.

    Download from:
        http://www.perl.com/CPAN/authors/Dave_Roth/

CPAN has Win32 specific modules at:
    http://www.perl.com/CPAN/modules/by-category/
and follow category 22 for Windows.

Note:  These URLs also point to other Win32 Perl resources.

-- Bill
-----------------------------------------------------------------------
Bill Cowan <billc@tibinc.com>    Voice:919-490-0034   Fax:919-490-0143
Tiburon, Inc./3333 Durham-Chapel Hill Blvd Suite E-100/Durham, NC 27707


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

Date: 19 Jun 1997 18:17:50 GMT
From: pjscott-remove-to-email@euclid.jpl.nasa.gov (Peter Scott)
Subject: print "Hi", last ...
Message-Id: <5obt4e$lh4@netline.jpl.nasa.gov>

So I wanted to write something like

	warn "Syntax error\n", next if $foo;

but even I knew that there would be problems since warn expects a
list :-)  I know that the way to handle this is do { warn; next; } if.
However, what did happen with the above (5.003, SunOS 4.1.3) surprised me.
The following code:

	while (1) {
		print "Yes\n", last if 1;
		print "No\n";
	}
	print "Done\n";

prints "Done".  So how can it execute the "last" but not execute the
"print"?  It looks to me as though it should execute the print, evaluate
each argument, one of which is "last", and then print what's left.
I don't see why jumping out of a control loop should cause it to throw
away the arguments to "print".  Still learning this stuff...

-- 
This is news.  This is your      |  Peter Scott, NASA/JPL/Caltech
brain on news.  Any questions?   |  (Peter.J.Scott at jpl.nasa.gov)

(Sorry for making email respondents edit the To: header - the spam
 is just too bad otherwise.)

Disclaimer:  These comments are the personal opinions of the author, and 
have not been adopted, authorized, ratified, or approved by JPL.


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

Date: Thu, 19 Jun 1997 18:11:39 -0600
From: Maelstrom <maelstrom@deathsdoor.com>
Subject: reading end-of-line in a string
Message-Id: <866761489.31379@dejanews.com>

Hi. I've just downloaded a Perl script that converts form input from the
WWW into Email.  The problem is that the field 'comments' which is
submitted from a text box is printed as one long string. Does anyone
know how to catch end-of-line characters in a string returned from a form?
 Eventually I'd like to frame the text and perform other manipulations on
the string.

Thanks
--Maelstrom
"LOOK AT MEEEEE!!!! I'm a forced metaphor
making a profound philosophical statement."
sammie@world.std.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Thu, 19 Jun 1997 16:49:44 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Reading from STDIN pipe & Keyboard
Message-Id: <EC182x.BJD@bcstec.ca.boeing.com>

In article <33a8aa37.0@news.intnet.net>,
Ronald Klimaszewski <microsys@IntNet.net> wrote:
 > Is it possible to send a bunch of info/data to a Perl script via stdin,
 > then, after all info is sucked
 > in, get addt'l info from the keyboard?
 > 
 > ie:  Call the script like the following:
 > -     script.pl <
 > -     line1
 > -     line2
 > -     line3
 > 
 > In the script, have a loop:
 > 
 > ** START OF PSEUDO-SCRIPT **
 > while (<>) {
 > do stuff until no more from pipe
 > }
 > 
 > use getch from Curses library to retrieve from keyboard
 > ** END OF PSEUDO-SCRIPT **
 > 
 > I've not been able to successfully to this.  I've tried both the while(<>)
 > and open(INPUT,stdin)
 > commands, but to no avail.
 > 

Perhaps this'll work after the pipe's been drained:

open(TTY,"+</dev/tty") or die "open: $!";


HTH,
--
Charles DeRykus
ced@carios2.ca.boeing.com


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

Date: Thu, 19 Jun 1997 15:46:09 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: bret bailey <bretb@engr.sgi.com>
Subject: Re: recursive
Message-Id: <Pine.SGI.3.96.970619154532.15159A-100000@davinci.bergen.org>

>I'm writing a simple script to calculate the size of my website. How do
>I make it work recursively?

I know how to... email me back, as I don't have the script to do it with
me at the moment...

I use it to make a search engine...

----------------
| "Here we are now, entertain us!"
| 	- Nirvana
----------------
Jeff "TechMaster" Pinyan | http://www.bergen.org/~jefpin
HTML/CGI Designer and Consultant and JavaScripter
jefpin@bergen.org | TechMasterJeff@juno.com | TechMasterJeff@usa.net
Got a JavaScript/CGI/Perl question or problem?  Let me know!



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

Date: Thu, 19 Jun 1997 16:21:29 -0700
From: Scott Crumpton <scott@moriah.com>
Subject: Rounding a Random Number
Message-Id: <33A9BEF9.3DD0@moriah.com>

I'm trying to get a random item from a list.

I created the code below but I since it gets the random number before it 
gets rounded to the integer I think there are too many number to choose 
from making it not truly random.

ie. Instead of picking a number from 0 to 4 it can choose a number from 
something like 0.000000000000001 to 4.9999999999999 which makes for a 
whole lot more numbers. It seems to me this would effect the random 
calulation a bit.

@list = (zero, one, two, three);
$r = $list[int(rand(@list))];

Thanks for any and all help.

scott@moriah.com  #shh, don't tell the spammers


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

Date: 19 Jun 1997 15:22:13 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Script to verify email addresses?
Message-Id: <m367va6xnu.fsf@windlord.Stanford.EDU>

In comp.lang.perl.misc, John Strange <jstrange@imtn.dsccc.com> writes:

> You could ask the SMTP deamon to check the address.  Check RFC 821 for
> commands.

And many sites have that turned off, so this too is not a solution.  Just
try checking to see if eagle@windlord.stanford.edu is a valid address:

windlord:~> telnet windlord.stanford.edu 25
Trying 36.21.0.44...
Connected to windlord.stanford.edu.
Escape character is '^]'.
220 windlord.Stanford.EDU ESMTP
expn eagle
502 Sorry, we do not allow this operation
vrfy eagle
252 Cannot VRFY user; try RCPT to attempt delivery (or try finger)
quit
221 windlord.Stanford.EDU closing connection
Connection closed by foreign host.

Nor does finger work:

eyrie:~> finger eagle@windlord.stanford.edu
[windlord.stanford.edu]

eyrie:~> finger asdfasdfasdf@windlord.stanford.edu
[windlord.stanford.edu]

eyrie:~> 

There's only one way to see if an address is valid, and that's to send
mail to it and see if it bounces.  And even that doesn't always work.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Thu, 19 Jun 1997 23:32:55 +0300
From: Lauri Laakso <lauri@samoilu.net>
Subject: Search all /home2/user/WWW/index.htm(l)
Message-Id: <33A99777.6B4B@samoilu.net>

I need some help to get all users index.htm or index.html files which 
are located at /home2/[user]/WWW/index.html

If file /home2/[user]/WWW/index.htm or /home2/[user]/WWW/index.html
does exists, I want to open that file and get 
<TITLE>This text here without tags</TITLE>

Please email or I may miss it.

Thanx!

 ...................................................................
 Lauri Laakso  -  Nettipaja Ky -  GSM: 358+40-588 8889 [EMAIL2GSM]
      http://www.samoilu.net/  -  mailto:lauri@samoilu.net


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

Date: Fri, 20 Jun 1997 00:00:19 GMT
From: malch@malch.com (Malcolm Hoar)
Subject: SOCKS5 and Perl 5
Message-Id: <5och6h$ohd$1@nntp1.ba.best.com>

I've tried tha man pages, FAQ, Alta Vista, Infoseek, Hotbot, DeJaNews,
greping libwww et al.

Can anyone provide any clues/references for getting Perl 5 to work with
SOCKS5?

More specifically, can I use 'runsocks' as a "wrapper"? Perl (5.004)
was built with the Socket library loaded dynamically (FreeBSD 2.1.5).

I also found a reference to a SOCKS Module but I can't find it in CPAN
or through any of the major search engines.

Alternatively, if I need to socksify Perl 5 itself, any clues?

I'd post more specific code and error messages but I've already
tried dozens of different configurations with more results than
you could shake a stick at :-(

TIA

[cc by mail appreciated - I've spent so much time on this, I'm
not gonna have much opportunity to lurk c.l.p.m for a day or three]





-- 
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Malcolm Hoar           "The more I practice, the luckier I get". |
| malch@malch.com                                     Gary Player. |
| http://www.malch.com/               Shpx gur PQN.                |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

Date: Thu, 19 Jun 1997 16:13:36 -0500
From: Wesley Miaw <wesley@woais.com>
Subject: Re: Sorting Associative Array? (Urgent)
Message-Id: <33A9A100.2952@woais.com>

<<
Your second line needs some cleaning up.  To the right of the equal
should be $hash{$key}, not %hash{$key}.
>>

Oops. It was late :(

<<
But your fundamental problem is
that you are copying elements one by one from %hash to
%key_sorted_hash.  There is nothing magic about %key_sorted_hash, so it
will be ordered in a "random" fashion (probably the same order as %hash,
but I don't know that for sure).  There is nothing sorted about this. 
The fundamental reason is that YOU CANNOT SORT HASHES. The definition of
a hash table doesn't allow ordering.

Wesley, sorry but the only real solution is John's solution, or a
variation on that theme.
>>

Yeah. My bad again. Sorry, I got confused with walking through a hash in
key order, and the fact that hashes by definition don't do sorting. :( I
shouldn't stay up till 4 in the morning anymore.
-- 
Wesley Miaw                               wesley@woais.com
World of Artists Internet Services        http://www.woais.com/
71 Middlesex Drive                        Tel: 518-439-0412
Slingerlands, NY 12159                    FAX: 518-439-9722


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

Date: 19 Jun 1997 16:57:38 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Unexpected -X filetest behavior
Message-Id: <m3vi3a5eod.fsf@windlord.Stanford.EDU>

no junk <no.junk@mail.thank.you> writes:

> There is no $ARGV[0] but (-e $ARGV[0]) returns a 1.  (-s $ARGV[0])
> returns the size of the current directory.  Perlfunc says if the
> argument is omitted, $_ is tested.  But when I print out $_, I get
> nothing (or at least nothing that will print).  Is this a default -X
> behavior question, something to do with $ARGV[0], or ...?

[snip]

> #! /usr/misc/bin/perl

>   print "\n \$ARGV[0] is: $ARGV[0]\n";
>   print " \$_ is: $_\n";

>   print " -e \$ARGV[0] returns:",(-e $ARGV[0]),"\n";
>   print " -s \$ARGV[0] returns:",(-s $ARGV[0]),"\n";
>   print " -z \$ARGV[0] returns:",(-z $ARGV[0]),"\n";

>   (-e $ARGV[0]) || die "\nFile '$ARGV[0]' not found. \n\n";

> Here are the results:

> 1.    % my_code

>          $ARGV[0] is:
>          $_ is:
>          -e $ARGV[0] returns:1
>          -s $ARGV[0] returns:1536     (size of current dir, per ls -l)
>          -z $ARGV[0] returns:

Here are my results with the same script:

windlord:~> ./test.prog

         $ARGV[0] is: 
         $_ is: 
         -e $ARGV[0] returns:
         -s $ARGV[0] returns:
         -z $ARGV[0] returns:
        
        File '' not found. 

windlord:~> perl -v

This is perl, version 5.004_01

My guess is that you're using too old of a version of Perl.  Try upgrading
to the latest release (currently 5.004_01), available from CPAN.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Thu, 19 Jun 1997 21:51:17 GMT
From: beryte@leb.net (beryte)
Subject: Re: Use and code in 2 files
Message-Id: <33a9a99d.7631744@news.telecom.at>

umm, you need to add 1; at the end of the test.conf file.
mea culpa
beryte

On Thu, 19 Jun 1997 01:15:47 GMT, beryte@leb.net (beryte) wrote:

>
>On 18 Jun 1997 22:17:11 GMT, ez041407@boris.ucdavis.edu (Eric Finley)
>wrote:
>
>>I would like to put my code in 2 different files as it is getting to be
>>really long.  I looked at
>>www.perl.org/CPAN/doc/manual/html/pod/perlmod.html for help and used the
>>template given there and then started to snip out the things that I don't
>>think I really need/want.
>
>> All I reall want to do is be able to call a
>>function in a different file.
>
>if this is your only wish, I would go for that oldy but still
>effective method.
>
>   Script1: test.conf
>
>	sub HTMLHeader{
>	    return "Content-type: text/html\n\n";
>	 }
1;

>
>   Script2: test.pl
>
>	#!/path/to/perl
>	require '/full/path/to/test.conf'; 
>	print &HTMLHeader;
>	print "Hello there!";
>	exit;
>
>
>again, only if you are just thinking in spliting your code...
>
>beryte
>



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

Date: Thu, 19 Jun 1997 22:14:06 GMT
From: shelle@interaccess.com (Shelle)
Subject: Re: WANTED: perl script for base64 MIME decoding
Message-Id: <5ocave$o4_006@interaccess.interaccess.com>

Josin Alvistur <josin@dimensional.com> wrote:
>would appreciate pointers on how to get one.
>
>searched the web, but only found C versions.
>
>thanks - josin

ftp://ftp.is.co.za/programming/perl/CPAN/modules/by-module/MIME/

               files:             MIME-Base64-2.01.readme
                                    MIME-Base64-2.01.tar.gz

Or of course from any of the other CPAN Mirrors....

Michelle ----,-'-(@

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Michelle Feigen      ----,-'-(@      shelle@interaccess.com
                     MEAN PEOPLE SUCK!    
          http://homepage.interaccess.com/~shelle/
       http://homepage.interaccess.com/~shelle/grafx/       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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