[6874] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 499 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 19 21:05:13 1997

Date: Mon, 19 May 97 18:00:25 -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, 19 May 1997     Volume: 8 Number: 499

Today's topics:
     Re: $% argument prototype. <jesse@ginger.sig.bsh.com>
     Re: alternatives in reg exp -- is this by design? (Bob Wilkinson)
     ANNOUNCE: DBD-Solid-0.05 <wet@timeware.co.at>
     Re: Break command---RTBC (Abigail)
     CGI.pm (Dirk Rheeder)
     Re: CGI.pm (I R A Aggie)
     Re: Clearing a Form when using the Back Button (Abigail)
     Re: Clearing a Form when using the Back Button (Timothy Lux)
     Re: grep pat from files and subdirectories <rootbeer@teleport.com>
     help: how to compare some dd:mm:yy date with sistem dat <miran.sepic4@mss.tel.hr>
     Re: help: how to compare some dd:mm:yy date with sistem (Mike Stok)
     Re: Help: How to Split a file at a Null Line??? <rootbeer@teleport.com>
     Re: How do I stop commercial interests from plundering  <rootbeer@teleport.com>
     Re: How I change the Perl version of Novell Intranetwar <rootbeer@teleport.com>
     mode results from stat() (Jeremy T. Elston)
     Opening a pipe under Solaris <P26053@email.mot.com>
     Re: perl and awk (Abigail)
     Re: perl and awk (Michal Jaegermann)
     Re: Perl and PGP interface (Ronald L. Parker)
     Re: Perl and PGP interface (Ronald L. Parker)
     Re: perlipc and multi-threading problem swarren@pdc.com
     Re: perlipc and multi-threading problem <psrc@corp.airmedia.com>
     Re: Simple (?) question (Tad McClellan)
     Re: Site Management Tool With File Locking? <anthony@wco.com>
     Spawning asynchronously on NT 4.0: Win32::Spawn()? (Tom Morrow)
     System Administration <bfe2141@mail.telepac.pt>
     Re: System Administration (Abigail)
     URL verification (Niksun)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 19 May 1997 12:00:51 -0400
From: Jesse Glick <jesse@ginger.sig.bsh.com>
Subject: Re: $% argument prototype.
Message-Id: <4o3erj78p8.fsf@ginger.sig.bsh.com>


abigail@fnx.com (Abigail) writes:

> sub fetch_table ($%) {

with

> sub fetch_cell (@) {
>     (fetch_table @_) [0] -> [0];
> }

vs.

> sub fetch_cell (@) {
>     (fetch_table shift, @_) [0] -> [0];
> }

First attempt above, the `$' in your prototype should have passed as a single
arg the length of @_, which is the scalar-context value for a named array. The
second attempt is fine. Beware that the `%' proto character is apparently
identical to `@' and does not in particular require an even number of
arguments (though I think it should).

The prototype determines how the parsing of calls will proceed: whether args
are evaluated in scalar vs. array context; interpretation of block as sub ref;
etc. E.g.:

sub foo(\%);	# "named" hash
sub bar($);	# scalar, hash reference desired

could have identical bodies but expect args like these:

foo %hash ~ bar \%hash
foo %$hashref ~ bar $hashref
foo %{{a => 1}} ~ bar {a => 1}

(Note the funny notation for an anonymous "named" hash in the last example.)

Also note:

sub bar($$) {...}
@bar=(1,2);
bar(@bar);		# Fails--"not enough args"
bar((), @bar);		# Passes undef & 2
bar $bar[0], $bar[1];	# Correct

That is, you cannot "fake" @_ for a prototyped function in general; the
visible arg list should really be in the right form. Use ampersands if you
must:

&bar(@bar);		# Works, but with warning ("array found/op expected")
&bar((), @bar);		# No warning, mysteriously
&{\&bar}(@bar);		# A bit more esoteric

-- 
Jesse "Da Juice" Glick
mailto:jglick@sig.bsh.com
617-867-1017


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

Date: Mon, 19 May 1997 15:12:13 +0100
From: b.wilkinson@pindar.co.uk (Bob Wilkinson)
Subject: Re: alternatives in reg exp -- is this by design?
Message-Id: <b.wilkinson-1905971512130001@ip57-york.pindar.co.uk>

In article <337c1d9c.1407562@news.tornado.be>, bart.mediamind@tornado.be
(Bart Lateur) wrote:

> In pattern matching with alternatives, Perl shows a behaviour that is
> very useful at times, but I haven't seen this documented in the PODs.
> So: is this a nice accident, that could possibly change in the future,
> or is this by design?
> 
> When Perl tries matching alternatives separated with "|", these are
> tried out from left to right. So, if more than one of the alternatives
> would match, Perl takes out the leftmost matching pattern.
> 
> I actually would like this to be part of the specification, so it should
> be:
>  1) documented in the POD's
>  2) garanteed to work in future versions of Perl
> 
> 

It's documented as Rule 2 of pp.61 of turquoise Camel.

Bob

-- 
I have become death, destroyer of the worlds.


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

Date: 19 May 1997 18:58:10 GMT
From: Thomas Wenrich <wet@timeware.co.at>
Subject: ANNOUNCE: DBD-Solid-0.05
Message-Id: <5lq7s2$ds9$1@nadine.teleport.com>

Hi everybody,

DBD::Solid is a driver module to access the SOLID RDBMS using
Tim Bunce's DBI interface.

SOLID is one of the few SQL/ODBC databases engines available for
Linux and for other UNIX and non-UNIX platforms.

Changes in this release are:
        * truncate of LONG fields is now working
        * some minor bugs are fixed
        * error handling complies to the DBI draft specification
          ($h->err, $h->errstr and $h->state should be full functional)
        * Makefile.PL is now a bit more intelligent
        * Tested with Perl5.003_95 and DBI-0.81

Following DBI features are currently NOT supported:
        $h->{CompatMode}
        $h->{InactiveDestroy}
        $h->{ChopBlanks}
        $dbh->ping

I tested this only with i486 Linux. Porting to other UNIX systems should
be easy, with VMS or NT you are at your own.

The source of DBD::Solid is available from

        http://members.ping.at/wenrich/DBD-Solid.html
                (please not that most of the information on the page
                 applies to v0.04)
     or from CPAN (Authors/TWENRICH/DBD-Solid-0.05.tar.gz)


Information about the SOLID database can be found via

        http://www.solid.fi/
     or http://www.solidtech.com/

Greetings

Thomas




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

Date: Mon, 19 May 1997 14:43:03 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Break command---RTBC
Message-Id: <EAFnJr.9Jv@nonexistent.com>

On 19 May 1997 06:29:21 GMT, Jahwan Kim wrote in comp.lang.perl.misc
URL: news:slrn5nvsq1.ppr.jahwan@supernova.math.lsa.umich.edu:
++ On Fri, 9 May 1997 16:51:47 GMT, Jacob Salomon <jake@apparel.net> wrote:
++ [snip]
++ > I did this all to experiment with the 'break' command, which is
++ > available in awk.  I could not find 'break' in the index of the perl
++ > book I'm using to learn.

Then you are not using the Camel. It has 'break statement (see last operator)'
in the index....



Abigail


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

Date: Mon, 19 May 1997 15:53:18 -0100
From: drheeder@bcs.co.za (Dirk Rheeder)
Subject: CGI.pm
Message-Id: <MPG.dea79b42e57df0f989681@hermes.is.co.za>

How do I insert logic in the middle of a table when using CGI.pm.

Here's what I mean, in the middle of this table I want to do an if check, 
but I get an error when I insert code there.  Is there another way of 
doing this ?  I have tried a couple of different approuches and can't 
figure out how to do it.  I also had a look at the code samples, but 
couldn't find anything that did this.

print $cgi->table({-width=>'500',
	      	     -border=>'3',
		     -cellspacing=>'0',
		     -cellpadding=>'5',
		     -bgcolor=>'#C0C0C0'},
						 
		     $cgi->Tr(
                   $cgi->td({-colspan=>'4' -align=>'center'},"data")),
	
		     $cgi->Tr(
		     $cgi->td('Course No.'),
		     $cgi->td('Course'),
		     $cgi->td({-align=>'center'},'Symbol'),
		     $cgi->td({-align=>'center'},'Mark')),

                   if ($test = test)                 #This won't work.
		     {                                 #If I take the if 
		         print $cgi->Tr(               # out then works 
			        $cgi->td('Dirk'));      # fine.
		     }
										
	);									
			

Is this maybe not possible ?

Cheers
Dirk
drheeder@bcs.co.za
	


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

Date: Mon, 19 May 1997 11:01:21 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: CGI.pm
Message-Id: <fl_aggie-ya02408000R1905971101210001@news.fsu.edu>

In article <MPG.dea79b42e57df0f989681@hermes.is.co.za>, drheeder@bcs.co.za
(Dirk Rheeder) wrote:

[posted && cc'd]

+                    if ($test = test)                 #This won't work.

I do not think that means what you think it means. You're testing on
the result of setting $test to the bareword test...

I'm assuming that you want to compare the value of $test to the sting 'test':

                     if ($test eq "test")

James

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: Mon, 19 May 1997 17:16:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Clearing a Form when using the Back Button
Message-Id: <EAFuMx.HzG@nonexistent.com>

On Mon, 19 May 97 15:41:50 GMT, Timothy Lux wrote in comp.lang.perl.misc
URL: news:5lps6d$c47@news.gvsu.edu:
++ 
++ I noticed when visiting Webcrawler's add a site option that after the 
++ submission was processed, I (like many) click the back button rather than 
++ following any links. When I did, the form I used to submit the
++ information was cleared. 


Uhm, what has this to do with Perl?

Try rec.collecting.sport.football, maybe they know.




Abigail


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

Date: Mon, 19 May 97 18:27:31 GMT
From: luxt@gvsu.edu (Timothy Lux)
Subject: Re: Clearing a Form when using the Back Button
Message-Id: <5lq5sn$fbu@news.gvsu.edu>

In article <EAFuMx.HzG@nonexistent.com>, abigail@fnx.com wrote:
>Uhm, what has this to do with Perl?
>
>Try rec.collecting.sport.football, maybe they know.
>

Uhm, maybe the answer lies in how the script was processed? Thanks for being 
rude...


Tim


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

Date: Mon, 19 May 1997 10:36:00 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: grep pat from files and subdirectories
Message-Id: <Pine.GSO.3.96.970519103247.9212I-100000@kelly.teleport.com>

On 19 May 1997, it was written:

> From: Query????

If you don't fix your e-mail address, it makes it hard to answer you by
private e-mail.

>     How do I grep a pattern from a directory which consist of files 
>     and subdirectories ending with *.abc.

One way is to get a list of the files (using File::Find, probably), and
then you can open the files and search for the pattern. Or is there
something else you're asking? 

>    Why is it that I can't do this:-
> 
>    $alldfiles= <$listdir/*desc>;

That's going to give you just one, not all of them; see glob() in
perlfunc(1).

>    open(OUT, "<$allfile") || die "can't open $outfile to write ($!)\n";

Hmmm... You're trying to open a file called OUT for input. :-)  See open()
in perlfunc(1). Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 19 May 1997 14:32:10 GMT
From: "Miran Sepic" <miran.sepic4@mss.tel.hr>
Subject: help: how to compare some dd:mm:yy date with sistem date (localtime)?
Message-Id: <01bc6461$42a8df20$7a000047@pc_miran.local>

If anybody could help me solving this problem:

I need to set the expiration date of an agreement and after that date user
don't have a permission to enter in the download area of my Web site. How
can I compare today's date (system date, localtime) with date in user
database which should be something like :

			user1:date1
			user2:date2
			..........
			..........
			usern:daten

and in case of expiration of agreement not to allow the entrance in
download area. If somebody has an idea please let me know.


-- 
<miran.sepic4@mss.tel.hr>


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

Date: 19 May 1997 15:20:46 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: help: how to compare some dd:mm:yy date with sistem date (localtime)?
Message-Id: <5lpr4e$39q@news-central.tiac.net>

In article <01bc6461$42a8df20$7a000047@pc_miran.local>,
Miran Sepic <miran.sepic4@mss.tel.hr> wrote:
>If anybody could help me solving this problem:
>
>I need to set the expiration date of an agreement and after that date user
>don't have a permission to enter in the download area of my Web site. How
>can I compare today's date (system date, localtime) with date in user
>database which should be something like :
>
>			user1:date1
>			user2:date2

>and in case of expiration of agreement not to allow the entrance in
>download area. If somebody has an idea please let me know.

If you're on a unixish system then time will return you a number which is
the number of seconds since the unix epoch (the start of Jan 1 1970 GMT or
universal time or whatever it is these days...)  So if you store the time
as the ascii representation of that number e.g.

 
  mike:864055330

then it's easy to tell how many seconds away from now it is.

If you are more interested in calendar months rather than 30 day periods
(or some other fixed period) then you should look at some of the date &
time manipulation routines on CPAN.

CPAN is the comprehensive perl archive network, the master ftp site is at
ftp.funet.fi under /pub/labguages/perl and Tom Christiansen has set up a
web accessible multiplexor at http://www.perl.com/CPAN/

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: Mon, 19 May 1997 10:41:42 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Bart Lateur <bart.mediamind@tornado.be>,  Tung-chiang Yang <tcyang@netcom.com>
Subject: Re: Help: How to Split a file at a Null Line???
Message-Id: <Pine.GSO.3.96.970519103700.9212J-100000@kelly.teleport.com>

On Mon, 19 May 1997, Bart Lateur wrote:

> tcyang@netcom.com (Tung-chiang Yang) wrote:
> 
> >close(FILE1);
> >close(FILE2);
> >
> ># I still wonder if it is necessary to test whether the close's succeed.
> 
> Closing a file only fails if your disk is full. I think.

There are other possible errors, such as media hardware failure, or a
NFS-mounted volume which is disconnected during the time the file is open
for writing. Of course, all of these are (or should be) quite rare, so
most programmers can be excused for not checking.

I, of course, always check for errors from close. Well, almost always. :-) 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Mon, 19 May 1997 10:29:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Richard Church <rchurch@wwdc.com>
Subject: Re: How do I stop commercial interests from plundering my site?
Message-Id: <Pine.GSO.3.96.970519102841.9212F-100000@kelly.teleport.com>

On Sun, 18 May 1997, Richard Church wrote:

> Is there a way for me to limit or prevent others from downloading
> my extensive list of links and yet still provide people access to
> those same links? 

This isn't a Perl question, but I'll tell you the answer anyway: use
a copyright. Your local library probably has a good book on copyrighting;
it's easier than writing a good CGI script. :-)

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Mon, 19 May 1997 10:46:36 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Sergio Stateri Jr <serginho@usa.net>
Subject: Re: How I change the Perl version of Novell Intranetware 4.11 ?
Message-Id: <Pine.GSO.3.96.970519104449.9212L-100000@kelly.teleport.com>

On 19 May 1997, Sergio Stateri Jr wrote:

> I'd like to know if it's possible to change the version of Perl language
> (that run in the Web server of Novell Intranetware).

Well, I suppose you could hack the binary until you're running Perl
7.004... :-)

But what you really want is to install the desired version, right? You
probably want to look on CPAN for something for your system. Hope this
helps!

    http://www.perl.org/CPAN/

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Mon, 19 May 1997 16:31:14 GMT
From: Magius@Greenwood.net (Jeremy T. Elston)
Subject: mode results from stat()
Message-Id: <5lpvck$n3v$1@bigdog.ais-gwd.com>

Greetings...

        I am trying to use stat() to determine original permissions, etc... 
for duplicating some files in a program while preserving their original uid, 
gid, and mode.  

        The mode result I get back from stat does not match.  I have read 
through the BSD manpages on Perl and stat() as well as checked both the Camel  
and Llama books for any stat references, but nothing implies that the value 
will not be returned in octal format.

The code:
($mode,$uid,$gid) = ( stat("$source_dir/$filename") )[2,4,5];
print "$mode,$uid,$gid\n";

On a file with permissions of 0444, $mode results in 33060.

        What format is $mode returned in??



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

Date: Mon, 19 May 1997 09:47:51 -0700
From: Frank Buntschuh <P26053@email.mot.com>
Subject: Opening a pipe under Solaris
Message-Id: <33808433.71FA@email.mot.com>

I seem to be having a problem with opening pipes under Solaris.  I am
trying to run the "standard" example of a pipe, like this:

#!/tools/shareware/bin/perl -w

use sigtrap;
use Socket;

open(STATUS, "netstat |") || die "pipe failed $!";
print "After the pipe open\n";
while(<STATUS>) {
    print "in the pipe loop\n";
}

On a SPARC Solaris box (SunOS 5.4), I never seem to get into the pipe
loop, and the entire output of the netstat is echoed to the screen.  On
an older SPARC box (SunOS 4.1.3) I get the expected stream of "in the
pipe loop".  I need to catch the pipe under Solaris, as some data
processing I am trying to run needs a precompiled binary that only runs
on Solaris, and routing the output of this binary to file produces an
ASCII file that is often 100MB or larger.  

BTW - all of this is using perl v5.001 patch 1m.

I have searched the standard FAQs and old postings on DejaNews to no
avail, but seem to recall seeing something similar on this group about a
year ago.

advTHANKSance

Frank

+--------------------------------------+-------------------------------+
| Frank Buntschuh                      | Sometimes, the dragon wins.   |
| Frank_Buntschuh-P26053@email.mot.com +-------------------------------+
| Voice: (602)732-4158                 |  Motorola Satellite Comm.     |
| Fax:   (602)732-3885                 |  #include <std.disclaimer>    |
+--------------------------------------+-------------------------------+


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

Date: Mon, 19 May 1997 16:28:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: perl and awk
Message-Id: <EAFsFr.FCp@nonexistent.com>

On 19 May 1997 06:27:44 -0700, Randal Schwartz wrote in
comp.lang.perl.misc URL: news:8c4tbzegmn.fsf@gadget.cscaper.com:
++ 
++ However, I'd still prefer the easier-to-read solution (call me
++ old-fashioned):
++ 
++ 	open FP yadda yadda yadda :-)
++ 	while (<FP>) {
++ 		chomp;
++ 		my @fields = split /\./;
++ 		print "$fields[1]\n";
++ 	}
++ 
++ and that's probably how I would leave it for the people that need to
++ maintain the program after me.


I guess they will curse you for not using -w.
I've seen a couple of perl 'equivalents' of the awk program, but
all of them make the assumption each and every line contains a .

If it doesn't, $fields [1] is undef, and perl -w will whine.

Why not:

open FP yadda yadda yadda :-)
while (<FP>) {
  chomp;
  my @fields = split /\./;
  print +(defined $fields [1] ? $fields [1] : ""), "\n";
}

Now you can run with -w without getting warnings.



Abigail
-- 
BUGS
     The -w switch is not mandatory.

     [man perl]


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

Date: 19 May 1997 17:00:01 GMT
From: michal@gortel.phys.ualberta.ca (Michal Jaegermann)
Subject: Re: perl and awk
Message-Id: <5lq0uh$b4o$1@pulp.ucs.ualberta.ca>

Randal Schwartz (merlyn@stonehenge.com) wrote:
: 
: However, I'd still prefer the easier-to-read solution (call me
: old-fashioned):
: 
: 	open FP yadda yadda yadda :-)
: 	while (<FP>) {
: 		chomp;
: 		my @fields = split /\./;
: 		print "$fields[1]\n";
: 	}
: 
: and that's probably how I would leave it for the people that need to
: maintain the program after me.

Which does what the original poster **probably** intends to do, but
not what what he posted.  (An assignment to FS happens only after a split,
so on the first record he prints the second white-space delimited,
and not '.' delimited, field.)

Ah, for pleasures of "bagging" Randal. :-)

  --mj



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

Date: Mon, 19 May 1997 14:21:49 GMT
From: ron@farmworks.com (Ronald L. Parker)
Subject: Re: Perl and PGP interface
Message-Id: <338261b4.6284167@10.0.2.33>

[posted and emailed]

On 16 May 1997 22:48:00 GMT, roustan@wwa.com (Yvon D. Roustan) wrote:

>I am an amateur programmer in Perl5 and I would appreciate any help you
>can give me. 
>
>I created a Perl5 script program that generates a local unencrypted
>message in a variable I call '$message'. I then use a subroutine that 
>employs UNIX 'sendmail' within the Perl script to email the unencrypted 
>$message.
>
>I am trying to create a subroutine to encrypt the '$message' generated by a 
>perl5 script using PGP (PRETTY GOOD PRIVACY). I would like to encrypt 
>'$message' before emailing it, so that it is protected during transit.

The -f option to PGP makes it work in a pipeline, encrypting whatever 
is presented on standard input and presenting the result on standard 
output.  This has the advantage of not needing any temporary files 
that might pose a risk and/or require locking.  Thus, if you 
currently have the text to be encrypted in $message and the name of 
the destination user in $username, and you want the encrypted text in
$encrypted, try this:

#----------- cut here --------

$childpid = open ( CHILD, "-|" );
if ( !$childpid ) {
  open( PGP, "|pgp -feat $username" );
  print PGP $message;
  close PGP;
  exit;
  }
$encrypted = join("\n", <CHILD>);
close CHILD;

#----------- cut here --------

This only works on Unix machines and other machines that support 
forking (NTPerl, at least on Win95, does not.  But then, you mentioned
sendmail, so you're not using NTPerl), and it needs lots of error 
checking and signal trapping that I didn't implement.  In particular, 
thou shalt trap for SIGPIPE, thou shalt make sure the fork succeeded, 
and thou shalt check the return values from open and close.  Check
PerlIPC for more details.  Also, of course, you need to ensure that 
$username isn't tainted.  Perl Gods may pick this apart; please be
gentle.  I know bidirectional pipes aren't child's play (so to speak);

that's why I'm leaving the hard part to the reader.  Contents may have
settled during shipping.  Do not taunt Happy Fun Ball.


--
Ron Parker
Software Engineer
Farm Works Software       Come see us at http://www.farmworks.com
For PGP public key see http://www.farmworks.com/Ron_Parker_PGP_key.txt


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

Date: Mon, 19 May 1997 14:43:29 GMT
From: ron@farmworks.com (Ronald L. Parker)
Subject: Re: Perl and PGP interface
Message-Id: <33816668.7488505@10.0.2.33>

On Mon, 19 May 1997 14:21:49 GMT, ron@farmworks.com (Ronald L. Parker)
wrote:
>$encrypted = join("\n", <CHILD>);

Murphy's Perl Corollary: no matter how long you look at and/or test a 
  Perl program, there'll always be one error you miss until after you 
  post it.  

This should be join('', <CHILD>) or you'll get extra newlines.  I
always forget that <> doesn't chop the newlines.

--
Ron Parker
Software Engineer
Farm Works Software       Come see us at http://www.farmworks.com
For PGP public key see http://www.farmworks.com/Ron_Parker_PGP_key.txt


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

Date: 19 May 1997 07:15:30 -0700
From: swarren@pdc.com
Subject: Re: perlipc and multi-threading problem
Message-Id: <5lpna2$li@drn.zippo.com>

In article <01bc63f3$0d616260$cbe824ca@simonk>, "Simon says...
>
>By the way, as far as I am aware, the tem "multi-threading" is reserved for
>multiple threads of execution running **in the same address space**.
>Perhaps the correct term for the example app is "multi-processing"?
>

I agree.  However, the example code that I "stole" from the perlipc man
page (from the tcp client-server section) referred to that particular
example code as the "multi-threaded" version of the server, so I attempted
to use the same terminology for consistency with the documentation.  Sorry
if this caused confusion.

Steve Warren                           E-mail: swarren@pdc.com     _.  
Central Regional SE Manager            Phone: 972-446-2644       ._||__
PDC Services                           Fax: 972-245-9320          v\ *|
1445 MacArthur Dr, Suite 116           Pager: 214-249-8651          V  
Carrollton, TX  75007                  http://www.pdc.com


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

Date: Mon, 19 May 1997 13:54:09 -0400
From: Paul S R Chisholm <psrc@corp.airmedia.com>
To: Steve Warren <swarren@pdc.com>
Subject: Re: perlipc and multi-threading problem
Message-Id: <338093C1.7DC1@corp.airmedia.com>

swarren@pdc.com wrote:
> sub REAPER {
>     my $waitedpid;
>     while ($waitedpid = waitpid(-1,WNOHANG)) {
>         $Kid_Status{$waitedpid} = $?;
>     }
>     $SIG{CHLD} = \&REAPER;  # still loathe sysV
> }
> $SIG{CHLD} = \&REAPER;

SIGCHLD code is really fragile; a little change here or there, and it
hangs. Here's some code I have that works on Solaris 2.5 (stolen from
the Blue Camel errata):

my $waitedpid = 0;  # alas, needs to be global

sub reaper
{
    # note: next two lines in reverse order from Blue Camel!
    $waitedpid = wait;
    $SIG{CHLD} = \&reaper;
    # print STDERR "DEBUG: reaped process $waitedpid with exit $?\n";
}

You'll have to tweak it in order to get the WNOHANG behavior ... or you
can count on it being called once per death-of-child, avoiding both the
need for a loop and for waiting-without-hanging.
--
 Paul S. R. Chisholm, AirMedia, Inc.      (formerly Ex Machina)
mailto:psrc@corp.airmedia.com http://www.corp.airmedia.com/~psrc
  I'm not speaking for the company, I'm just speaking my mind


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

Date: Mon, 19 May 1997 13:45:19 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Simple (?) question
Message-Id: <v37ql5.hs2.ln@localhost>

Alan Silver (alan-s@consultancy-services*.*com) wrote:
: Hi,

: I have what I believe is a simple question, but being a bit of a perl
                             ^^^^^^^^^^^^^^^

Perl FAQ part 8:

---------------------------------
=head2 How can I open a pipe both to and from a command?

The IPC::Open2 module (part of the standard perl distribution) is an
easy-to-use approach that internally uses pipe(), fork(), and exec()
to do the job.  Make sure you read the deadlock warnings in its
documentation, though (see L<IPC::Open2>).
---------------------------------



: newbie I have not managed to work it out yet.

: I have a script (call it "ferret") that I want to call from within a
: Perl script. I want to pass it data on stdin and capture the stdout. The
               ^^^^^^^^^

Yes, but do you *need* to pass it data on stdin and capture the stdout?

Why not just write a short subroutine, and do it from within your script?


: output is to be put onto a web page, so all I really want to do to it is
: add <br> tags at the beginning of each line of output.

: I guess that I could do this by using file handles, but I'm not
: altogether sure how. All of the examples I can see only have data going
: one way (ie to the script like open(FERRET,">lp -dps"); or from the
: script like open(FERRET,"/etc/sysinfo |"); ). I would like to be able to
: send and capture data.

: In pseudocode, what I want to do is ...

: # some data processing has gone on here, resulting in $ferret containing
: # the input for the script
: call external_script < $ferret > @ferret;
                                   ^
                                   ^  ??

: for ($i=0; $i<+$#ferret)
                ^        ^
                ^        ^
                =        ; $i++       ??


:   {
:   print "<br>$ferret[$i]\n";
:   }

: I hope that this is clear. Any help would be greatly appreciated.
  ^^^^^^^^^^^^^^^^^^^^^^^^^

It was until the pseudocode ;-)



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


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

Date: 19 May 1997 18:19:41 GMT
From: Anthony Boyd <anthony@wco.com>
Subject: Re: Site Management Tool With File Locking?
Message-Id: <5lq5jt$fkk$1@news.wco.com>

Jahn Rentmeister <rentmei@uni-muenster.de> wrote:
> Anthony Boyd <aboyd@corp.borland.com> wrote:

> > Does anyone out there know of a Web tool that can help a team avoid
> > overwriting files?

> One could use a perl script that uses itself sccs to serve sccs functions over
> HTTP GET and PUT methods. Please write one and tell me where I can get your
> source :-)

Well, I have to make this happen, so you just may be getting some source
code.  But I don't want to reinvent the wheel, so...

Does anyone know of an existing Perl script that will let users ask for a
HTML file, return the file, flock it, and then unlock when it it sent
back?  Preferably the interface would be via HTTP, but that's not
necessary.  I could modify it.

Doesn't have to use sccs.

-Tony


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

Date: 19 May 1997 17:07:08 GMT
From: tmorrow@us.oracle.com.removethis (Tom Morrow)
Subject: Spawning asynchronously on NT 4.0: Win32::Spawn()?
Message-Id: <5lq1bs$hjn$1@inet16.us.oracle.com>


On Windows95 I used to use start.exe to spawn programs asynchronously
using Win32::Spawn().  I would specify the full path to the spawn.exe
in the call to Win32::Spawn(), so it would run start.exe as the
executable.

But this doesn't work now that I am on Windows NT 4.0; I cannot find
start.exe anywhere on my hard disk, so I can't give its full pathname
to Win32:Spawn().  Even though 'start' still works from the MS-DOS
command line on NT, there is no start.exe to launch with
Win32::Spawn().

So has anyone found a way to spawn asynchronously from a perl script on
NT 4.0?

Thanks!

-Tom  (tmorrow@us.oracle.com)


==== Remove the .removethis from my email address to send me mail====


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

Date: Mon, 19 May 1997 17:28:35 +0200
From: Joco Paulo Gongalves <bfe2141@mail.telepac.pt>
Subject: System Administration
Message-Id: <338071A3.52DC@mail.telepac.pt>

Hello!

I want to know in what tasks can perl help in the system administration.

Thanks a lot.

Nuno Gongalves
mailto:bfe2141@mail.telepac.pt


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

Date: Mon, 19 May 1997 18:50:19 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: System Administration
Message-Id: <EAFyzv.106@nonexistent.com>

On Mon, 19 May 1997 17:28:35 +0200, Joco Paulo Gongalves wrote in
comp.lang.perl.misc URL: news:338071A3.52DC@mail.telepac.pt:
++ Hello!
++ 
++ I want to know in what tasks can perl help in the system administration.

All, except making coffee.


coffee ($cream, $sugar) for Perl 5.005 maybe?


Abigail


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

Date: Mon, 19 May 1997 15:58:41 GMT
From: niksun@lconn.net (Niksun)
Subject: URL verification
Message-Id: <3380787f.9527234@news.inetw.net>

Is there a way to find out (through Perl) if a URL location is valid
and points to a page?  If so, what is the Perl code for this?

Niksun


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

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

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