[16356] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3768 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 21 14:11:17 2000

Date: Fri, 21 Jul 2000 11:10:22 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <964203022-v9-i3768@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 21 Jul 2000     Volume: 9 Number: 3768

Today's topics:
    Re: Matts Script Archive - A critique <fty@mediapulse.com>
    Re: Matts Script Archive - A critique <godzilla@stomp.stomp.tokyo>
        Need code to parse MSIE 5.x Cookie Files <Timothy.Clemmer@lexis-nexis.com>
        Need Help on Perl CGI... <Davidhoonkim@hotmail.com>
    Re: Need Help on Perl CGI... <laf@gameonline.co.uk>
    Re: Need Help on Perl CGI... <Davidhoonkim@hotmail.com>
        newbie question re regular expressions pooh23@my-deja.com
    Re: newbie question re regular expressions michaeld@brown-cole.com
    Re: Newbie: What's wrong with my code? <tom.kralidis@ccrs.nrcanDOTgc.ca>
    Re: Odd or even ? (Csaba Raduly)
        password unix with crypt melet@my-deja.com
    Re: password unix with crypt <turnere0@my-deja.com>
    Re: password unix with crypt (hymie!)
        Pipe / IPC problem <waudsj@clarkson.edu>
        Problem building 5.005.03 on HP-UX <rob@frii.com>
    Re: Problem with NET::FTP -- same problem etienno@my-deja.com
    Re: Q : How to mimic awk's "in" operator <aqumsieh@hyperchip.com>
    Re: read system response in CGI <honglan00NOhoSPAM@yahoo.com.invalid>
    Re: Reading 3D form into 3D Array (Neil Kandalgaonkar)
    Re: READING hashes eats memory!? <bert@scanlaser.nl>
    Re: Recursive subroutine output to recursive subroutine (Neil Kandalgaonkar)
    Re: Recursive subroutine output to recursive subroutine firstname.lastname@nokia.com
        redirection fails <haggi@tappe.net>
    Re: Saving space in a hash (Keith Calvert Ivey)
        Script behaving differently from command line and by CG <stumo@bigfoot.com>
    Re: Script behaving differently from command line and b <tony_curtis32@yahoo.com>
    Re: Sending mail using sockets <gus@black.hole-in-the.net>
        SIGSEGV Error <dwishar1@ford.com>
    Re: Submit forms to perl/cgi <gpitman@nb.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 21 Jul 2000 09:22:45 -0400
From: "Jay Flaherty" <fty@mediapulse.com>
Subject: Re: Matts Script Archive - A critique
Message-Id: <8l9iue$pmg$1@news3.icx.net>

"Richard Lawrence" <ralawrence@my-deja.com> wrote in message
news:8l71dt$lbj$1@nnrp1.deja.com...
> Has anyone ever written a critique of any of the scripts Matt has
> written? My perl isn't good enough to spot them myself but I think it
> would be an excellent learning tool for myself and others out there.

What ever happened to the "CRAP" project/idea?

jay




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

Date: Fri, 21 Jul 2000 10:36:33 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Matts Script Archive - A critique
Message-Id: <39788A21.EFBB05D4@stomp.stomp.tokyo>

H C wrote:

> 1.  Could someone provide links to the following script archives?
 
> > Why not scripts written by Selena Sol, Tim Ziegler,
> > Brian Selensky as well? Seems Steve Brenner is quite
> > famous. His libraries are critiqued here more often
> > than Matt's scripts. Why not Brenner as well?
 

Info about Selena Sol and his work is buried somewhere
in this site. Cannot remember his site addy, some odd
name like 'xtropia' or similar.

http://wdvl.com/Authoring/Languages/Perl/PerlfortheWeb/toc.html


You can begin to find info about Ziegler and Slesinsky
at this site. Note originally I misspelled Slesinksy.

http://hotwired.lycos.com/webmonkey/programming/perl_cgi/index.html


Steve Brenner is famous for his cgi-lib libraries and famous
for being one of the founding fathers of Perl. His work is
scattered all over the net.

Godzilla!

--
print "file:///%43|%2f";


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

