[7013] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 638 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 20 04:17:54 1997

Date: Fri, 20 Jun 97 01: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           Fri, 20 Jun 1997     Volume: 8 Number: 638

Today's topics:
     Re: Can't find *** in @INC ....Help Please (Shelle)
     Re: Case-matching substitution? <jefpin@bergen.org>
     Re: Case-matching substitution? <stuartc@ind.tansu.com.au>
     Re: Debugging tutorial? <billc@tibinc.com>
     Delete specific element from list <cmason@ros.res.cmu.edu>
     Error msg <joshua@midwest.net>
     follow in File::Find <tlaporte@dreamworks.com>
     Re: How do you make a perl script jump to another URL?? (Joshua J. Kugler)
     Re: Linux,glibc-2,perl-5.004_1: make test fails (Andreas Steffan)
     Re: LOG base 10  operator <stuartc@ind.tansu.com.au>
     Looking for some cgi gurus (Zach Keith)
     Re: Perl 5 regexps as independant package? (Tad McClellan)
     Perl 5.004 make test failed on Solaris 2.4 (socket & ud (John Rector)
     Perl and Access <ordax@ibm.net>
     perl extentions with C++ code <shlomoa@iil.intel.com>
     pointer to CLib and #line-numbering xsubpp (John Tobey)
     Problem with Text::Wrap? (Joshua J. Kugler)
     Re: Script to verify email addresses? <"nobody"@[127.0.0.2]>
     Re: set-u-id perl script <rra@stanford.edu>
     Re: Splitting a variable containing filename and extens <keys@babylon5fan.corn>
     Testing for the non-existence of a variable. (Joshua J. Kugler)
     Re: TIMING EXPERIMENT <stuartc@ind.tansu.com.au>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 20 Jun 1997 07:29:00 GMT
From: shelle@interaccess.com (Shelle)
Subject: Re: Can't find *** in @INC ....Help Please
Message-Id: <5odbfs$3nc_002@interaccess.interaccess.com>

jlguru@cris.com wrote:
>Shelle wrote:
>> 
>> 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 ##.
> 
>I've read some other responses to this question, and they probably are
>correct. However, whenever I get this error (w/ either Win95 or WinNT
>4.0), I immediately check the registry entries for
>perllib/perlbin/perldoc. It seems the installation from Activeware
>doesn't properly set these values. Look under
>HKEY_LOCAL_MACHINE\SOFTWARE\Activeware\Perl5 and point the values to the
>correct subdirectories. If you are not using Activeware's stuff, look
>under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Resource Kit\Perl5 and do
>the same thing.

Jerry:

Thanks for the reply and if you've already read here, I found the following to 
be the only method of correcting this problem that worked for me:

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

All of my registry entries were good as gold; Go figure.  :)

I'm on a Windows 95 (rev. b) O/S and I've noticed it does indeed handle some 
programs differently than the original Windows 95 release.  No, I don't know 
if that has anything at all to do with it, but I can't find any other reason 
for this Perl "wackiness" at present.

As with all of the other replies I got, I thank you for your time and 
assistance.

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 22:20:54 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: William C Ralph <ralphwc@mail.auburn.edu>
Subject: Re: Case-matching substitution?
Message-Id: <Pine.SGI.3.96.970619221830.19532A-100000@davinci.bergen.org>

$text = <STDIN>;
$find = "cat";
$replace = "feline";
$lowercaseText = $text;
$lowercaseText =~ tr/A-Z/a-z/;
$lowercaseText =~ s/$find/$replace/g;

That should work for you...

----------------
| "She turned me into a newt... I got better."
| 	- John Cleese (Monty Python)
----------------
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: 20 Jun 1997 13:29:15 +1000
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: Case-matching substitution?
Message-Id: <yeok9jqdkac.fsf@parakeet.ind.tansu.com.au>

ralphwc@mail.auburn.edu (William C Ralph) writes:

> 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

Here's one <shocking looking and probably bad> way to do it:

Algorithm:

  match " cat " ignoring case; remembering c|C and a|A
  cat -> feline, CAT -> FELINE, Cat -> Feline
  if string starts with Ca -> Cat
  if string starts with CA -> FELINE
  else (string starts with c) -> cat

Code:

