[7839] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1464 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 12 21:07:19 1997

Date: Fri, 12 Dec 97 18:00:25 -0800
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, 12 Dec 1997     Volume: 8 Number: 1464

Today's topics:
     Re: a certain bug...!!! <zenin@best.com>
     Another Win32 Perl Question / timeout (David Hawkins)
     Re: Apparent Infinite Loop When Redirecting Output (Andrew M. Langmead)
     Re: Apparent Infinite Loop When Redirecting Output (brian d foy)
     Capturing the previous URL? <bgodden@apple.com>
     Re: Chunking up a large input file (Tushar Samant)
     Detect Java, JavaScript Enabled via Perl ywang@maingate.net
     Re: Encryption (Ken)
     Error Number 2 <giga@microtec.net>
     Re: failed to close pipe into sendmail <spidaman@well.com>
     Re: HELP: Newbie: Sorting an array just on two fields (Tad McClellan)
     Re: Memory leak (perl 5.004_04) (Ken)
     Re: newbie: compact an array (Jason Gloudon)
     perl program very slow (Waqar Hafiz)
     Re: perl program very slow <friedman@uci.edu>
     Re: pgp encrypion via perl script rgay@palmetto.net
     Re: Question about the =~ operator <bcoleman@mindspring.com>
     Re: Restricting CGI Programs to Perl. <dougal@vespucci.advicom.net>
     Re: Restricting CGI Programs to Perl. (brian d foy)
     Returning file handle <peng@p150.chem.nyu.edu>
     semget <guna@gwcom.com>
     setting environment variable within perl script rgay@palmetto.net
     Re: WANTED: "generic" logfile parse/report <eryq@zeegee.com>
     Re: Which language pays most 17457 -- C++ vs. Java? <roedy@BIX.com>
     Re: Which language pays most 17457 -- C++ vs. Java? <mdkersey@hal-pc.org>
     Re: Which language pays most 17457 -- C++ vs. Java? (Mitchell R Grunes)
     Re: Which language pays most 17457 -- C++ vs. Java? (Peter Seebach)
     Re: Which language pays most 17457 -- C++ vs. Java? (Robert Dewar)
     Re: Which language pays most 17457 -- C++ vs. Java? (Robert S. White)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 13 Dec 1997 01:32:09 GMT
From: Zenin <zenin@best.com>
Subject: Re: a certain bug...!!!
Message-Id: <881976946.635975@thrush.omix.com>

Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh <bsa@void.apk.net> wrote:
: Pardon?  Has Perl redefined the semantics of O_APPEND?  I see no indication of
: this in the Fine Manual.
	>snip<

	Duh!  When I first tryed to use +>> it was under perl4 on a IRIX
	box, and did indeed act exactly as I mentioned.  When I now try it
	on my FreeBSD box seek (FH, 0, 0) does infact get me to the actual
	start of the file.  :-/

	One more reason to loth IRIX...

-- 
-Zenin
 zenin@best.com


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

Date: 12 Dec 1997 14:41:30 -0800
From: dhawk@best.com (David Hawkins)
Subject: Another Win32 Perl Question / timeout
Message-Id: <66seiq$9on$1@shell3.ba.best.com>

