[7080] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 705 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 7 23:17:53 1997

Date: Mon, 7 Jul 97 20:00:23 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 7 Jul 1997     Volume: 8 Number: 705

Today's topics:
     Re: 12 FREE Perl Scripts... <webmaster@stepweb.com>
     C to Perl.... (Michael Lauzon)
     can perl get https pages? <kuznia@sipi.usc.edu>
     Re: Can't Print After &ReadParse <jeff@webdesigns1.com>
     Re: control characters in <TEXTAREA> boxes <rootbeer@teleport.com>
     Re: delete line in file directly(fixed length record) (felix k sheng)
     Re: File locking problem... <rootbeer@teleport.com>
     Re: GIFgraph.pm or finance scripts <zenin@best.com>
     Re: help: match empty line (Tung-chiang Yang)
     Installing libwww-perl-5.10 on perl 5.004_01 fo NT - pr (Jamie O'Shaughnessy)
     Re: Memory problem with reading file (Ilya Zakharevich)
     Re: Perl: deleting spaces etc in strings (Even Holen)
     Re: please add this to the warning list for perl code <rootbeer@teleport.com>
     Re: Problem with pack() and unsigneds <rootbeer@teleport.com>
     relocation error and msqlperl jloh@futon.sfsu.edu
     Re: SIGCHLD handler not being called consistently (Charles DeRykus)
     simple -e file ? (Geoffrey Hebert)
     Re: stat of files on NFS filesystems in Solaris <rootbeer@teleport.com>
     Re: Tainted problem <rootbeer@teleport.com>
     Re: using wildcards with system()- Help Requested (Eric Bohlman)
     Re: What does this do? <admin@no-spam-chathub.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 8 Jul 1997 09:55:14 GMT
From: webmaster <webmaster@stepweb.com>
Subject: Re: 12 FREE Perl Scripts...
Message-Id: <ECyyCx.n24@nonexistent.com>

Jeremy D. Zawodny wrote:
> 
> On Fri, 4 Jul 1997 01:40:45 GMT, webmaster <webmaster@stepweb.com>
> wrote:
> 
> >Hi everybody,
> >
> >We have written written 12 Perl Scripts that
> >can be used by any personal website for FREE.
> 
> Great.
> 
> >           http://www.stepweb.com
> >
> >Pay us a visit, but please remember that our
> >entire website is under construction.
> 
> Then why advertise it?  why not spend a few hours getting it done and
> then letting the world to know?  Wouldn't we have a better perception
> of what you're about?

 We don't advertise our website, but we do want let people
know about our scripts. We just wanted to let everybody know
that there might be sections not completed, or that demo's
of the scripts might not always be there, etc... but we
focus more on the scripts... enjoy them, they're free!

 Sincerely,

   webmaster


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

Date: Mon, 7 Jul 1997 16:50:35 GMT
From: ce940@torfree.net (Michael Lauzon)
Subject: C to Perl....
Message-Id: <ECyK4C.LLG.0.bloor@torfree.net>

I am wondering, if anyone can change thise C program into Perl...I am 
posting the program here; and hopefully one of you has the knowledge of C 
and Perl to do so.  So here is the program, please...email it to me; when 
you have changed it from a C program into a Perl program.  The email 
address where it should be sent is:

tal@sdf.lonestar.org

And, now...here is the program:

#include <stdio.h>     
#include <sys/param.h> 
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>     
#include <stdarg.h>    

void smtp_connect(char *server);                          
                                                          
int thesock; /* the socket */                             
                                                          
void smtp_connect(char *server)                           
{                                                         
  struct sockaddr_in sin;                                 
  struct hostent *hp;                                     
                                                          
  hp = gethostbyname(server);                             
  if (hp==NULL) {                                         
    printf("Unknown host: %s\n",server);                  
    exit(0);                                              
  }                                                       
  bzero((char*) &sin, sizeof(sin));                       
  bcopy(hp->h_addr, (char *) &sin.sin_addr, hp->h_length);
  sin.sin_family = hp->h_addrtype;                        
  sin.sin_port = htons(25);                               
  thesock = socket(AF_INET, SOCK_STREAM, 0);              
  connect(thesock,(struct sockaddr *) &sin, sizeof(sin)); 
}                                                         
                                                          
void main(int argc, char **argv)
{                                                                               
  char buf[1024];                                                               
                                                                                
  if (argc != 4) {                                                              
    printf("usage: mflash smtp_server from to\n");                              
    exit(0);                                                                    
  
  }                                                                             
  printf("Connecting to SMTP Server %s\n",argv[1]);                             
  smtp_connect(argv[1]);                                                        
  printf("Sending Mail Flash To %s\n",argv[3]);                                 
  sprintf(buf, "helo a\nmail from: %s\nrcpt to: %s\ndata\nSUBJECT: \033c\033(0\ 
033#8\033[1;3r\033[J\033[5m\033[?5h\n.\nquit\n",argv[2],argv[3]);               
  send(thesock, buf, strlen(buf), 0);                                           
  /* I am not sure how to check when this buffer is done being sent.            
     If you are having any problems increase the sleep time below! */           
  printf("Sleeping To Make Sure Data Is Sent ...\n");                           
  sleep(3);                                                                     
  printf("Done!\n");                                                            
}                                                                               
-- 
Michael
Free email address: http://www.hotmail.com/

'Eat, drink, and be merry, for tomorrow you may work.'


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

Date: Sun, 06 Jul 1997 16:12:01 -0700
From: Charles Kuznia <kuznia@sipi.usc.edu>
Subject: can perl get https pages?
Message-Id: <33C0263E.286A@sipi.usc.edu>

Can perl get web pages that are security-key encoded (https - type
pages)?  Could someone point me to appropriate modules and/or
documentation on how to perform such an operation?

Charlie


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

Date: 4 Jul 1997 14:15:18 GMT
From: "Jeff Oien" <jeff@webdesigns1.com>
Subject: Re: Can't Print After &ReadParse
Message-Id: <01bc8884$ff141ca0$f040cfa9@Pjeffo.execpc.com>

Thanks guys. I went through an online tutorial that didn't have the
semi colon after the function call. Now I know.
-- 
Jeff Oien, WebDesigns
http://www.webdesigns1.com/
jeff@webdesigns1.com

Bart Lateur <bart.mediamind@tornado.be> wrote in article
<33cace5a.7064069@news.tornado.be>...
> "Jeff Oien" <jeff@webdesigns1.com> wrote:
> 
> ...,
> >&ReadParse
> >print "<html><head>"; etc.
> >
> >So here it would say-syntax error at formtest.pl line 5, near "print"
> 
> That's one of the nasty things in the compiler error messages in Perl.
> You should ALWAYS check out the previous line of code as well. It's the
> semicolon after" &ReadParse" that is missing here.
> 
> 	Bart.
> 


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

Date: Mon, 7 Jul 1997 15:32:31 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: shane whinfrey <oa32@dial.pipex.com>
Subject: Re: control characters in <TEXTAREA> boxes
Message-Id: <Pine.GSO.3.96.970707153155.10643K-100000@kelly.teleport.com>

On Mon, 7 Jul 1997, shane whinfrey wrote:

> could someone please tell me how to replace the control characters (i
> think they are CR and LF) in the string with something like *!* for CR
> and *!!* for LF.

Sure, you can do that with the s/// operator, documented in perlop and
perlre. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Jul 1997 14:21:15 GMT
From: felix@chance.em.nytimes.com (felix k sheng)
Subject: Re: delete line in file directly(fixed length record)
Message-Id: <slrn5s1v1k.klo.felix@chance.em.nytimes.com>

On 7 Jul 1997 09:28:44 GMT, Pui Ming WONG <s11976@net2.hkbu.edu.hk> wrote:
>It's explained in the FAQ that there's no direct way of deleting
>a line in a file unless a new file is used for output and then
>renaming it to the old file afterwards.
>BUT, it's also said something like it is POSSIBLE to do it directly
>IF the file has all the lines of the same length.
>Now my file consists of all 8-bytes (9 if the \n is also counted)
>length records.

hmm, you could do something along the lines of opening up the 
file r/w (i.e. open INPUT, "+<$infile" ) and then seeking to
the beginning of the record you want to delete and the just write
blanks or \0's over the 8 or 9 characters.  then, i guess it
depends on how you're reading in the file, but you could probably
train your reader to ignore all blank fields.  that should work,
and be more efficient for large files than opening up and copying
into new file.  if you do a lot of deleting you can have a separate
unrelated process periodically go in and create a new file with
all the nulled out lines actually deleted so your reader doesn't
have to do as much work.

'lx

--- felix sheng                                       pager     800 979 2171
 programmer                                           tel       212 597 8069
 the new york times electronic media company          e    felix@nytimes.com


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

Date: Mon, 7 Jul 1997 15:27:06 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Dave Small <daves@scs.leeds.ac.uk>
Subject: Re: File locking problem...
Message-Id: <Pine.GSO.3.96.970707152533.10643I-100000@kelly.teleport.com>

On Mon, 7 Jul 1997, Dave Small wrote:

> if the user presses 'stop' on their browser, the perl script is stopped
> before it can do a file clearup at the end of the script. 

I don't know whether it'll work on your Windows machine, but you may be
able to use an END {} block or a destructor routine to do what you want.
Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: 7 Jul 1997 17:33:24 GMT
From: Zenin <zenin@best.com>
Subject: Re: GIFgraph.pm or finance scripts
Message-Id: <5pr994$i87$5@nntp2.ba.best.com>

Matt Kruse <mkruse@shamu.netexpress.net> wrote:
	>snip<
> If anyone is working on a graphing module, please take a look at
> http://mkruse.netexpress.net/perl/

> for my Graph.pm.  Please take it and ideas you get from it and work it in.
> It never hurts to have even more ideas that are mostly implemented :)

	Vary nice module.  I really like the graphs it produces, not to
	mention the code is vary clean. -Figuring out what spells GIFgraph
	is casting can be a challange.  I'll defanitly be folding this code
	into my module. -Probably replace most of what I have for bar graphs
	actually, and use it as a base for the harizontal bar graph addition
	I'm working on.

	I do have a recommendation however.  This is more a personal
	code/design style of mine then anything else so take is as you
	will.

	The use of Carp and croak().  Personaly I can't stand any Module
	that desides on it's own when is a good time for my program to die
	or croak.  It makes it just that much harder to error check and
	clean up.  For CGI's (a great use for dynamic graphs) it's just
	that much more of a pain to work with. -Yes, there is eval(), but
	that's even worse.

	The way I prefer to handle exception is with the use of a package
	globle error string, and methods that all return undef on failure.
	Example:

		package Foobar;
		use strict;
		use vars qw($Error);

		sub myMethod {
			_doStuff (@_)
				or ($Error = "Stuff didn't work", return);
		}

	The use of this is:
		$MyObj->myMethod ('stuff')
			or die "Went bang: $Foobar::Error, stopped";

	or if that's too much typing all over the place (it is for me), you
	can of course alias it using typeglobs:
		use vars qw($MyErrorStr);
		*MyErrorSrt = *Foobar::Error;
		$MyObj->myMethod ('stuff')
			or die "Went bang: $MyErrorStr, stopped";

	The point is it's in the user's hands how they want to handle the
	problem.  The module only needs to tell them that there has been
	a problem (method returns undef) and what the problem was (via the
	package error variable).

	This is one of the problems I had with GIFgraph. -It would die() at
	any number of places and force me to have to wrap it in evals if I
	didn't want my users (this was from a CGI) to see some bland
	"Document returned invalid header" message.

	Just my little rant for the day. :)

	But other then that (and the non-use strict code, but that can be
	fixed easily), you've made a pretty darn neat module that I'm sure
	I'll be picking apart quite a bit for my own version.  I defanitly
	prefer the set-as-you-go style for providing data you use then the 
	all-at-once method that GIFgraph uses.  It just makes more sense and
	allows for much better fexibility for custom pieces like labels and
	error checking.

	Thanks!