#! /usr/local/bin/perl -w
$phrase="The scat cat sat on the Cat Mat as the CAT moved overhead";
$phrase =~ s{ (c)(a)t }{
    (($1 eq 'C') && ($2 eq 'a')) ? " Feline " :
	(($1 eq 'C') && ($2 eq 'A')) ? " FELINE ": " feline ";
    }gei;
print "$phrase\n";

About the confusing s/ cat / stuff / gei line:
The e in gei says to evaluate stuff as an expression. Here, stuff is an 
expression that evaluates to "Feline","FELINE" or "feline" accordingly.

  I daresay there's something already in Perl or a package to do this stuff
better; but meanwhile the above is one way of doing it.

Stuart Cooper
stuartc@ind.tansu.com.au


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

Date: Thu, 19 Jun 1997 21:40:24 -0400
From: Bill Cowan <billc@tibinc.com>
To: Michael Schuerig <uzs90z@uni-bonn.de>
Subject: Re: Debugging tutorial?
Message-Id: <33A9DF88.6A9B@tibinc.com>

Michael Schuerig wrote:
> 
> Chris Oke <coke@adrenalin.com> wrote:
> 
> > http://www.panix.com/clay/perl/ has a section on debugging.
> 
> Very good indeed. What I had in mind, though, was a tutorial on using
> the debugger. Any recommendations?
> 
> Michael
> 

For a simplistic answer...

To me, the revised perldebug doc is much better than previous version.
Much easier to read and more complete! Ditto for new Camel book. 

I suggest grabbing the debugger doc and trying the different debugger
commands on a simple program at the command line. Also remember that you
can do "perl -de 0" to try simple things.

-- 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: 20 Jun 1997 05:31:19 GMT
From: Chris Mason <cmason@ros.res.cmu.edu>
Subject: Delete specific element from list
Message-Id: <5od4j7$50o@news.onramp.net>

All-

	This is frustrating.  I'm trying to write a subroutine to delete a
specific element in a array.  It would work like:

	@arr = qw(red green blue yellow);
	
	listdel(@arr, 'blue');
	
	# @arr = ('red', 'green', 'yellow');

	
	
I thought of something like:
	
	sub listdel {
		local (@arr, $del) = @_;
		for (@arr) {
			push @new shift @arr unless ($_ eq $del);
		}
		@arr = @new; 
	}

but I know that isn't right.

Thanks for any help.  I know this is really simple, and that's why its
making me mad.

-c

--
Chris Mason   --   <cmason@ros.res.cmu.edu>   <http://ros.res.cmu.edu/>
"We have to go. I'm almost happy here." "So stay." "I've lived too long
 with pain. I won't know who I am without it." -O.S.Card,_Ender's_Game_


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

Date: Fri, 20 Jun 1997 00:44:41 -0500
From: "Joshua Frank" <joshua@midwest.net>
Subject: Error msg
Message-Id: <01bc7d3c$ed0886c0$55d21bce@behb>

if($tot <= 38)
{
	print "Content-type: text/html\n\n";
	print "<html>";
	....
	....
	....
}
Perl says that there's something wrong next to "print" it said syntax
error.
Am I doing somthing stupid and missing somthing simple or what?


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

Date: Thu, 19 Jun 1997 17:41:09 -0700
From: Tom La Porte <tlaporte@dreamworks.com>
Subject: follow in File::Find
Message-Id: <33A9D1A5.41C6@dreamworks.com>

I wonder if anyone has modified the File::Find module to implement
the -follow option of find. I've tried to see how this might work,
but it seems a bit beyond my Perl knowledge.

Is there an easy way to build a list of files or directories, 
including followed symbolic links?

Thanks. -- Tom

-- 
"If I could dot the 'i' in a Michigan     Thomas A. La Porte
 game and the good lord came to take me   Archivist, Feature Animation 
 the next day ... at least I could        DreamWorks SKG
 die happy." - Beano Cook, ESPN           <tlaporte@anim.dreamworks.com>


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

Date: Fri, 20 Jun 1997 05:11:04 GMT
From: FIGHT-SPAMjkugler@inreach.com (Joshua J. Kugler)
Subject: Re: How do you make a perl script jump to another URL??
Message-Id: <33aa1051.33280265@news.inreach.com>

On Wed, 18 Jun 1997 18:02:51 -0400, "Lynn Kasdorf"
<lkasdorf@pressroom.com> wrote:

>I know that you can simply print:
>
>Location: http://my.new.url.html\n\n
>
>and as long as the current CGI has not already put out a text header, this
>will cause an instant jump. But I HAVE already put out a text header since
>I am creating dynamic HTML.
>
>The closest thing I have found is a library with a function called
>open_http() which will let you extract the contents of a web site. But
>nothing to simply go there!!
>

Try this:

<meta http-equiv=refresh
content="5;url=http://place.url.here/and/directory">

This goes in the html file, and replace the 5 with the number of
seconds you want to wait before retrieving the new URL.  For an
instant transfer, use 0.

For an example of this in action, go to the URL in my signature, it
will then take you to my real homepage.



Joshua J. Kugler
Computer Consultant--Web Developer
Real e-mail address spelled out to prevent spam. jkugler at inreach dot com
http://www.cwebpages.com/jkugler
Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!
- - - - -
To reply via e-mail, please remove 'FIGHT-SPAM' from my e-mail address. Thanks.


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

Date: 20 Jun 1997 09:26:43 +0200
From: deas@rrz.uni-hamburg.de (Andreas Steffan)
To: Andreas Jaeger <aj@arthur.rhein-neckar.de>
Subject: Re: Linux,glibc-2,perl-5.004_1: make test fails
Message-Id: <5odbbj$1pj$1@mortimer.deas.org>

In article <u8hgevk8ks.fsf@arthur.rhein-neckar.de>,
	Andreas Jaeger <aj@arthur.rhein-neckar.de> writes:

> At least one did it. :-).

> > PS: Linux-2.0.29,glibc-2.0.3,perl-5.004_1,gcc-2.7.2.2-glibc

> Please send the output of ldd /usr/bin/perl (or wherever perl lives on 
> your system) and of perl -V. perl should compile without problems with 
> glibc, there's nothing unusual in your configuration.

  deas@mortimer:/home/deas/src/perl5.004_01> ldd perl
  	  libnsl.so.1 => /lib/libnsl.so.1 (0x40003000)
  	  libdb.so.2 => /usr/lib/libdb.so.2 (0x40008000)
  	  libdl.so.1 => /lib/libdl.so.1 (0x40018000)
  	  libm.so.6 => /lib/libm.so.6 (0x4001b000)
  	  libc.so.6 => /lib/libc.so.6 (0x40034000)
  	  /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
  	  libcrypt.so.1 => /lib/libcrypt.so.1 (0x400d2000)
  deas@mortimer:/home/deas/src/perl5.004_01> ./perl -V
  Summary of my perl5 (5.0 patchlevel 4 subversion 1) configuration:
    Platform:
      osname=linux, osvers=2.0.29, archname=i586-linux
      uname='linux mortimer 2.0.29 #2 sun jun 8 17:29:54 met dst 1997 i586 unknown '
      hint=previous, useposix=true, d_sigaction=define
      bincompat3=y useperlio= d_sfio=
    Compiler:
      cc='gcc', optimize='-O2', gccversion=2.7.2.2
      cppflags='-g -Dbool=char -DHAS_BOOL -I/usr/local/include'
      ccflags ='-g -Dbool=char -DHAS_BOOL -I/usr/local/include'
      stdchar='char', d_stdstdio=define, usevfork=false
      voidflags=15, castflags=0, d_casti32=define, d_castneg=define
      intsize=4, alignbytes=4, usemymalloc=n, randbits=31
    Linker and Libraries:
      ld='gcc', ldflags =' -L/usr/local/lib'
      libpth=/usr/local/lib /usr/lib
      libs=-lnsl -lgdbm -ldbm -ldb -ldl -lm -lc -lposix -lcrypt
      libc=, so=so
      useshrplib=false, libperl=libperl.a
    Dynamic Linking:
      dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags='-rdynamic'
      cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
  
  
  Characteristics of this binary (from libperl):
    Built under linux
    Compiled at Jun 19 1997 09:18:49
    @INC:
      /usr/lib/perl5/i586-linux/5.00401
      /usr/lib/perl5
      /usr/lib/perl5/site_perl/i586-linux
      /usr/lib/perl5/site_perl
      .
  deas@mortimer:/home/deas/src/perl5.004_01>