[This is all on NT 4.0 with ActiveWare's perl port]

I'm doing:

use Win32::Netadmin;
# [routines to get a machine name]
Win32::InitiateSystemShutdown("\\\\$mach","byebye",30,1,1)
	or print "unable to reboot $mach\n";

but if the machine it's trying to reboot is not on there's quite
a delay. Can I cut down on that delay?

Also, can I set it so it will reboot in this one case and boot to
DOS and run a script (which will reboot it afterwards)?

[Not a PC guy here.]

later, david
--
David Hawkins    dhawk@best.com       http://www.river.org/~dhawk
"If this screen looks blurred, or otherwise out of focus, get a life."
		-- Derryl Dean DePriest


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

Date: Fri, 12 Dec 1997 22:48:03 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Apparent Infinite Loop When Redirecting Output
Message-Id: <EL3M03.Mt5@world.std.com>
Keywords: redirect output

simonsen_nospam@skopen.dseg.ti.com (Kevin M Simonson) writes:

>     I decided one way to ensure that this would happen would be to make
>sure that for any one particular execution of the script, all the files
>would need to have the same suffix.

If you want to do that, you might want to consider the programs
process ID number. It is a number that is guaranteed to be unique (no
problems with race conditions between more than one process trying to
grab the same ID number) and easy to retrieve (perl makes it available
to you through the magic "$$" variable.)

Another thing to look at is the IO::File module's
IO::File::new_tmpfile() method. It has a property that the file is
automatically deleted when the program ends.
-- 
Andrew Langmead


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

Date: Fri, 12 Dec 1997 17:39:21 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Apparent Infinite Loop When Redirecting Output
Message-Id: <comdog-ya02408000R1212971739210001@news.panix.com>

In article <66saej$8us@sf18.dseg.ti.com>, simonsen_nospam@skopen.dseg.ti.com (Kevin M Simonson) wrote:

>     I'm writing a "perl" script that creates and uses a significant number
>of auxiliary files.  I would like to design it in such a way that if the
>files stay around from one execution of the script to the next, the new
>files don't overwrite the old.

> So the first thing I wanted my "perl"
>script to do is find a unique suffix to use for all the auxiliary files it
>would need to create.

[snip rather intensive solutions]

other possible solutions to cosider:

   * increment a counter file, and use that number as the unique identifier

   * use the PID of the process as an ID

   * give each set of files their own directory, then check to see if 
   a directory of the chosen name already exists.  a reaper script would
   delete empty directories

   * if the script is prevented from executing more than once a second,
   use the time as the unique identifier

   * so on and so on with shell avoidance solutions.

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: 12 Dec 97 15:00:04 -0800
From: "Brian Godden" <bgodden@apple.com>
Subject: Capturing the previous URL?
Message-Id: <B0B701F7-4FB2D9@17.219.12.192>

Hello,

I'm trying to capture the last URL accessed by a browser that goes to my
form and submits.  Is there a ENV variable that grabs this?  Is this even
possible?  Just to clarify, I'm not talking about $ENV{'HTTP_REFERER'} that
grabs the forms actual URL.

Thanks for any help!
Brian Godden






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

Date: 12 Dec 1997 16:03:40 -0600
From: scribble@tekka.wwa.com (Tushar Samant)
Subject: Re: Chunking up a large input file
Message-Id: <66scbs$alk@tekka.wwa.com>

dmills@riag.com writes:
>The out of memory problem can be solved if I replace the while with:
>while(read FILEIN,$buffer,BUFSIZE)
>
>The problem with this approach is if the read stops in the middle of an
>SGML tag, I've got problems.

No, you haven't. Remove as many words and complete tags as possible from
the buffer and then read more. Unless you are saying you have a 10M tag.
A buffer's for buffering, nothing smarter ...



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

Date: Fri, 12 Dec 1997 18:01:37 -0600
From: ywang@maingate.net
Subject: Detect Java, JavaScript Enabled via Perl
Message-Id: <881971064.2129788934@dejanews.com>

Hi,

Could anyone tell me how to detect the user's brower is JavaScript/Java
enabled via using Perl CGI program? And is there possible the enable
those feature via a CGI program? Please cc your answer to
ywang@maingate.net.

Thanks a lot for your help.

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


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

Date: Fri, 12 Dec 1997 20:44:18 -0500
From: ken@forum.swarthmore.edu (Ken)
Subject: Re: Encryption
Message-Id: <ken-1212972044180001@news.swarthmore.edu>

Hi-

That's the whole point of the crypt() function - it's one-way encryption. 
You can't unencrypt things.  The way you check whether people have entered
a correct password, for instance, is to encrypt what they give you, and
see whether that matches your version of the encrypted password.  

You are talking about the build-in crypt() function, right?


In article <66pl1j$4le$1@news.igs.net>, "Ian Duchesne" <ian@king.igs.net> wrote:

>Hi all,
>
>Here's my situation.  I'm using perl 5.001. Trying to use the crypt program.
>
>I am able to crypt a word but I cannot uncrypt the crypted word.
>
>Some help would be appreciated.
>
>Thanks .
>
>ian

-Ken Williams
 The Math Forum
 ken@forum.swarthmore.edu


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

Date: 12 Dec 1997 22:38:12 GMT
From: "ben" <giga@microtec.net>
Subject: Error Number 2
Message-Id: <01bd074f$6b1cc3e0$03bebebe@ben>

Hi, 

	I'am new in Perl's world, and when I want to use the CGI.pm, I have this
message : Can't find string terminator "END_OF_AUTOLOAD" anywhere before
EOF at /usr/lib/perl5/CGI.pm line 672.
	In my log file I have an error number 2. What's append ? Someone can help
me !!!!!



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

Date: Fri, 12 Dec 1997 16:29:39 -0800
From: Ian Kallen <spidaman@well.com>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: failed to close pipe into sendmail
Message-Id: <Pine.GSO.3.93.971212160452.16855B-100000@well.com>

On Fri, 12 Dec 1997, Tom Phoenix wrote:
> >             close(QUEUE) or die "REALLY BAD STUFF: $! == $?\n";
> 
> > Now, where I close the filehandle to sendmail it's dying; I get 
> > REALLY BAD STUFF: No child processes == -1
> 
> So, that means that your program (on QUEUE) has finished and been reaped
> already. Did you perhaps wait for your own forked process? That could have
> reaped it. Did you install a $SIG{CHLD} handler which reaped it?

OK, well sendmail is exiting before the close then, so I'll just
'close(QUEUE);' and get rid of the complaints about 'No child processes'

When I set $SIG{CHLD} = 'IGNORE'; or just leave it unset, the zombies
accumulate (watching 'top') like crazy but the program speeds right along
doing what I want it to do: write out messages in deferred mode to the
queue directory.
Interestingly, the zombies evaporate when I exit the program (I thought
the definition of a zombie was a process hanging around cause it wasn't
done when the parent exited).  I tried 
'local $SIG{CHLD} = sub { waitpid(-1,&WNOHANG); };'
 but then I get weird errors showing up like 
"Not a GLOB reference at 
/usr/local/lib/perl5/i386-freebsd/5.00401/IO/Socket.pm line 133.
Attempt to free unreferenced scalar." (probably related to my use
in the parent process of Net::DNS for mx lookups).