-- 
-Zenin
 zenin@best.com


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

Date: Tue, 8 Jul 1997 02:03:10 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: help: match empty line
Message-Id: <tcyangECz9pA.4wL@netcom.com>

if ($this =~ m/^\n$/) {
   $this =~ s/\n/something else/;
}

=================================================
rr568@epix.net wrote after zapping the scum of the universe:
: It's driving me nuts!  I want my perl script to 
:   if ($this =~ m/(an empty line)/) {
:     do something...
:   }

: I want to replace a \n with something else, only if there's nothing else on 
: the line

: RR.

--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===

soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
   http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml


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

Date: Mon, 07 Jul 1997 14:20:44 GMT
From: joshaugh@uk.oracle.com (Jamie O'Shaughnessy)
Subject: Installing libwww-perl-5.10 on perl 5.004_01 fo NT - problems
Message-Id: <33c1f7b7.1027473187@newshost.us.oracle.com>


I'm having problems installing libwww-perl-5.10 on perl 5.004_01 on NT (3.51).
I've installed perl OK, and the required libnet-1.0505, Data-Dumper-2.07,
MD5-1.7, MIME-Base64-2.01.

perl makefile.pl does it's stuff OK, it seems, but when running the makefile
(nmake) it gives:

        ..\perl -e 'use Config; chdir q{blib\script}; foreach (qw(GET HEAD
POST)
) {'  -e 'unlink "$_";'  -e 'system("$Config{\"lns\"} lwp-request $_") && die;
}
'
Can't find string terminator "'" anywhere before EOF at -e line 1.
NMAKE : fatal error U1077: '..\perl' : return code '0xff'
Stop.