As I mentioned, 'perl t/harness' dies segfaulting, so I added '-g' to
the cflags.
This is the output from gdb:

  Working directory /home/deas/src/perl5.004_01
   (canonically /usr/src/perl5.004_01).
  (gdb) file perl
  Reading symbols from perl...done.
  (gdb) run t/harness
  Starting program: /home/deas/src/perl5.004_01/perl t/harness
  
  Program received signal SIGSEGV, Segmentation fault.
  0x40024ec9 in _dl_fdprintf ()
  (gdb) bt
  #0  0x40024ec9 in _dl_fdprintf ()
  #1  0x40024ece in _dl_fdprintf ()
  #2  0x40024ece in _dl_fdprintf ()
  #3  0x40024ece in _dl_fdprintf ()

[ a few thousand more lines of the same output chopped ]

Any hints ?

BTW: I'd appreciate if you could send me your configuration, if you
still have it.
-- 

		       
                           Thanks Andreas

PS: Please also reply via email.

+-----------------------------------------------------------------+
| Andreas Steffan		    email: deas@rrz.uni-hamburg.de|
| Hamburg, Germany                                                |
+-----------------------------------------------------------------+
finger p25a003@server2.rrz.uni-hamburg.de for PGP-public-key.


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

Date: 20 Jun 1997 11:49:13 +1000
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: LOG base 10  operator
Message-Id: <yeolo46dox2.fsf@parakeet.ind.tansu.com.au>

log and ln
Larry D'Anna <ldanna@ix.netcom.com> writes:

> M.J.T. Guy wrote:
> 
> > Larry D'Anna  <ldanna@ix.netcom.com> wrote:
> > >
> > >10 ** 1 = 10
> > >therefore
> > >log(10) = 1
> >
> > Not in my perl, it ain't:
> >
> > print log(10)
> >
> > gives
> >
> > 2.30258509299405
> >
> > Mike Guy
> 
> DOH!!
> 
> Now I feel really stupid :-)
> 
> why can't they just call the silly thing ln???
> 

  log-base 10 is really a convenience; most log calculations (should be/are)
done log-base e. Hence, Perl is right to have just one function and call
it log.

  IMHO, for a maths person; log *always* equals log base e. ln is mainly
a calculator button and a tribute to Napier. For computer people; log
is often most useful base 2.

  In C; which Perl seems to follow as much as possible in these questions;
there is log() and log10(). So the only thing Perl didn't do was also
have a log10() but you can write your own as we all know by now. Quick
reminder:

  log10(a) = log(a) / log(10)

  The other reason (besides same-namedness with C) that it's log and not ln
is that you will never call your file handles, variables etc ln. Whereas
it's possible to do

  open (log, "outfile.log") or die "Cannot open outfile.log\n";
  print log whatever

  and get yourself into horrible trouble when Perl computes log instead
of logging to the file. This amusing problem would not crop up if it was
called ln. :-}

My opinions on naming:

Good- log() = log base e (Perl)
Better- log() = log base e, log10()= log base 10 (C)
Best?- log() = log base e, log10() = log base 10, log2() = log base 2
BAD- log() = log base 10, ln() = log base e (calculators, suggested)

Stuart Cooper
stuartc@ind.tansu.com.au


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

Date: Fri, 20 Jun 1997 04:11:38 GMT
From: bartendar@hotmail.com (Zach Keith)
Subject: Looking for some cgi gurus
Message-Id: <33aa02ee.23542552@nntp.cts.com>

WebTemps, Inc.(www.webtempsinc.com), a leader in the placement of web
page designers, offers part-time and full time jobs in which employees
can work either from home or at the employers' location.  If you are
tired of creating web pages as just a hobby, now is your opportunity
to get paid for it!  If you have web page design knowledge and would
like to obtain work in this area, you must submit a resume to us.  We
are always serving both the employee and the employer!!
----------------- WebTemps, Inc.
------http://www.webtempsinc.com
Employment agency that specializes in the placement of web page designers, developers, graphics artists and www programmers.  We provide all sorts of web related positions around the world. You can even work from your own home.  Free for the employee.


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

Date: Thu, 19 Jun 1997 20:21:57 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Perl 5 regexps as independant package?
Message-Id: <lvlco5.b96.ln@localhost>

Chris Thompson (cet1@cus.cam.ac.uk) wrote:
: Is there an independant package implementing perl5-style regular 
: expressions that could be incorporated in other programs? 


What language do you need it in?

I have a reference around here somewhere for two Java packages
that are supposed to do Perl 5 style pattern matching...