This is on FreeBSD 2.2-970816-RELENG, BTW.

Any suggestions?

--
The next interface will not be another desktop metaphor.... Ian Kallen ....



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

Date: Fri, 12 Dec 1997 19:05:18 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: HELP: Newbie: Sorting an array just on two fields
Message-Id: <e0ns66.f31.ln@localhost>

David J. Boyd (djboyd@nospam.sam.on-net.net) wrote:
: I have an array in which each record contains 10 fields.  The first two fields
: are data and time.  I would like to sort the array on these two fields.  The
: sort ordr would be from the oldest date, earliest time to current date and time.
: Now I went to the FAQ, but, due to a lack of full understanding of perl I did
: not fully understand what was happening.  So, could some one help me out on
: this.


If we new what the data to be sorted looked like we could try.

But we don't, so we can't.


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


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

Date: Fri, 12 Dec 1997 20:35:19 -0500
From: ken@forum.swarthmore.edu (Ken)
Subject: Re: Memory leak (perl 5.004_04)
Message-Id: <ken-1212972035190001@news.swarthmore.edu>

Hi-

I don't see any place that looks like it will generate a leak either.  Are
you sure that the program is failing in this section?  I think it might be
wise to put an "or die $!" after all of your open() and tie() statements,
so you know exactly where the thing is dying.

The other thing you can do is put some print(`ps -p $$`); statements in
key places to see when the memory leak is actually happening - maybe it's
actually before this code, but the extra memory needed by this code just
pushes it over the edge?  Just a theory.


In article <34903B59.659C8D18@posthuman.com>, Brian Atkins
<brian@posthuman.com> wrote:

>Hi, if anyone can help me find a memory leak in the code below
>I will give them a free hosting account (well, actually we do
>that anyway :-). We have about 2000 virtual hosts on our server
>currently, and that necessitates that we log it all to one
>logfile and then split it up every night into separate logs.
>Below is a snippet of our splitter program- it always fails
>in this section with an Out of memory! error. It looks really
>straightforward to me, but maybe there is something wrong?
>
>tie %h5,DB_File,"/data1/hypermart.net/cgi-bin/users.db",O_RDONLY,0700,$DB_HASH;
>foreach $user (keys %h5) {
>   if ($user ne "www") {  
>   open(FILE,"/data2/logs/temp_log");
>   open(FILE2,">/data2/logs/temp_log2");
>   open(LOG,">>/data2/logs/users-access_log");
>   open(LOG2,">>/data2/logs/userlogs/$user"); 
>   if ($domains{$user} eq "") {
>      while ($line = <FILE>) { 
>         @pieces = split(/\s/,$line);
>         @path = split(/\//,$pieces[7]);
>         if ($path[1] eq $user || $pieces[0] eq "$user.hypermart.net") {
>            print LOG join(" ",@pieces)."\n";
>            print LOG2 join(" ",@pieces)."\n";
>         } else { 
>            print FILE2 join(" ",@pieces)."\n";
>         }  
>      }  
>   } else {
>      while ($line = <FILE>) {
>         @pieces = split(/\s/,$line);
>         @path = split(/\//,$pieces[7]);
>         $virtual = shift(@pieces);
>         if ($path[1] eq $user || $virtual eq $domains{$user} || $virtual eq
>"$user.
>hypermart.net") {
>            print LOG join(" ",@pieces)."\n";
>            print LOG2 join(" ",@pieces)."\n";
>         } else { 
>            print FILE2 join(" ",$virtual,@pieces)."\n";
>         }  
>      }  
>   }  
>   close FILE;
>   close FILE2;
>   close LOG;  
>   close LOG2; 
>   rename("/data2/logs/temp_log2","/data2/logs/temp_log");
>   }
>}
>
>P.S. The OS is BSDI3.1 if that matters.
>-- 
>The future has arrived; it's just not evenly distributed.
>                                                       -William Gibson
>______________________________________________________________________
>Visit Hypermart at http://www.hypermart.net for free business hosting!

-Ken Williams
 The Math Forum
 ken@forum.swarthmore.edu


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

Date: Sat, 13 Dec 1997 01:38:44 GMT
From: jgloudon@bbn.subtleantispam.com (Jason Gloudon)
Subject: Re: newbie: compact an array
Message-Id: <EGlk.112$ea2.4903469@cam-news-reader1.bbnplanet.com>

Nicolas Brossard (brossard@bch.umontreal.ca) wrote:
: > In article <66n3jh$617$1@nntp1.ba.best.com>,
: >  Xah <xah@best.com> wrote:
: >  Suppose @a is an array of integers. I want to compact @a, so
: >  that elements that are 0 get deleted. How can I do this without >
: >  declaring another array @b such as:
: > 
: > # compact array
: > $j=0;
: >  foreach $i (@a) {if ($i) {@b[$j] = $i; $j++;};};

: Why not just:

: @a = grep($_, @a)

This does temporarily create a second array, unless some special optimization
exists for this case, which would not meet the "spirit" of Xah's post, of
not duplicating the array.

Jason Gloudon


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

Date: Fri, 12 Dec 1997 23:43:21 +0000
From: waqar.hafiz@virgin.net (Waqar Hafiz)
Subject: perl program very slow
Message-Id: <3.0.3.32.19971212234321.006da7d8@mail.virgin.net>

Perl 5.004.003 OS Solaris 2.5.1 HW Sun Ultra 1.
I've the following program which even for 2 hosts
is taking between 10-20 secs. Is there any way to
speed it up?

use Net::Ping;

foreach $host (@hosts) {
	if (pingecho $host) {
		if (`rsh $host "ps -ax | grep alr"`) {
			# print some HTML code here
			... .... ...
		} else {
			# print some HTML code here
			... ... ...
		}
	} else {
		# print some HTML code here
		... ... ...
	}
}

Any ideas would be greatly appreciated.






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

Date: 13 Dec 1997 01:10:29 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: perl program very slow
Message-Id: <66sna5$nng@news.service.uci.edu>

In article <3.0.3.32.19971212234321.006da7d8@mail.virgin.net>,
Waqar Hafiz <waqar.hafiz@virgin.net> wrote:
<Perl 5.004.003 OS Solaris 2.5.1 HW Sun Ultra 1.
<I've the following program which even for 2 hosts
<is taking between 10-20 secs. Is there any way to
<speed it up?
<
<use Net::Ping;

Thedocs for Net::Ping indicate that while command line ping uses
icmp, Net::Ping only uses it if you're running as root.  I have
found that the default ping used by Net::Ping is quite a bit
slower than icmp.  You could switch to tcp, which I think works
nicely.  You could also enforce a timeout on your pingecho
so that you can continue processing if one host isn't responding.

HTH,
Eric

<
<foreach $host (@hosts) {
<	if (pingecho $host) {
<		if (`rsh $host "ps -ax | grep alr"`) {
<			# print some HTML code here
<			... .... ...
<		} else {
<			# print some HTML code here
<			... ... ...
<		}
<	} else {
<		# print some HTML code here
<		... ... ...
<	}
<}
<
<Any ideas would be greatly appreciated.
<
<
<
<


-- 
Eric D. Friedman
friedman@uci.edu


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

Date: Fri, 12 Dec 1997 22:44:53 GMT
From: rgay@palmetto.net
Subject: Re: pgp encrypion via perl script
Message-Id: <3491a9d7.28214351@news.scescape.net>

On Fri, 12 Dec 1997 14:49:37 -0500, comdog@computerdog.com (brian d
foy) wrote:

>i recommend not doing it this way.  if you want the data to be secure,
>you can't temporarily store it unencrypted on disk.  it would be VERY
>easy for someone to write a script to periodically collect the contents
>of your temporary file.  after that, you could use as large a key as you
>wanted and it still wouldn't help.                                     

specs...
Irix 6.2 on SGI
Perl 5.003
PGP 2.6.2 for UNIX

Here's another example of code that produces the same webserver error.
Again it works fine via the command line and I've paid very close
attention to the file permissions.  The scalar variable $pgpprog is
assigned an absolute path. The mailing works fine. As best that I can
discern, the PGPPATH enviroment variable needs to be set in this
script, what's the best way to set it??


###### CUT HERE ########

print MAIL "whatever else may be in the mail message\n";

### encrypt info and put in mail message
open (PGP, "|$pgpprog -feat \"$pgpuserid\"  -o
/var/www/secure/temp/pgptmp.asc > /dev/null") || die "Can't open
$pgpprog!\n";

print PGP "sensitive stuff to be encrypted\n";

close (PGP);

open(PGPFILE, "/var/www/secure/temp/pgptmp.asc") or die "Can't open
pgptmp.asc";

while (<PGPFILE>) {
	print MAIL;
}

close (PGPFILE);

unlink("/var/www/secure/temp/pgptmp.asc");

### put more regular info into mail message
print MAIL "whatever else may be in the mail message\n";

###### CUT HERE ########


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

Date: Fri, 12 Dec 97 18:18:29 +0400
From: "Ben Coleman" <bcoleman@mindspring.com>
Subject: Re: Question about the =~ operator
Message-Id: <eejalaqilaaaknu.pminews@user-38lcphd.dialup.mindspring.com>

On 12 Dec 1997 19:26:07 GMT, John Stanley wrote:

>Exactly what harm has the domain owner done to you that makes you think
>it's ok to do whatever you want with his domain name?

Calm down, John.

1.  I haven't done anything with his domain name, and I don't think
the original poster has either, in any meaningful sense.

2.  Since when is personal harm a prerequisite for disapproval of
someone else's actions?  (note that if it were a prerequisite, your
own complaint would be ruled out of bounds on that basis alone).

3.  In any case, your original complaint is specious, at best.  It's
not much different from any other anti-spam mangling of a From
address into a bogus address.  The worst that can result from it is a
few hits on OKDirect.com's DNS servers.  Unless you're making a habit
of objecting to all anti-spam From address mangling(in which case, I
expect you're _very_ busy), I'm not exactly sure why you made the
comment in the first place.

Followups redirected to news.admin.net-abuse.misc.

Ben
-- 
Ben Coleman NJ8J                     | The attempt to legislatively
Internet: bcoleman@mindspring.com    | micromanage equality results, at
http://bcoleman.home.mindspring.com/ | best, in equal misery for all.





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

Date: 12 Dec 1997 22:20:31 GMT
From: Dougal Campbell <dougal@vespucci.advicom.net>
Subject: Re: Restricting CGI Programs to Perl.
Message-Id: <66sdbf$2f2$1@polo.advicom.net>

In comp.infosystems.www.servers.unix djr@newcoast.com wrote:
> Hello,

> 1. Is their an easy way to have a web server restrict CGI programs to
> Perl in an UNIX environment (Solaris 2.6 running SWS 1.0)?  2. Is
> there a way to restrict Perl to what it can spawn, such as only
> sendmail, etc?  Any information on how to accomplish this is
> greatly appreciated.

Sure:

1) Rewrite the web server.
2) Rewrite Perl.

Oh wait...you said "easy way", so the practical answer is "no". Except that
for number 1 you might consider compiling in a module like eperl. But I
don't think that would stop you from spawning off other programs. (I could
be wrong, I've never looked at eperl, so it's possible that it has a
configurable option for that....)