I've tried by hand to fix this by editing the makefile and the above perl. I've
pretty much succeeded, but the problem seems to be that "lns" in Config does
not have a value. What is "lns" and what's the above part of the makefile
supposed to be doing?

Anyone installed libwww-perl-5.10 on NT (5.004_01)? Or any previous version?

Thanks,
Jamie

___________________________________________________________________________ 
Jamie O'Shaughnessy                        Work: joshaugh@uk.oracle.com 
Oracle Designer/2000 Forms Generator Team  Home: jamie@thanatar.demon.co.uk 
______________________________________________________  __  __ _  __ .   __ 
Opinions expressed here are my own and not those of... (__)|-</-\(__ |__ -_ 


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

Date: 8 Jul 1997 00:52:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Memory problem with reading file
Message-Id: <5ps308$m52@agate.berkeley.edu>

In article <5prrj9$g8m@metro.usyd.edu.au>,
Megan Webb <mwebb@mail.usyd.edu.au> wrote:
> >You're reading your entire dataset into memory, and it takes up a lot of
> >space. If you can process it one record at a time, you'll have much less
> >memory load.

> I am aware that I am reading the whole data set into memory with
> this section of code. On the machine I am running this even the
> 200 Meg is not a problem. 
> 
> What I am questioning is why a 27 meg ascii file requires 200 Meg
> when read in this way. I could accept a slight increase, but this
> is a 10x increase!!

One may explain it if the lines in your file are very short.  Then you
get a Perl-variable overhead per each line of file, which may sum up
to a big amount.  Note also that 

	@array = <>;

is not currently optimized, so a copy of the file is created on the
stack, then dumped to an array.  I *hope* that the (char*) portion of
each variable on stack is stolen during this dumping, but cannot
confirm this using Devel::Peek.  Even if it is stolen, this means that
*two* Perl variables are created perl line of input.  (In the best
scenario just the refcount of the variable is incremented during
dumping, but I do not think Perl is smart enough for this.)

With a contemporary perl you get approx. 7 words per a variable like
the above one, so you should expect 56 bytes of overhead per line of
the file (plus malloc overhead).  But I hope that you just got into
some greediness of an older Perl.

Try upgrading, and report again.

Ilya


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

Date: 5 Jul 1997 17:28:49 GMT
From: evenh@ra.pvv.ntnu.no (Even Holen)
Subject: Re: Perl: deleting spaces etc in strings
Message-Id: <slrn5rt128.tl.evenh@ra.pvv.ntnu.no>

In article <33B9075D.FF6@adc.metrica.co.uk>, Simon Fairey wrote:
>John C. Randolph wrote:
>> To eliminate spaces, try:
>> 
>>  tr/\s//;
>
>Which is indeed much faster if you believe the Benchmark module ( which
>I do :) ).
>
>Out of idle curiosity tho why is it faster?