: It doesn't
: seem to be easy to make one out of the perl5 source itself.


Oh, maybe you want C then?


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: 20 Jun 1997 01:35:49 GMT
From: jar@next3.jpl.nasa.gov (John Rector)
Subject: Perl 5.004 make test failed on Solaris 2.4 (socket & udp)
Message-Id: <5ocmpl$1dr@netline.jpl.nasa.gov>

Perl 5.004 make test failed on Solaris 2.4 in the following two cases: 

lib/io_sock.......No such file or directory at ./lib/io_sock.t line 29.
FAILED on test 1

lib/io_udp........Can't call method "sockname" without a package or object 
reference at ./lib/io_udp.t line 35.

Looking at the source for the socket test shows us to be at:

$listen = IO::Socket::INET->new(Listen => 2,
                                Proto => 'tcp'
                               ) or die "$!";

Does anyone know what this means? Thanks.



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

Date: Sat, 21 Jun 1997 08:23:54 +0200
From: "Josi Miguel Ordax Cassa" <ordax@ibm.net>
Subject: Perl and Access
Message-Id: <33AB737A.143CEBA4@ibm.net>

How can I work with an Access DataBase and Perl. Please, can you show me

the most simple source code to open, close, read, and write into de
DataBase?

Thanks in advance.



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

Date: Sun, 15 Jun 1997 11:40:33 +0300
From: Shlomo Anglister <shlomoa@iil.intel.com>
Subject: perl extentions with C++ code
Message-Id: <33A3AA81.3F54@iil.intel.com>

Hi
I need to load in ( dynamically ) C++ compiled code.
I wrote an extention using C++ code.
I wrapped the C++ code with C functions with standard C calls.
I encountered some problems one of which was that file streams were
corrupted and caused a segmentation fault.
I am running it on HP9000 and RS6000 Any information is more then
welcome.
-- 
Shlomo Anglister
IDC ATHENA group       Mail stop : IDC-4C
Phone: 972-4-8230835 ( Home  ) 972-4-8656056 ( Intel )
http://www.iil.intel.com/~shlomoa


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

Date: 20 Jun 1997 00:20:19 +0000
From: jtobey@user1.channel1.com (John Tobey)
Subject: pointer to CLib and #line-numbering xsubpp
Message-Id: <m3iuzam8fw.fsf@localhost.user1.channel1.com>

Hi all,

You will find in ftp.channel1.com:/pub/users/jtobey/Perl the following
two files:

CLib-0.11.tar.gz - a module that allows perl to call C functions in
dynamic libraries on the fly.  Successes to date: i586-linux,
i586-freebsd, sun4-solaris, sun4-sunos.

xsubpp - a version of the XSub preprocessor that correctly inserts
#line directives.

I'd be especially interested to know if these work on non-Unix
systems.  In the case of CLib, results on non-Intel-based Unix would
also be of interest.

To test CLib on a new OS, try the following:

gzip -dc CLib-0.11.tar.gz | tar xvf -
cd CLib-0.11
perl Makefile.PL DECL=cdecl
make test

If the module builds but test fails, you can try the following;
however I don't recommend doing `make install' afterwards, since the
result will contain alpha-quality code:

perl Makefile.PL DECL=hack30
make test

Thank you
-John

ps, Pardon my earlier binary posting, a friend has kindly pointed out
that this is not that kind of newsgroup.


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

Date: Fri, 20 Jun 1997 05:37:18 GMT
From: FIGHT-SPAMjkugler@inreach.com (Joshua J. Kugler)
Subject: Problem with Text::Wrap?
Message-Id: <33aa16ab.34906759@news.inreach.com>

[Note, this is the second (I think) time I have posted this.  My ISP's
newserver has been acting up, so I don't know if this every got
out/got any responses.  Thanks for you patience]

I am using Text::Wrap to wrap some text that is coming from a
form <textarea>  My problem is this: when ever I send the text through
the wrap sub, it comes out with the last word of the text area on a
line of it's own, even though it shouldn't be wrapped.

I tried $text=~ s/\n$/ / but it will not strip the final \n, no
matter what I do.  Has anyone else had this problem?  It is not
crucial, but it is annoying.  Has anyone come up with a fix?  Any help
would be great.

URLs would be fine.

Please respond via e-mail too.

Thanks!

j----- k-----