-- 
Dougal Campbell, Systems Manager, ADViCOM        dougal@advicom.net
http://www.advicom.net/                 http://advicom.net/~dougal/
           See my homepage for anti-spam information!
QUOTE OF THE MOMENT:
"I'd love to go out with you, but I'm having all my plants neutered."


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

Date: Fri, 12 Dec 1997 17:24:20 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Restricting CGI Programs to Perl.
Message-Id: <comdog-ya02408000R1212971724200001@news.panix.com>

In article <881956713.1442709506@dejanews.com>, djr@newcoast.com wrote:

>1. Is their an easy way to have a web server restrict CGI programs to
>Perl in an UNIX environment (Solaris 2.6 running SWS 1.0)?  

don't create any ScriptAlias directories, and don't allow execution
of scripts in arbitrary directories. then set up the mod_perl
handler.

implementation details are better answered in a newsgroup about
servers.

>2. Is
>there a way to restrict Perl to what it can spawn, such as only
>sendmail, etc?  Any information on how to accomplish this is
>greatly appreciated.

perhaps you want a chroot()-ed environment with a special directory for
thingys that can be used from perl?

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Fri, 12 Dec 1997 19:46:52 -0500
From: Tong Peng <peng@p150.chem.nyu.edu>
To: peng@risc.nyu.edu
Subject: Returning file handle
Message-Id: <3491DAFB.F1A90672@p150.chem.nyu.edu>

Hi,

Perl version: 5.003
Platform: AIX 3.2.5, IRIX 6.2, Linux 2.0.29