What about that tr/// is faster due to the fact it ordinary only works
on characters, while s/// ordinarily works on strings. When you then can
optimize for characters it it's bound to go faster. (I think it's seems
rather obvious at least! :-) )

Regards,
Even Holen
-- 
<><   Even Holen, evenh@pvv.ntnu.no, http://www.pvv.ntnu.no/~evenh/   :-)


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

Date: Fri, 4 Jul 1997 09:27:42 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Curtis Hrischuk <ceh@arcturus.sce.carleton.ca>
Subject: Re: please add this to the warning list for perl code
Message-Id: <Pine.GSO.3.96.970704091226.10208e-100000@kelly.teleport.com>

On 4 Jul 1997, Curtis Hrischuk wrote:

> 	aThing = new AThing{Data => $something};
> 
> See anything wrong??

Only several. :-)

> It turns out the bogus code executed properly, except the initialization
> issued a warning about the hash having an odd number of parameters.

> Would it be possible to warn about this?

Do you mean, something like "You should really pay attention to the
previous warning?" Perl already gave you at least one warning. If that's
not enough, maybe you should run your code several times. :-) 

Seriously, it's not possible to warn about every possible mistake. Some
mistakes might be valid code for a different task, after all. And code
similar to your example could actually be useful, so I don't think that
this particular situation should get a warning. You could always put some
parameter checks into your constructor, if it's important.

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 7 Jul 1997 15:34:16 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: DWX <support@dwx.com>
Subject: Re: Problem with pack() and unsigneds
Message-Id: <Pine.GSO.3.96.970707153315.10643L-100000@kelly.teleport.com>