Date: Fri, 21 Jul 2000 09:57:10 -0400
From: "Timothy Clemmer" <Timothy.Clemmer@lexis-nexis.com>
Subject: Need code to parse MSIE 5.x Cookie Files
Message-Id: <8l9ks1$dj1$1@mailgate2.lexis-nexis.com>

I'm using HTTP::Cookies on a PC and would like to load the cookie jar with
the user's cookies as saved by Microsoft Internet Explorer.

Has anybody done this?  Any advice?

While Netscape's format is well documented on the web, I have found precious
little about the format of the MSIE cookie files.  I know where they are,
and I know the naming scheme, but have yet to discover the format.  Perhaps
there's a module for me on CPAN?

Please help!

-tim






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

Date: Fri, 21 Jul 2000 09:34:48 -0700
From: "Dave Kim" <Davidhoonkim@hotmail.com>
Subject: Need Help on Perl CGI...
Message-Id: <9NEc6Dz8$GA.216@news1.sys.netsgo.com>

I need some help, please.

I am trying to create a web link to a Perl-CGI script, instead
of using form method.  I followed everything I should do.
I tested the program on the server(Linux), and it works fine there.
But when I try to call it from a webpage link, it only gives me a internal
server error.  It is a very simple script and has no error in it.

<A HREF="http://www.myweb.com/cgi-bin/myscript.pl?num=4">4.</A>

TIA,
Dave Kim





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

Date: Fri, 21 Jul 2000 17:45:22 +0100
From: "Neil Lathwood" <laf@gameonline.co.uk>
Subject: Re: Need Help on Perl CGI...
Message-Id: <964198246.26630.0.nnrp-02.c246f12b@news.demon.co.uk>

I think you need to sort out your url first and alos supply the code for us
to have a look at.

Neil

"Dave Kim" <Davidhoonkim@hotmail.com> wrote in message
news:9NEc6Dz8$GA.216@news1.sys.netsgo.com...
> I need some help, please.
>
> I am trying to create a web link to a Perl-CGI script, instead
> of using form method.  I followed everything I should do.
> I tested the program on the server(Linux), and it works fine there.
> But when I try to call it from a webpage link, it only gives me a internal
> server error.  It is a very simple script and has no error in it.
>
> <A HREF="http://www.myweb.com/cgi-bin/myscript.pl?num=4">4.</A>
>
> TIA,
> Dave Kim
>
>
>




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

Date: Fri, 21 Jul 2000 10:09:19 -0700
From: "Dave Kim" <Davidhoonkim@hotmail.com>
Subject: Re: Need Help on Perl CGI...
Message-Id: <2V5pMXz8$GA.216@news1.sys.netsgo.com>

Thanks for your help!
The script is very simple. I created it to test if it works or not.

#!/usr/bin/local/perl
print "<html><head><title>Yes</title></head>\n";
print "<body>\n";
print "<h1>This is working!...</h1>\n</body></html>\n";

BTW, what do you mean by "sort out the url"?  I am a
novice at Perl CGI.

God bless you!
Dave Kim


Neil Lathwood <laf@gameonline.co.uk> wrote in message
news:964198246.26630.0.nnrp-02.c246f12b@news.demon.co.uk...
> I think you need to sort out your url first and alos supply the code for
us
> to have a look at.
>
> Neil
>
> "Dave Kim" <Davidhoonkim@hotmail.com> wrote in message
> news:9NEc6Dz8$GA.216@news1.sys.netsgo.com...
> > I need some help, please.
> >
> > I am trying to create a web link to a Perl-CGI script, instead
> > of using form method.  I followed everything I should do.
> > I tested the program on the server(Linux), and it works fine there.
> > But when I try to call it from a webpage link, it only gives me a
internal
> > server error.  It is a very simple script and has no error in it.
> >
> > <A HREF="http://www.myweb.com/cgi-bin/myscript.pl?num=4">4.</A>
> >
> > TIA,
> > Dave Kim
> >
> >
> >
>
>




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

Date: Fri, 21 Jul 2000 16:55:15 GMT
From: pooh23@my-deja.com
Subject: newbie question re regular expressions
Message-Id: <8l9v9a$k9p$1@nnrp1.deja.com>

hello,
I am having the hardest time understanding regular expressions.  Could
someone point me to a really good url.  I have tried reading some
material on the web, but they lack in a good explanation of the
expressions.  I'm trying to understand some code I'm reading:

tr/+/ /;
-replace plus with blank

s/%(..)/pack('c', hex($1))/eg;

$value = s/&lt;i&gt;/<b>/ig;

Any help appreciated!!
Thanks.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 21 Jul 2000 17:40:46 GMT
From: michaeld@brown-cole.com
Subject: Re: newbie question re regular expressions
Message-Id: <8la1uq$mk8$1@nnrp1.deja.com>

In article <8l9v9a$k9p$1@nnrp1.deja.com>,
  pooh23@my-deja.com wrote:
> hello,
> I am having the hardest time understanding regular expressions.  Could
> someone point me to a really good url.  I have tried reading some
> material on the web, but they lack in a good explanation of the
> expressions.  I'm trying to understand some code I'm reading:

Some of the other regulars on the group may differ with my opinion, but
the online and bundled docs don't seem to be very helpful for many
newbies, myself included.  I would recommend a good book on perl.  The
one I use is Perl 5 by Example by que (isbn 0-7897-0866-3).  It's got
some pretty good info on regexes.  You should probably browse through
the O'Reilly books.  They seem to be the standard.

> tr/+/ /;
> -replace plus with blank
> s/%(..)/pack('c', hex($1))/eg;

These two expressions seem to be URL decoding.  in short, it turns
plusses into spaces and convert hexadecimal digits into regular
characters.  Let me guess: you found this inside a web script?

> $value = s/&lt;i&gt;/<b>/ig;

I'm not too sure exactly what /&lt;i&gt;/ is, but the expression seems
to be replacing all occurences of that string with <b> regardless of
case.  Given that your previous examples were web-based, we could
assume that /&lt;i&gt;/ is formatting of some sort.  lt and gt are
comparison operators for less than and greater than, but I'm not too
sure that's the context they're being used in.
That's just a guess.  I'm sure someone will post with a real
explanation.

> Any help appreciated!!
> Thanks.

No sweat.  I've gotten enough help from lurking in this group that it's
about time I tried to give someone else a hand.  Good for the karma,
you see.

--
--------------------------
michaeld_at_brown-cole.com
binky_at_bingo-lan.org


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 21 Jul 2000 10:03:53 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: Re: Newbie: What's wrong with my code?
Message-Id: <39785849.CCD8DB78@ccrs.nrcanDOTgc.ca>

Eric Selin wrote:
> 
> How do I correct this. It prints "abbb".
> 
> if ($FORM{c} ==  "a") {
> print "lisaa";
> print $FORM{c};
> }
> 
> if ($FORM{c} ==  "b") {
> print "poista";
> print $FORM{c};
> }

Use string comparison operators for strings, eg:

if ($FORM{c} eq "a") {
 ...

Hope this helps.

 ..Tom

=================================
Tom Kralidis
Geo-Spatial Developer
Canada Centre for Remote Sensing
Tel: (613) 947-1828
Fax: (613) 947-1408
http://www.ccrs.nrcan.gc.ca
=================================


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

Date: 21 Jul 2000 15:03:25 GMT
From: csaba_r@my-deja.com (Csaba Raduly)
Subject: Re: Odd or even ?
Message-Id: <8F78A096Equuxi@194.203.134.200>

20 Jul 2000: A formal bug report was sent to Seti@Home, because the
following message originated from anno4000@lublin.zrz.tu-berlin.de
(Anno Siegel) was reported as containing signs of intelligence: 

>Jimmy Lantz  <webmaster@ostas.lu.se> wrote in comp.lang.perl.misc:
>>Hi,
>>
>>
>>The thing I need is to get every other item to be treated
>>differently. I thought to make the distinction odd or even number
>>then treat the objects differently depending if its odd or even. 
>
>[snippage]
>
>>Does anyone has a clue on how to go about it?
>
>Yes. Look up the % operator.
>
>Anno

Or the & operator:

#!perl -w
foreach my $i(0..9){
   if( $i & 1 ){
      print "$i is odd\n";
   }
   else{
      print "$i is even\n";
   }
}

My computer does 1040 ANDs and 1025 MODs per second.
-- 
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com      http://www.sophos.com/
US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
Life is complex, with real and imaginary parts.


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

Date: Fri, 21 Jul 2000 14:30:13 GMT
From: melet@my-deja.com
Subject: password unix with crypt
Message-Id: <8l9mp6$dhi$1@nnrp1.deja.com>

hello,


How retrieve the unix password with the function crypt.
I know thaat you lust find the encrypted password in shadow
or /password and apply crypt with the password not encrypted.

But, i am not ok!

thanks , fred


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 21 Jul 2000 15:43:20 GMT
From: turnere <turnere0@my-deja.com>
Subject: Re: password unix with crypt
Message-Id: <8l9r2j$gr7$1@nnrp1.deja.com>

In article <8l9mp6$dhi$1@nnrp1.deja.com>,
  melet@my-deja.com wrote:
> hello,
>
> How retrieve the unix password with the function crypt.
> I know thaat you lust find the encrypted password in shadow
> or /password and apply crypt with the password not encrypted.
>

You cannot decrypt a unix-encrypted password. If you want to verify that
someone has entered the correct password, just encrypt what they have
entered and compare that with the encrypted password already stored in
passwd or shadow.

> But, i am not ok!
>
> thanks , fred
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 21 Jul 2000 17:26:13 GMT
From: hymie@lactose.smart.net (hymie!)
Subject: Re: password unix with crypt
Message-Id: <8la13l$l8$1@news.smart.net>

In our last episode, the evil Dr. Lacto had captured our hero,
  melet@my-deja.com, who said:

>How retrieve the unix password with the function crypt.

You can't.  It's a one-way algorthim.

hymie!          http://www.smart.net/~hymowitz          hymie@lactose.smart.net
===============================================================================


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

Date: Fri, 21 Jul 2000 13:53:44 -0400
From: "Stephen Waud" <waudsj@clarkson.edu>
Subject: Pipe / IPC problem
Message-Id: <8la2fj$pl6$1@news.btv.ibm.com>

hi,
  i'm working on a file-transfer application where i've got a Tk main GUI
process that spawns off children to handle events that happen on the
fileserver.. i've been using named pipes to sling messages back from the
children so the main gui can display them.. the problem i'm having is that
the final output of one command keeps repeating in another.. i'm using
different pipes for each command, and each command gets terminated by the
message "done\n".. however, when the second command in a session is run, all
it sees is "done\n" over and over.. unless you continuously read from it..
ex:

this results in "done\n" :

<$handle>;
print $_;

while this gets the proper output:

while (<$handle>)
{
    print "$_";
    last;
}

this inelegant solution seems to be working for now but i think it may be
indicative of a more important problem.. any thoughts?? thanks..

    ~regards  steve


--
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Stephen Waud              'Show a Little Sunshine Every Day'
frizzy@softhome.net             'in a minute i'll be free..'
homepage: http://www.clarkson.edu/~waudsj/
got folk?: http://www.clarkson.edu/~waudsj/strangefolk/
-------"we live in and of each other- we will remain"-------




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

Date: Fri, 21 Jul 2000 09:41:13 -0600
From: Rob Greenbank <rob@frii.com>
Subject: Problem building 5.005.03 on HP-UX
Message-Id: <k0rgnsgndn0ntj0q3n15sk430grolp1f03@4ax.com>

I've run into a strange problem.  Background first -- a vendor needed
a shared libperl, so I built one (upgrading to 5.6 at the same time)
and all worked well.  Now the vendor wan't me to go back to perl
5.005.03, as they haven't tested their product with 5.6.  Now it's not
working well.  

I'm building on HP-UX 11.0, and my source is in /usr/local/src.  That
directory is "drwxr-x---", for our own reasons, which is probably the
only reason I discovered this.  When I build the shared library
everything tested, installed, and ran after the install as root.  As a
final check I dropped back to myself and ran "perl -v" with the
following, dissapointing results:
	$  perl -V
	/usr/lib/dld.sl: Can't open shared library:
/usr/local/src/perl5.005_03/libperl.sl
	/usr/lib/dld.sl: Permission denied
	Abort

The shared library is being build and installed where is should be:
	$> find /opt/perl5/lib -name 'libperl*'
	/opt/perl5/lib/5.00503/PA-RISC2.0/CORE/libperl.sl

The make files, however, have the following line:
	LDLIBPTH = LD_LIBRARY_PATH=/usr/local/src/perl5.005_03:
which is, I think, the root of the problem.  

I changed that line to point to the real path to libperl.sl, but I'm
still getting the same results.  

Anyone have any clues here?  I'm continuing to research this, and will
follow up if I find a solution.  I tried several different Deja News
searches (the ultimate ultimate resource, of course) with no hits.  

Thanks,

	Rob Greenbank
	(rob@frii.com)




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

Date: Fri, 21 Jul 2000 15:58:47 GMT
From: etienno@my-deja.com
Subject: Re: Problem with NET::FTP -- same problem
Message-Id: <8l9rvo$roi$1@nnrp2.deja.com>

Hi, i have the same problem. And I tried to
install libnet twice but it still tell me the
same error...

Can't locate object method "new" via
package "Net::Ftp" at [.....]\cgi-bin\ex1\ftp.pl
line 9.


-- PPM don't seems to install a full version of
NET (libnet)..

Thanks for answering
Etienne,
Montreal
info@digitaltango.com

In article
<3AB765F8A8C14B82.B0368CB35F6B9A91.F0A17BACBDF10D3
C@lp.airnews.net>,
  nnickee@nnickee.com wrote:
> On Thu, 06 Jul 2000 20:57:03 +0800, someone
claiming to be chee hong
> <wchong@pacific.net.sg> said:
>
> >Hi there,
> >Below is my script for performing a FTP.
>
> >use Net::FTP;
> >$username = "userid";
> >$password = "password";
> >$host = "203.116.93.133";
> >$ftp = Net::FTP->new("$host", Debug => 1);
<<<< line 6
> >$ftp->login($username, $password) or die "cant
login\n";
>
> >Everytime I run my script, the following error
message appears.
> >Can't locate object method "new" via
package "Net::FTP" at test.pl line
> >6.
>
> >What is wrong?
>
> Have you *manually* installed the libnet
bundle?  It comes with
> activestate's perl, but I've noticed that on my
systems and on a few
> other people's systems at least, the modules in
it don't get fully
> installed until you manually install it.
>
> Open up a dos prompt, in it type:  ppm
> then type install libnet
> answer yes if it gives you any grief about re-
installing or
> reconfiguring
> another dos window will pop up, answer y to the
first question about
> configuration, then either put in correct
answers or just hit Enter to
> have it default on all the other questions.
> After you exit ppm, your script should work.
>
> Nnickee
>
>



Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 21 Jul 2000 13:43:05 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Q : How to mimic awk's "in" operator
Message-Id: <7a8zuviopg.fsf@merlin.hyperchip.com>


"Gregory K. Deal" <gregory.deal@unisys.com> writes:

> I often use awk's "in" to check for existence, e.g.  if (item in
> array) . To instantiate an associative array item in awk, I would just
> reference it : array[something]. In Perl, it looks like I have to
> assign it, like $array{something}++, to get either the "defined" or
> "exists" function to report true. Is this necessary? Thanks.