In the man page 'perlfunc', section 'Pass by reference' there is this
code example:

------------------------------------------
       If you're planning on generating new filehandles, you
       could do this:

           sub openit {
               my $name = shift;
               local *FH;
               return open (FH, $path) ? \*FH : undef;
           }

       Although that will actually produce a small memory leak.
-------------------------------------------

But when I tried it in the following code:
 ------------------------------
1  #!/usr/bin/perl -w
2  $fhh = openit('/etc/passwd') or die $! ;
3  print <$fhh> ;
4  sub openit {
5        my $name = shift;
6        local *FH;
7        return open (FH, $name) ? \*FH : undef;
8  }
-----------------------------------

I got error message "Read on closed filehandle <FH> at tt.pl line 3.
The file is OK. I tried to assign \*FH to a scalar within 'openit' and
used there it just as in the main program, no problem.

Could somebody explain what's happening?  Much thanks.

--
Tong  Peng              peng@p150.chem.nyu.edu





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

Date: Fri, 12 Dec 1997 17:07:42 -0800
From: Guna Govind <guna@gwcom.com>
Subject: semget
Message-Id: <3491DFDE.67CB@gwcom.com>

Hi gurus
   i'm looking for an example perl program on using "semget()".
Basically i want to make sure only a single instance of my
program runs at any time.

regards,
Guna
-- 
 ----------------------------------------------------------------
| General Wireless Comm. Inc. | email: guna@gwcom.com            |
| 3350 Scott Blvd. Bldg# 36   | phone: (408) 986 8988 Ext.128    |
| Santa Clara, CA 95054       | pager: (408) 581 4268            |
|                             | page-mail: 1617196@pagemart.net  |
 ----------------------------------------------------------------


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

Date: Fri, 12 Dec 1997 23:28:50 GMT
From: rgay@palmetto.net
Subject: setting environment variable within perl script
Message-Id: <3491c710.35697222@news.scescape.net>

Can anyone tell me the proper way to set an environment variable
within a perl script?

I have a script written that mails the contents of a form and
additionally utilizes pgp to encrypt a portion of the mail message.

pgp refuses to co-operate due to the fact (I think) that there is no
PGPPATH environment variable set within the script.

It works fine via command line due to the fact that the enviroment
variable is indeed set on the specific machine for the specific user.

What is the best way (syntax) to set this variable in the script?
Commonly on a machine, the environment variable would look something
like this...

PGPPATH=/wherever/pgp/is/located/

Thanks in advance.


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

Date: Fri, 12 Dec 1997 16:29:18 -0500
From: Eryq <eryq@zeegee.com>
To: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: Re: WANTED: "generic" logfile parse/report
Message-Id: <3491ACAE.5DD1@zeegee.com>

[courtesy CC to author]

Martien Verbruggen wrote:
> 
> In article <348F149C.3CF@zeegee.com>,
>         Eryq <eryq@zeegee.com> writes:
(snip)
> > That "last string" is a slightly difficult problem, since you can have
> > weird directory names which include spaces; e.g., "/usr/local/whoa there/kid".
> 
> Since it is the last field, however, you can use split with three arguments
                  ^^^^
                  ^^^^
Only if you assume that the lines he's interested have a fixed 
number of "fields" before the path element.  I read his post literally:

| Every night the log file generates multiple 
| lines for each client but Im only interested in lines whose last string
| contain a directory tree structure, something similar to:
| 
| dlt_00         somehost.somedomain.com 12/06/97 802 MB full /
| dlt_00         somehost.somedomain.com 12/06/97 236 MB full /usr/people
| dlt_00         somehost.somedomain.com 12/06/97 163 MB full /usr/share


My response is, "what do you mean by 'last' and 'string'"?  Are there
a fixed number of nonwhite fields before the 'last' string?  Can nonwhite
pathnames be assumed?
  
Which is why I said that he would need to give us a more complete
description of the syntax of the log file for us to help him out
more.  

Certainly I agree that the problem is simple if all the log
file lines appear as shown, especially if the number of fields are
fixed.  But if some lines has 5 fields total, and some have 10, then
simply using split() won't necessarily work.

Regards,
-- 
   ___  _ _ _   _  ___ _   Eryq (eryq@zeegee.com)
  / _ \| '_| | | |/ _ ' /  President, Zero G Inc.
 |  __/| | | |_| | |_| |   "Talk is cheap. Let's build." - Red Green.
  \___||_|  \__, |\__, |___/\  Visit STREETWISE, Chicago's newspaper by/
            |___/    |______/ of the homeless: http://www.streetwise.org


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