Joshua J. Kugler
Computer Consultant--Web Developer
Real e-mail address spelled out to prevent spam. jkugler at inreach dot com
http://www.cwebpages.com/jkugler
Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!
- - - - -
To reply via e-mail, please remove 'FIGHT-SPAM' from my e-mail address. Thanks.


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

Date: Fri, 20 Jun 1997 00:32:41 -0700
From: Vlad Petersen <"nobody"@[127.0.0.2]>
Subject: Re: Script to verify email addresses?
Message-Id: <5odbv5$lsr$1@neptune.uniserve.com>

Russ Allbery wrote:
 .......
> 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.

Exactly. Especially if Lotus mail-crapware of misconfigured Exchange
is at the host where you're trying to email a recipient at. I tried
to email a person on a very important subject but couldn't get any
replies. Eventually, after 8 tries I made a long distance call just
to find out that his email address has changed yet not a single
email message bounced from their idiotic NT server to inform me of
the error and they didn't even know about it until I called. Then next
night I had a nightmare: I was a pilot cool-bloodedly dropping a
bomb on Microsoft building in Redmond and then chasing Bill Gates
on the streets with a machine gun. On the gun handle was written:
"Pow(d)ered by Unix" and each bullet had a stamp: "Designed for MS
Windows". I don't remember if I got Gates or not though..

-- 
My real email address is:       <vladimip @ uniserve dot com>
#include <disclaimer.h>  |     *Good pings come in small packets*
       Vancouver         |     Windows: for IQs smaller than 95
   British Columbia      | SIGSIG -- signature too long (core dumped)


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

Date: 19 Jun 1997 17:06:55 -0700
From: Russ Allbery <rra@stanford.edu>
To: yfwang@cs.ucsb.edu (Yuan-fang Wang)
Subject: Re: set-u-id perl script
Message-Id: <m3n2om5e8w.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

Yuan-fang Wang <yfwang@cs.ucsb.edu> writes:

> However, the same script which runs fine as WWW developed problems when
> runs as me through the above set-u-id mechanism. I traced the problem to
> a line which says:

> $date = `date`;

> In fact, any line which use `` (backquote) does work. I suspect this
> might be some protection problem. Any one has any experience with this
> problem?

Did you read man perlsec before developing CGI programs that run setuid?
That would be a good place to start.  I'm guessing you're probably getting
an insecure path dependency error, and that man page explains in detail
precisely how to solve that problem.

Another, probably better option is to never call the date command at all.
There's no need.  That line is almost precisely equivalent to:

        $date = localtime;

and localtime is a Perl built-in.  Why fork another process and have to
worry about tainting problems when you don't need to?  If you need more
complicated formatting, you can add a use POSIX; to your script and then
use strftime.

-- 
#!/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 16:12:13 -0600
From: Keys <keys@babylon5fan.corn>
Subject: Re: Splitting a variable containing filename and extension
Message-Id: <33A9AEBD.48D7BB28@babylon5fan.corn>

Keys wrote:
> 
> I am preparing to write a perl script that will have a variable defined
> with the form /filename.extension and I would like to extract from 

Update:  I am trying the following code to do this, but if anyone else
has a better idea, I would really like to hear it.  My concern is
filenames with non-three-letter extensions will not be parsed
correctly...

$path = $ENV{'PATH_INFO'};	#in the form /filename.ext
$file = substr $path,1;		#should be literal filename.ext
$name = substr $path,1,-4;	#should be literal filename
$type = substr $path,-3;	#should be literal ext

-- 
Keys
Spam sucks.  To reply, please change "corn" to "com" in my return
address...


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

Date: Fri, 20 Jun 1997 05:35:36 GMT
From: FIGHT-SPAMjkugler@inreach.com (Joshua J. Kugler)
Subject: Testing for the non-existence of a variable.
Message-Id: <33aa1583.34610604@news.inreach.com>

[Note, this is the second (I think) time I have posted this.  My ISP's
newserver has been acting up, so I don't know if this every got
out/got any responses.  Thanks for you patience]

Hello All.

I have written a few Perl5 scripts, and have had much success, but I
have run up against something that has me stumped.

I know you can test for the existence of a variable by using:

if ($var) {#code here}

But how can you test to see if $var is NOT defined?

I have tried

if not ($var), ifnot ($var), if !($var), and some I don't even
remember.

I know it is probably simple,  but I have looked everywhere I know in
the perldocs, and can't find anything to this effect.

Right now I am using 

if ($var) {} else {Code here}, but I know there has to be something
more elegant than that! :)