defined() is different from exists(). If you check a hash element for
defined()ness, then you are really checking whether the value is
anything other than 'undef'.

If you check a hash element for exists()ence, then you are really
checking whether that key exists in the hash or not, irrespective of the
value associated with it.

To define a key in your hash (and you don't care about the value, as you
seem to want), then you can simply do:

	$hash{$key} = undef;

but your approach should work too:

	$hash{$key}++;

Then, awk's in() operator is identical to using Perl's exists()
function:

	if (exists $hash{$key}) {
		# do your thing.
	}

--Ala


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

Date: Fri, 21 Jul 2000 10:55:46 -0700
From: jerry <honglan00NOhoSPAM@yahoo.com.invalid>
Subject: Re: read system response in CGI
Message-Id: <028fbf06.829a1d10@usw-ex0104-087.remarq.com>

Hi, Makarand,
Thanks for the hint. I did write a form allow user to specify the
name of the script and parameters.
Then in my cgi script, I used open3(RDR, WTR, ERR, mycommand) to
execute the program on the host. However, the program just went
dead after it went thought the initial phase.  I can read some
system response from RDR, but not error message. Any idea? Or any
reference website you happen to know?

my script

use CGI;

 ...
if (param())
{
 ..

#launch system program here
$pid = open3(WTR, RDR, ERR, "generateReport") ;

#read system response
while (<RDR>){
  print p("$_") ;

}




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

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: Fri, 21 Jul 2000 15:31:52 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: Reading 3D form into 3D Array
Message-Id: <8l9pvl$7ij$1@localhost.localdomain>

In article <ZdTd5.4612$eS6.148282@news1.rdc1.md.home.com>,
Robert Brooks <studentfl@hotmail.com> wrote:

>I need to read this information in to a perl program. I tried to do a loop
>with a variable inside a variable, for instance $name = $INPUT{'name$x'}

That won't work because '' is not interpolated. $INPUT{"name$x"} would work.

It looks like you are not using CGI.pm, possibly using cgi-lib.pl. Most people
find CGI.pm to be easier, safer, and more powerful.

-- 
Neil Kandalgaonkar <neil@brevity.org>


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

Date: Fri, 21 Jul 2000 18:05:08 +0200
From: Bert IJff <bert@scanlaser.nl>
To: Ken Barr <kenneth.c.barr.nospam@intel.com>
Subject: Re: READING hashes eats memory!?
Message-Id: <397874B4.BE9603BA@scanlaser.nl>

I once had the same strange behaviour.

Upgrading from 5.005.03 to 5.6.0 cured the pain

hth
Bert

Ken Barr wrote:
> 
> I have a huge hash-of-hash table (with 1st and 2nd level keys that are 32
> bit ints, if that matters).  It gets created in about 2-3 megs of memory...
> When I start to access the table in a loop, however, memory usage
> BALLOONS!!!  Reading from the table once it exists in memory shouldn't
> require more than one extra word of memory (which I would happily reuse each
> iteration of the loop).  How can I do:
> 
> foreach $src (keys(%src)){
>     foreach $dst (keys(%dst)){
>          $i=$cell{$src}{$dst}{packets}
>     }
> }
> 
> without running out of memory?  BTW, swapping the foreach/keys with
> while/each doesn't help.
> 
> Thank you,
> Ken


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

Date: Fri, 21 Jul 2000 15:18:31 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: Recursive subroutine output to recursive subroutine problem
Message-Id: <8l9p5o$7gu$1@localhost.localdomain>


D'oh! The first time I read your post I got about 3 pages deep into the
code and gave up. I didn't see your note about not being able to use my() 
at the end.

You have perl4. (Type perl -v at the command line.) 

If I were you, my first priority would be to get perl 5. You may already have
it; some misguided admins put perl4 under /usr/bin/perl and perl5 under 
/usr/bin/perl5 or some such.

-- 
Neil Kandalgaonkar <neil@brevity.org>


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

Date: Fri, 21 Jul 2000 11:37:13 -0500
From: firstname.lastname@nokia.com
Subject: Re: Recursive subroutine output to recursive subroutine problem
Message-Id: <DB58F47B6CFE4CBC.86221CBC936CCEEE.E42946E775907BA8@lp.airnews.net>

On Fri, 21 Jul 2000 15:18:31 GMT, neil@brevity.org (Neil
Kandalgaonkar) wrote:

>
>D'oh! The first time I read your post I got about 3 pages deep into the
>code and gave up. I didn't see your note about not being able to use my() 
>at the end.
>
>You have perl4. (Type perl -v at the command line.) 
>
>If I were you, my first priority would be to get perl 5. You may already have
>it; some misguided admins put perl4 under /usr/bin/perl and perl5 under 
>/usr/bin/perl5 or some such.

Neil,

First I'd like to thank you for your help with this and yes you are
right we are using version 4.  Now the fun part of getting them to
change it.  I had a feel ling that it had to do with the my() command.

Sorry about the length, but would the use of my() in place of the
local() correct the problem of the second subroutine keeping the
information from the pervious calls to it?

I know that my code is long and could be stream lined, I'm going to
work on that once I get this working as is.  I figured that with it
lengthy I can find problems easier because everything is 'spelled'
out.

Thanks,
Jack Angier


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

Date: Fri, 21 Jul 2000 19:48:13 +0200
From: "haggi@work" <haggi@tappe.net>
Subject: redirection fails
Message-Id: <39788CDD.2078865C@tappe.net>


Hi,

I'm trying to redirect a output in perl.

system("ls -l > outputfile");

I'm working with perl5.005 for cygwin. Windows NT.

redirection in the shell works.

haggi

-- 

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

	haggi
	www.haggi.de
	haggi@haggi.de

	haggi`s visual effects & animation

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


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

Date: Fri, 21 Jul 2000 12:27:42 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Saving space in a hash
Message-Id: <3978410c.43197167@news.newsguy.com>

The WebDragon <nospam@nospam.com> wrote:
>Russ Jones <russ_jones@rac.ray.com> wrote:

> | I'm building a hash that contains the same line of data, referenced
> | three different ways, like this:
> | 
> | 	$snmp{$ip}    = $snmp_info;
> | 	$snmp{$dns}   = $snmp_info;
> | 	$snmp{$alias} = $snmp_info;
[snip]

>how about a simple HoL ? 
>
>    $snmp{$ip} = [ $dns, $alias, $snmp_info ];

Presumably the idea is to be able to access the data in
$snmp_info by IP address, DNS name, or alias, whichever you
happen to have.  With your way, you can't get the data (without
searching through the whole hash) unless you know the IP
address.

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
(Free at last from the forced spamsig of
Newsfeeds.com, cursed be their name)


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

Date: Fri, 21 Jul 2000 16:26:09 +0100
From: "Stuart Moore" <stumo@bigfoot.com>
Subject: Script behaving differently from command line and by CGI
Message-Id: <8l9q1v$7te$1@supernews.com>

The reason I've posted here is because although I suspect it's a CGI issue,
it could also have something to do with how Perl handles CGI.

I have a perl script that calls an external program (PGP) by piping data to
it and sending the output to a text file. For some reason, it works fine
when I run it via telnet, but when I run it through CGI the output is as if
it ignores all the parameters. The line in question is:
open(OUTPUT,
"|/usr/local/bin/pgpe -r\"email\@address1.com\" -r\"email\@address2.com\" -a
t >$$.enc");
(then the data is piped to it);
As I say, I get the expected output when running from telnet, but the output
from CGI is exactly what you'd get if you just typed pgpe from telnet
without any parameters. Am I missing something here?





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

Date: 21 Jul 2000 10:37:02 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Script behaving differently from command line and by CGI
Message-Id: <87n1jbbild.fsf@limey.hpcc.uh.edu>

>> On Fri, 21 Jul 2000 16:26:09 +0100,
>> "Stuart Moore" <stumo@bigfoot.com> said:

> I have a perl script that calls an external program
> (PGP) by piping data to it and sending the output to a
> text file. For some reason, it works fine when I run it
> via telnet, but when I run it through CGI the output is
> as if it ignores all the parameters. The line in

[ oops auotwrapped] 

> question is: open(OUTPUT, "|/usr/local/bin/pgpe
> -r\"email\@address1.com\" -r\"email\@address2.com\" -a t
> >$$.enc"); (then the data is piped to it); As I say, I

Well, firstly try different quoting characters

open(OUTPUT, '| ... ') || die ... ;

so you don't have to backslash the internal "".

> get the expected output when running from telnet, but
> the output from CGI is exactly what you'd get if you
> just typed pgpe from telnet without any parameters. Am I
> missing something here?

CGI programs often run with different user-ids to your
login session at the command line, e.g. as nobody.  Is
that the problem here?  Look in the CGI FAQ at

    http://www.boutell.com/

hth
t
-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Fri, 21 Jul 2000 13:18:41 GMT
From: Gus <gus@black.hole-in-the.net>
Subject: Re: Sending mail using sockets
Message-Id: <964185521.15764.0.nnrp-13.c29f015a@news.demon.co.uk>

Are Bjoerby <are.bjoerby@pineapple.no> wrote:
> Hi!

> I'm looking for a routine that will send mail using sockets. As I'm new to
> Perl an easy-to-integrate script is what I'm looking for.

Use the Net::SMTP module, available from CPAN as part of the 'libnet'
bundle.




-- 
gus@black.hole-in-the.net
0x58E18C6D
82 AA 4D 7F D8 45 58 05  6D 1B 1A 72 1E DB 31 B5
http://black.hole-in-the.net/gus/


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

Date: Fri, 21 Jul 2000 13:35:13 +0100
From: "Dave Wishart" <dwishar1@ford.com>
Subject: SIGSEGV Error
Message-Id: <8l9g29$s3i8@eccws12.dearborn.ford.com>

I am trying to write a multi-threaded server application which receives  a
data string onto a given socket, processes the data and sends a response
back. From reading the Camel book and 'UNIX Network Programming' I have come
up with the following code.

sub listener
{
 my $my_server_port;
 my $my_client_port;
 my $my_protocol;
 my $my_paddr;
 my $my_client_iaddr;
 my $my_client_name;
 my $my_cafeversion;

 $my_server_port=(shift or 49180);
 $my_server_port=$1 if $my_server_port =~ /(\d+)/; # untaint port number


 $my_protocol = getprotobyname('tcp') or die "Cannot getprotobyname: $!";
 socket(Server, AF_INET, SOCK_STREAM, $my_protocol) or die "Cannot create
socket $!";
 setsockopt(Server, SOL_SOCKET, SO_REUSEADDR, pack("l", 1)) or die "Cannot
setsockopt $!";
 bind(Server, sockaddr_in($my_server_port, INADDR_ANY)) or die "Cannot bind
$!";
 listen(Server,SOMAXCONN) or die "listen: $!";

 $SIG{CHLD} = \&REAPER;

 for ( $waitedpid = 0; ($my_paddr = accept(Client,Server)) or $waitedpid;
$waitedpid = 0, close Client)
     {
      next if $waitedpid and not $my_paddr;
      spawn sub
           {
           ($my_client_port,$my_client_iaddr) = sockaddr_in($my_paddr);
           $my_client_name = gethostbyaddr($my_client_iaddr,AF_INET);
           print "Connection received from $my_client_name
[",inet_ntoa($my_client_iaddr), "] at port $my_client_port \n\n";
           $message = <Client>;
           open(CAFERAWINPUT, ">./log/caferawinput/utfmessage.txt");
           print CAFERAWINPUT $message;
           close(CAFERAWINPUT);
           }; # end of spawn sub
     } # end of for loop
} # end of sub listener

sub spawn
{
 my $my_coderef = shift;
 my $my_pid;

 unless (@_ == 0 && $my_coderef && ref($my_coderef) eq 'CODE')
  {
        confess "usage: spawn CODEREF";
        }
 if (!defined($my_pid = fork))
  {
            return;
        }
 elsif ($my_pid)
  {
  return; # I'm the parent
        }

 # else I'm the child -- go spawn
 exit &$my_coderef();
} # end of sub spawn


Unfortunately I get the following error when the end of the spawn sub loop
is reached.


Caught a SIGSEGV at pre_dev2.pl line 243
$ = main::listener() called from file `pre_dev2.pl' line 51
Abort(coredump)

According to Steven's book a SIGSEGV is generated when a process tries to
access a memory address which it is not allowed to do.

As a newbie to System calls I took most of the code directly from the texts.

There's probably something obvious I'm missing but I can't see what it is.
I am running perl 5.004 with tainting and strict enabled on a Solaris 2.6
server


Suggestions please ?

Thanks in advance


Regards,

David Wishart
Server And Interface Team
Dealer Applications
FCE Bank plc

Tel: +44-(0)-1277-692570 Fax: +44-(0)-1277-692124
SMTP: dwishar1@ford.com
Mail: GB-12/300, Jubilee House, The Drive, Brentwood, Essex, CM13 3AR







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

Date: Fri, 21 Jul 2000 12:10:12 -0400
From: Gary Pitman <gpitman@nb.net>
Subject: Re: Submit forms to perl/cgi
Message-Id: <397875E6.9DDE816@nb.net>

http://www.lies.com/begperl/form_to_email.html

pepebordoy@my-deja.com wrote:

> hi,
> I am looking for simple perl/cgi
> coding that will process a form sent
> from html to an email address.
>
> There are alot of these scripts around but they contain other stuff for
> different functions.
>
> if anyone could help me on this it would be great, ohh I'D say you will
> have to tell me how to alter it to suit myself.
>
> thanks
> brian
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.



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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3768
**************************************


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