Date: 12 Dec 1997 23:00:07 GMT
From: Roedy Green <roedy@BIX.com>
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <66sfln$uac@lotho.delphi.com>

Mix wrote:
>hich language will pay top 17457 in the long run?

Two answers:

1. Philistine.  Which language you should study is a RELIGIOUS issue.

2. the law of supply and demand.  Java programmers are in shorter supply
now, but then C++ programmers are harder to manufacture.

For the JAVA GLOSSARY and the CMP Utilities: http://oberon.ark.com/~roedy
--
Roedy Green               Roedy rhymes with Cody   roedy@bix.com ICQ:5144242
Canadian Mind Products    contract programming     (250) 285-2954
POB 707 Quathiaski Cove   Quadra Island BC         Canada V0P 1N0 
-30-


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

Date: Fri, 12 Dec 1997 17:45:27 -0800
From: "Michael D. Kersey" <mdkersey@hal-pc.org>
To: Mix <mixmaster@remail.obscura.com>
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <3491E8B7.3E2@hal-pc.org>

Mix wrote:
> 
> Please accept my apologies for the anonymous way of posting. I will
> graduate from a college very soon with a Computer Science degree under
> my belt and I need a career advice from seasoned professionals.
Well then, it's too late: you should have asked us when you _entered_
college! But, even at this late date, my recommendation would be the
same: you should learn Chinese, probably the Mandarin dialect. 
HTH,
Michael D. Kersey
> 
> Unfortunately, my college taught languages that were "scientifically"
> correct but useless practically. FORTRAN is dead and has started to stink
> because of its poor and incomprehensible grammar, and its emphasis on
> poor programming style. It was good for the punch card epoch but not
> for the client-server world.
> 
> Eiffel is a good language for people who are just starting to learn
> programming, but is not a good choice for non-novices. ADA has always
> been the DOD's pet language which has never been accepted outside the
> military-industrial complex. Smalltalk hardly deserves a mention.
> 
> As a sad result of all that, the jobs for these languages are almost
> nonexistent and the salaries are not that great. I will have to accept
> that I need to forget them in order to make decent money.
> 
> That leaves me with the only alternative -- C++ or Java. Both languages
> have been hugely successful DESPITE their design flaws. I am ready to
> accept the necessity to use these languages if that's where the job market
> is headed. Both languages have excellent implementations for both Windows
> and Unix platforms.
> 
> The question is, which language will pay top 17457 in the long run? Java is
> still in its infancy but seems to have a great potential. C++ is a mature
> albeit cumbersome language and is probably poised to become a legacy
> language later. The jobs will be there in the long run, although the
> market will likely never be as good as now. What do you think about it?


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

Date: Sat, 13 Dec 1997 00:15:00 GMT
From: grunes@imsy1.nrl.navy.mil (Mitchell R Grunes)
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <grunes.604.881972100@imsy1.nrl.navy.mil>

>As a sad result of all that, the jobs for these languages are almost
>nonexistent and the salaries are not that great. I will have to accept
>that I need to forget them in order to make decent money.

None of the languages you mentioned are completely dead, but that 
is another 
matter.

All you have to do is go through the job posts, at places like 
www.careerpath.com, and other such places, and you will see what 
people want.  If you don't recognize the buzzwords, try another
listing.

I just did, in the course of a job search.

If you really want money there is one high paying route right now:
Learn COBOL, RPG, JAVA, C++, and SQL, and program or port
big database stuff for big business and/or over the web.  I saw ads
for up to $125K.  You should have been doing all of these things
for at least 20 years (a little longer than JAVA, C/C++ have been 
around).  Also you need prior work experience in database design, sales, 
marketing,  and management.  You must be willing to travel and relocate, 
preferably to the mideast (but the life insurance is very good).  Oh, 
did I mention IBM Mainframe experience, as well as Unix, PCs, Macs, 
network programming,and the ability to run networking systems.  You 
must be very flexible in your working hours--sometimes you may even 
go home to sleep.  

A little less money is available for people who work on very 
secret government contracts, doing things you may possibly 
find out about only after you are hired and get the background 
checks.  You must know C and C++, Fortran, ADA, some 
database and visualization stuff, and have a working 
knowledge of electrical engineering, physics, and a good 
understanding of bits and bytes and file formats on a few
hundred platforms, as well as be able to operate PCs, Macs 
and Unix boxes, and have some experience on every computer 
system the miliitary ever bought.  You must be willing to 
travel and relocate, to places they won't tell you about.   
Some management experience and the proven ability to win
government contracts would definitely help.  Joint PhD's 
in physics, computer science and electrical engineering
are a definite plus.

All computer jobs requiring a bit less skill for good money 
have disappeared for the present, unless you want to work 
for free.