On Mon, 7 Jul 1997, DWX wrote:

> My problem? The values I pass as the delay time (the S in the
> pack() template) aren't coming out right - when I pass 0, I get
> a delay of 0. Otherwise, I get multiples of 256/100 seconds:

After you've packed something that you think should work, try unpacking it
with the "H*" template and print it out. Then you can examine it, byte by
byte, and see whether it does what you want. Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 06 Jul 1997 16:12:15 -0600
From: jloh@futon.sfsu.edu
To: jloh@netjet.com
Subject: relocation error and msqlperl
Message-Id: <868221537.27576@dejanews.com>

everytime I include the Msql Database package, perl give me the following
error:

Can't load '/usr/local/lib/perl5/site_perl/sun4-solaris/auto/Msql/Msql.so'
for m
odule Msql: ld.so.1: /usr/bin/perl: fatal: relocation error: symbol not
found: _
_inet_addr: referenced in
/usr/local/lib/perl5/site_perl/sun4-solaris/auto/Msql/
Msql.so at /usr/local/lib/perl5/sun4-solaris/5.00397/DynaLoader.pm line
155.

Can someone give me any clues?

System: Sparc Enterprise 1
OS: Solaris 2.5.1
version of perl 5.003_97.

Here is the output of myconfig:
Summary of my perl5 (5.0 patchlevel 3 subversion 97) configuration:
  Platform:
    osname=solaris, osvers=2.5.1, archname=sun4-solaris
    uname='sunos zurich.netjet.com 5.5.1 generic sun4u sparc sunw,ultra-1
'
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='cc', optimize='-O2', gccversion=2.7.2.2
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, randbits=15
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib'

Any help will be greatly appreciated.

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


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

Date: Tue, 8 Jul 1997 01:26:19 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: SIGCHLD handler not being called consistently
Message-Id: <ECz7zv.BAG@bcstec.ca.boeing.com>