Any help is greatly appreciated.  Thanks!

URLs would be fine too.

Please respond to e-mail too.

j----- k-----

Joshua J. Kugler
Computer Consultant--Web Developer
Real e-mail address spelled out to prevent spam. jkugler at inreach dot com
http://www.cwebpages.com/jkugler
Every knee shall bow, and every tongue confess, in heaven, on earth, and under the earth, that Jesus Christ is LORD -- Count on it!
- - - - -
To reply via e-mail, please remove 'FIGHT-SPAM' from my e-mail address. Thanks.


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

Date: 20 Jun 1997 11:15:59 +1000
From: Stuart Cooper <stuartc@ind.tansu.com.au>
Subject: Re: TIMING EXPERIMENT
Message-Id: <yeon2omdqgg.fsf@parakeet.ind.tansu.com.au>

Randal Schwartz <merlyn@stonehenge.com> writes:

> >>>>> "John" == John D Mitchell <johnm@non.net> writes:
> 
> John> In article <EBtG27.uM@statcan.ca>, Mike Jeays wrote:
> >> -------------------------------------------------------T
> >> TIMING EXPERIMENT - C, JAVA, Visual Basic, PERL and TCL
> >> -------------------------------------------------------
> >> 
>> I tried a timing experiment to compare C, Java, Visual Basic, Perl and Tcl
> >> for a simple calculation-intensive task - generating the first n primes
> >> using the well-known Sieve of Eratosthenes.
> >> 
> >> The timings (in seconds) were as follows :
> >> 
> >> Number of primes |     C   Java  VBasic Perl    Tcl
> >> 2,000      |   0.2    0.9    2.0   4.0     41
> >> 10,000      |   1.6    6.8   14.0  33.0    355
> >> 20,000      |   3.7   16.7   34.0  85.0    885
> >> 100,000      |  25.0  139.5      # 786.0   5319*

  In Perl, you can easily format the results :-}

> 
> Good.  Next time I need some prime numbers, I'll know not to do it in
> Perl.  Big deal.  It probably wasn't even a fair algorithm (hint: if
> it used subscripts into an array, it wasn't fair).

  There are far better algorithms for calculating primes than the Sieve of
Eratosthenes. I think for example that it's quicker to count each x from 1
to n and say "am I prime?" for each x (provided your "am I prime" function is
suitably intelligent) My guess is the implementation discussed here used a
large array (100,000 in the worst instance) and crossed off multiples of
numbers; just like you do in the Sieve. It would almost certainly use 
array subscripts so by Randal's definition isn't Perl-fair.

  Of far more interest mathematically is the number of primes up to a given
number. Here's a good one: There are exactly 23000 primes less than 2**18
(2-to-the-18).

> 
> Now, here's a real-world task:
> 
> Create a web page that allows people to search the Internet Movie
> Database for movies by a particular director, and then get details on
> each movie.  The data itself is stored in a Sybase server.  Oh, yeah,
> and you have about 3 hours to finish.
> 
> Go!

  That's more like it. I much enjoyed the "Tatum O'Neil's Birthday" thread a
month or so ago; I felt it was a very Perl'ish answer to the problem!

> In summary, it doesn't matter how fast a computer gets an answer, if
> it gets the answer *later* (because of development time).

  Exactly. That's why most of us don't program in assembler anymore.

John> Of course, if you're wanting to write "applets" your only choices out of
> John> that list are Java & Tcl.
> 
> Not at all.  Penguin allows the Perl-TK browser to run digitally
> signed "perl-applets" in a "safe" area.  And unlike Java, it's all
> free (as in, unencumbered by costs or licensing restrictions).  And
> unlike TCL, Perl has *real* datatypes.
> 
  I've only played briefly with TCL; and only then because expect is
such a winner. Comm.pl is almost usable to my satisfaction, and will get
there eventually; then I can avoid TCL altogether. Trying to manipulate 
strings, arrays etc in TCL is interesting; TCL primitives are certainly that.
I remember a paper ages ago by Richard Stallman about 'why you should not
use TCL'; the answer nowadays I think is '..because you should use Perl'

Stuart Cooper
stuartc@ind.tansu.com.au


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

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

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