If you don't fit these requirements, several places have a few
jobs for people who can flip burgers very rapidly.

Some other jobs exist.  They are available through personal 
contacts.  I hope you had a good relationship with
your professors, and they had good relationships with their
sponsors, who had better still be in the money.
-------------------------------------------------------------
Mitchell R Grunes, grunes@imsy1.nrl.navy.mil.  Opinions are mine alone.



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

Date: 13 Dec 1997 00:13:35 GMT
From: seebs@plethora.net (Peter Seebach)
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <66sjvf$i61$3@darla.visi.com>

In article <3491E8B7.3E2@hal-pc.org>,
Michael D. Kersey <mdkersey@hal-pc.org> wrote:
>Well then, it's too late: you should have asked us when you _entered_
>college! But, even at this late date, my recommendation would be the
>same: you should learn Chinese, probably the Mandarin dialect. 

While he's probably joking, let me be the first to point out that knowing
*any* second or third natural language will help you program effectively.

-s
-- 
seebs@plethora.net -- I am not speaking for my employer.  Copyright '97
All rights reserved.  This was not sent by my cat.  C and Unix wizard -
send mail for help, or send money for a consultation.  Visit my new ISP
<URL:http://www.plethora.net/> --- More Net, Less Spam!  Plethora . Net


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

Date: 12 Dec 1997 19:27:11 -0500
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <dewar.881972633@merv>

PLEASE NOTE THAT THIS RATHER STRANGE POST WAS MASSIVELY CROSSPOSTED. PLEASE
do NOT SIMPLY FOLLOWUP (otherwise we will get long annoying crossposted
threads). If you feel the post requires an answer, please consider answering
by email. THANKS.

I post this because on some of the previous threads, I discovered that a lot
of people, many new to the newsgroups I get, were completely oblivious to the
issue of cross posting (someone even posted a plaintiff "why is this being
posted to the APL group", not realizing that his question was itself
massively cross-posted. Please check for crossposting before following up.



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

Date: 13 Dec 1997 00:09:46 GMT
From: nospam@somewhere.ia.us (Robert S. White)
Subject: Re: Which language pays most 17457 -- C++ vs. Java?
Message-Id: <66sjoa$qfe$1@flood.weeg.uiowa.edu>

In article <199712121931.LAA25389@sirius.infonex.com>, 
mixmaster@remail.obscura.com says...
>
>Please accept my apologies for the anonymous way of posting. I will
>graduate from a college very soon with a Computer Science degree under
>my belt and I need a career advice from seasoned professionals.
>
>Unfortunately, my college taught languages that were "scientifically"
>correct but useless practically. FORTRAN is dead and has started to stink
>because of its poor and incomprehensible grammar, and its emphasis on
>poor programming style. It was good for the punch card epoch but not
>for the client-server world.
>
>Eiffel is a good language for people who are just starting to learn
>programming, but is not a good choice for non-novices. ADA has always
>been the DOD's pet language which has never been accepted outside the
>military-industrial complex. Smalltalk hardly deserves a mention.
>
>As a sad result of all that, the jobs for these languages are almost
>nonexistent and the salaries are not that great. I will have to accept
>that I need to forget them in order to make decent money.
>
>That leaves me with the only alternative -- C++ or Java. Both languages
>have been hugely successful DESPITE their design flaws. I am ready to
>accept the necessity to use these languages if that's where the job market
>is headed. Both languages have excellent implementations for both Windows
>and Unix platforms.
>
>The question is, which language will pay top 17457 in the long run? Java is
>still in its infancy but seems to have a great potential. C++ is a mature
>albeit cumbersome language and is probably poised to become a legacy
>language later. The jobs will be there in the long run, although the
>market will likely never be as good as now. What do you think about it?

  What I think is that the language "du jour" is not really that
important as is good computer science and software engineering
principals that, _hopefully_ any decent higher education institute
teaches.  Where I work at an aerospace/electronics Fortune 100 company, 
Fortran is still very much used by "analysts" to solve theoretical 
problems that the rest of us "code pounders" translate into embedded
systems code.  A clue here, we don't use Java or C++ yet.  If you are
working _only_ on Internet commerce or for Microsoft maybe you should
worry a _lot_ about Java or C++.  Otherwise you may be surprised.  The
employer you really want to work for may use Eiffel, Smalltalk or Ada95
for their important applications.  I've heard that Cobal knowledge in
London earns the biggest bucks.

  Wow! I trimmed only one newsgroup from this cross-posted monster!
Followups may be able to do better.  :-/
_____________________________________________________________________
Robert S. White         -- An embedded systems software engineer
e-mail reply to reverse of: ia us lib cedar-rapids crpl shift2 whiter



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

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

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