In article <5prgd9$j4u$1@d2.tufts.edu>,
Jonathan Rozes <jrozes@tcs.tufts.edu> wrote:
 > 
 > This is under 5.003 on a Digital Unix 4.0B system...
 > 
 > I have an application that needs to decrement a counter every time a
 > child process exits. I wanted to do this via a signal handler, but it
 > seems that my handler is not called consistenly. Given the following
 > simple test script:
 > 
 > #!/usr/bin/perl -w
 > 
 > use strict;
 > use POSIX;
 > 
 > $|=1;
 > 
 > $SIG{CHLD} = \&REAPER;
 > 
 > for (1..3) {
 >     simplefork();
 > }
 > 
 > sleep 10;
 > 
 > sub simplefork {
 > 
 >     my $pid;
 > 
 >     if ($pid = fork) {
 > 	print "Parent[$$]\n";
 > 	waitpid($pid,&WNOHANG);
 >     } elsif (defined $pid) {
 > 	sleep 1;
 > 	print "  Child[$$]\n";
 > 	sleep 2;
 > 	print "  Child[$$] FINISHED\n";
 > 	exit 0;
 >     } else {
 > 	die "Error: can't fork: $!\n";
 >     }
 > }
 > 
 > sub REAPER {
 >     $SIG{CHLD} = \&REAPER;
 >     my $d = wait;
 >     print "REAPER[$d]\n";
 > }
 > 
 > __END__
 > 
 > When I run this, my signal handler only gets called once, sometime twice.
 > If I do waitpid($pid,0) instead of a nonblocking waitpid, the handler
 > gets called every time. When I run the script on an IRIX 5.3 box, I get
 > expected results with either form of waitpid.
 > 
 > I get the same results under 5.004_01, or if I recompile either version
 > with compiler optimizations disabled.
 > 
 > What gives? Any clues at all would be appreciated...
 > 
 
  One of the sleeps is reaping the children. Try this instead of sleep:

      my $start = time();  1 until time()-$start == $seconds_to_sleep;  

  Also, print is unsafe in a signal handler unless the handler won't
  be called again. Something like this'd be preferable:

      # my $d = wait;
      # print "REAPER[$d]\n"; 
      push(@reaped, my $d = wait);


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








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

Date: Mon, 07 Jul 1997 21:49:07 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: simple -e file ?
Message-Id: <5prmu0$6u7$1@news3.microserve.net>

First time I am using -e.  I seem to have the format down
wrong.

Why do I always print_line1 whether the file exists or not?
I tried it with quotes and with out.

$file_needed=$home.'/leagues/'.$league.'/caxsl.txt';
## print "file needed is $file_needed";
unless (-e "$file_needed") {
    &print_line1;
   } else {
  $print_line2;
}

-------------- Signature ------------------

Visit  http://www.all-soccer.com

All soccer(what else is there?)

Put your soccer league on the internet today, FREE!



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

Date: Mon, 7 Jul 1997 15:35:37 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: davidb@chelsea.net
Subject: Re: stat of files on NFS filesystems in Solaris
Message-Id: <Pine.GSO.3.96.970707153444.10643M-100000@kelly.teleport.com>

On Mon, 7 Jul 1997 davidb@chelsea.net wrote:

> Has the behavior of stat() under Solaris and PERL changed sometime in the
> last few months/years?  I recall that a stat of an NFS mounted file at one
> time returned a negative device number if it was NFS mounted.  Programming
> PERL bears me out.  Alas, this no longer appears to be the case.

If this has changed, I don't think it's Perl's change. Probably it's a
change in the way that NFS is implemented on your machine. Hope this
helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Mon, 7 Jul 1997 10:17:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Oliver Giller <oliver@inetu.net>
Subject: Re: Tainted problem
Message-Id: <Pine.GSO.3.96.970707100449.9019a-100000@kelly.teleport.com>

On Tue, 8 Jul 1997, Oliver Giller wrote:

> Newsgroups: comp.lang.perl.misc, comp.lang.perl

If your news administrator still carries comp.lang.perl, please encourage
him or her to check out the frequent posting about bogus newsgroup names
in news.announce.newgroups. You'll be doing yourself and many others a
favor to use only comp.lang.perl.misc (and other valid Perl newsgroups)
instead.

    news:news.announce.newgroups

> I am having a problem with taint in a set-uid perl script.
> I am writing a file out to /tmp/ and then trying to open this file with
> an editor. The editor is pulled from $ENV{'EDITOR'}.

So, do you trust whatever somebody names in that variable? That could be
scary! You're going to execute that program, presumably as _your_ user id.
Or maybe as root! 

If you can do so, run the program as their uid; that's much safer. If
you're going to have to run it under your own id, keep a list of safe
editors and run one of those. Standard vi and emacs are _not_ safe, since
a user can easily get a shell or execute arbitrary commands.

> I keep getting the error 
>    Insecure PATH at /usr/share/perl/vedit.lib line 332.

That's not a tainting error; that's documented in perlsec(1) and
perldiag(1).

> I have tried a number of ways of untaining the variables. 
> Here is the code.
> 
>     $ENV{'EDITOR'} =~ /^-P(\w+)$/;  # attempt 1 at untaiting
>     $editor = $1;

I don't know what you thought that might do. But you should know that, if
the pattern match fails, which it will almost certainly do, $editor will
be set to whatever happens to be sitting around in $1 at the time,
probably left over from the previous successful pattern match. That's not
at all good.

Be sure to read up on security issues in perlsec(1). And, if you can, have
somebody double-check your code; it sounds like you could very easily open
up a big security hole here.

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 8 Jul 1997 01:52:33 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: using wildcards with system()- Help Requested
Message-Id: <ebohlmanECz97L.Gw2@netcom.com>

Dane P. Jackson (jacksodp@dragon.ham.muohio.edu) wrote:
: 	I have a small program for uudecoding and then rm the uu files.
: I tried to use a call like
:     system("uudecode","font.*");
:   When it ran it said something to the effect of 'Can't find file font.*'
: Is there some way I can force it to recognize the * as a wildcard and not
: pasrt of a filename.  I've worked around it already, but I'd really like
: to know for future reference.

Read thee the entry for system() in perlfunc and learn thee the 
difference between the one-argument and more-than-one-argument forms.



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

Date: Fri, 04 Jul 1997 18:57:23 -0700
From: Webmaster <admin@no-spam-chathub.com>
Subject: Re: What does this do?
Message-Id: <33BDAA02.6593@no-spam-chathub.com>

Tad McClellan wrote:
> 
> M. muPe (mupe@desk.nl) wrote:
> : In article <33BA7D05.3EAA@storm.simpson.edu>, schneide@storm.simpson.edu wrote:
> : >I'm fairly new to Perl and I'm trying to debug a script written by the
> : >person I replaced.  Could somebody "interpret" the following line:
> : >
> : >$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> : >
> 
> : I'm not a Perl wizard,
> 
> Me either.
  ^^^^^^^^^ -- yeah right.. :^)


> : but expecting a function to be executed in the
> : replacement part seems very exotic.
> 
> Perl *is* exotic!
> 
> That is what the s///e is for. You can even do s///ee and get it to
> be evaluated twice ;-)
> 
> See "s/PATTERN/REPLACEMENT/egimosx" in the perlop man page.
> 
> Slick, huh?
> 
> --
>     Tad McClellan                          SGML Consulting
>     Tag And Document Consulting            Perl programming
>     tadmc@flash.net

-- 
* Chatmaster/Admin Chat Hub:
http://www.chathub.com - http://chat.nstate.net
E-Mail Contact: 
chatmaster@chathub.com, webmaster@chathub.com, sales@chathub.com, 
info@chathub.com, admin@chathub.com, chatmaster@nstate.net  
* Webmaster Northstate Net:
http://www.nstate.net
E-Mail Contact: 
webmaster@nstate.net


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

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

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