[13281] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 691 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 31 22:07:18 1999

Date: Tue, 31 Aug 1999 19:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 31 Aug 1999     Volume: 9 Number: 691

Today's topics:
    Re: <DATA> in a module(package) <tchrist@mox.perl.com>
    Re: a simple POST request <makkulka@cisco.com>
        broken pipe signal... (GEMINI)
        editors?? <stevencNOSPAM@nbnet.nb.ca>
    Re: editors?? <wyzelli@yahoo.com>
    Re: editors?? <tchrist@mox.perl.com>
    Re: essentially; making a long file name into a 8.3 fil <wyzelli@yahoo.com>
    Re: gethosybyaddr <tchrist@mox.perl.com>
    Re: how to open a file in the internet? <tchrist@mox.perl.com>
    Re: how to open file descriptor by number? (Dave Meyer)
    Re: Insecure dependency in open while running with -T s <tchrist@mox.perl.com>
    Re: Maybe too academic: How to build a (binary) tree (s <samay1NOrxSPAM@hotmail.com>
    Re: Maybe too academic: How to build a (binary) tree (s <meowing@banet.net>
    Re: Perl on PalmPilot <watcher_q@my-deja.com>
    Re: Perl Y2K Bugs on the Internet <jbc@shell2.la.best.com>
    Re: Perl Y2K Bugs on the Internet (Benjamin Franz)
        R: Dos Perl and System command <nando@tetecma.com>
        R: newbie needs help <nando@tetecma.com>
        R: regex bug: (?:\d{3})+ loses count <nando@tetecma.com>
        socket programing: implementing minSpare etc. <xah@weborder.com>
    Re: socket timeout fart123@my-deja.com
    Re: subtraction error (Larry Rosler)
    Re: variable help (Larry Rosler)
    Re: Why doesn't my undef an array? <tchrist@mox.perl.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 31 Aug 1999 18:46:03 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: <DATA> in a module(package)
Message-Id: <37cc774b@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    gml4410@ggr.co.uk (Lack Mr G M) writes:
:   I've been trying to use the <DATA> file handle to read a text stream
:from the end of the module code, but this doesn;t seem to work in a
:package, or when the module coded is sucked in by a "use".  Am I missign
:something, or is this not allowed?  (I'm using v 5.004p4).

You use __DATA__ in a module.

--tom
-- 
    "Unix was never designed to keep people from doing stupid things, because
     that policy would also keep them from doing clever things."  (Doug Gwyn)


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

Date: Tue, 31 Aug 1999 18:32:31 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: a simple POST request
Message-Id: <37CC822F.84776B7B@cisco.com>

[ vengence7140@my-deja.com wrote:

> the incoming message would be:
>  HTTP header ....
>  My body of text ....
>  I want to call a function to get My body of text.

Let us assume that you are using LWP::UserAgent in
your script that recieves this incoming message. Let
us also assume that the URL http://whatever.com/cgi-bin/somePerl.pl
when invoked through your script sends you this message.

use LWP::UserAgent;
use HTTP::Request ;
$ua = new LWP::UserAgent;
$request = new HTTP::Request('GET',
'http://whatever.com/cgi-bin/somePerl.pl' );
# this URL can be anything as long as it returns HTTP responses.
$response = $ua->request($request);

$response is now an instance of HTTP::Response.
HTTP::Response encapsulates HTTP::Message.
HTTP::Message has a method content() which you can use
to get your body.

if ($response->is_success) {
     print $response->content;
 } else {
     print $response->error_as_HTML;
 }

Read the perldocs for
LWP::UserAgent
HTTP::Request
HTTP::Response
HTTP::Message
--



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

Date: 1 Sep 1999 01:25:17 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: broken pipe signal...
Message-Id: <7qhv9t$18d$1@netnews.csie.NCTU.edu.tw>

hi all,

I got a big problem with broken pipe error while using FTP module.
When I use $ftp->put function to transmitt file and encounter
disk space full in remote host, the program will terminate without
returning to my control. I found that it is caused by Broken Pipe signal.
So I catch the signal by following codes:

#######################################
sub failure {
  print '[FTP ERROR]',$_[0];
  system "echo $_[0] >> error.log";
  die "program failed\n";
}
sub brokenpipe {
  failure("Broken pipe, disk full\n");
}
$SIG{PIPE}=\&brokenpipe;
########################################

however, I found that the signal was caught but
the failure subroutine cannot execute properly.
The "system" command spawn a shell to execute "echo ..." again and again...
and will not "die".

So I have no idea what's the matter with it.
Why can't I get $ftp to return false when error occurred rather than
getting an exception signal??

Thanks.


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

Date: Tue, 31 Aug 1999 21:16:47 -0300
From: "Caper" <stevencNOSPAM@nbnet.nb.ca>
Subject: editors??
Message-Id: <7qhraa$1rn$1@garnet.nbnet.nb.ca>

Any good Perl debuggers or editors to suggest?




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

Date: Wed, 1 Sep 1999 10:00:25 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: editors??
Message-Id: <zs_y3.10$5e5.3473@vic.nntp.telstra.net>

Caper <stevencNOSPAM@nbnet.nb.ca> wrote in message
news:7qhraa$1rn$1@garnet.nbnet.nb.ca...
> Any good Perl debuggers or editors to suggest?
>

I like PerlBuilder from Solution Soft.  It is an integrated Development
Environment with lots of nice little features.

www.solutionsoft.com

Cost you money though to get the full version!

Wyzelli




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

Date: 31 Aug 1999 18:50:29 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: editors??
Message-Id: <37cc7855@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    "Caper" <stevenc@nbnet.nb.ca> writes:
:Any good Perl debuggers or editors to suggest?

Debugger: perl -d
Editor:   vi (or nvi or vim) or emacs

--tom
-- 
Women and cats do as they dammed well please.  Men and dogs had best learn to 
 live with it...


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

Date: Wed, 1 Sep 1999 09:40:29 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: essentially; making a long file name into a 8.3 filename..
Message-Id: <U9_y3.9$5e5.3259@vic.nntp.telstra.net>

Kin Lum <kin@0011.com> wrote in message news:37CC5E50.5203B937@0011.com...
>
> Of course it is not a good practice.  But that's not what
> the original question asked for.  If it is good practice,
> maybe it is not a good practice to rename them to 8.3
> but to upgrade the old computer.

Sure.  That is generally a good option, if you think it is a good idea to
spend money rather than do it right.
The other point is that a Windows long filename already has an 8.3
representation.

And feel free not to e-mail me.

Wyzelli




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

Date: 31 Aug 1999 18:47:27 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: gethosybyaddr
Message-Id: <37cc779f@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Paul Farber <farber@admin.f-tech.net> writes:
:Can anyone spare a snippet of code that will get the hostname from an IP
:address?  I looked in the camel book but the book dosen't really cover
:ADDRTYPE.. and the function will not work without it.  So far I have:

That's because it requires basic socket knowledge.  Perl provides
interfaces to many things that require extra knowledge.  For example,
consider interfaces to Oracle.  That doesn't mean we teach SQL.

If you read the perlipc manpage, you may see what you want.

--tom
-- 
Unix never says `please.'  -- Rob Pike


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

Date: 31 Aug 1999 18:43:57 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: how to open a file in the internet?
Message-Id: <37cc76cd@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    "Z. Huang" <zhuang@ic.sunysb.edu> writes:
:
:      Can anyone tell me how to retrieve a file from the internet or point
:me to some samples? Thanks in advance.

% man perlfaq9

--tom
-- 
Please help me. When you download files on hacking and the file extension
is "c" how do you use it?
                -- antons@iafrica.com, in alt.hackers.malicious


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

Date: Wed, 01 Sep 1999 00:58:57 GMT
From: dmeyer@news.bellatlantic.net (Dave Meyer)
Subject: Re: how to open file descriptor by number?
Message-Id: <7qhtil$3h8$1@jhereg.dmeyer.org>

According to Randal L. Schwartz <merlyn@stonehenge.com>:
> >>>>> "Anno" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
> 
> Anno>   open FD7, '>&7' or die "Can't dup fd 7: $!\n";
> 
> Anno> should do it (untested).  See perldoc opentut (and presumably perldoc
> Anno> -f open) for details.
> 
> Unless something changed since the last time I looked at this feature,
> you need to say:
> 
> 	open FD7, ">&=7" ...
> 
> because otherwise "7" would be treated as the filehandle "7". :) The
> "=" makes it unambiguous.

Just wanted to thank folks for their help.  I didn't realize that >&=7
opened fd7 itself and not just a dup of it.

       Dave
       
-- 
David M. Meyer
meyer@virtc.com


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

Date: 31 Aug 1999 18:45:30 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Insecure dependency in open while running with -T switch
Message-Id: <37cc772a@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Makarand Kulkarni <makkulka@cisco.com> writes:
				^^^^^^^^^
:I don't know why it is doing this ? I am using Netscape Communicator 4.5?
:Can you suggest some windows95 newsreaders that might
:be helpful here ? I am not allowed to install Unix based newsreaders like
:Tin etc.

Funny, I always thought of Cisco has a high-tech company.  Silly me.

--tom
-- 
	    Rounded, wounded, grieve and sieve,
	    Friend and fiend, alive and live.


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

Date: Tue, 31 Aug 1999 17:11:36 +1700
From: Samay <samay1NOrxSPAM@hotmail.com>
Subject: Re: Maybe too academic: How to build a (binary) tree (structure)
Message-Id: <0221c012.727a1a4a@usw-ex0102-010.remarq.com>

1. Check some modules on CPAN
2. A Book of Algorithm in Perl is comming soon, ( as I have 
read) Look for that.



* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: 31 Aug 1999 21:33:45 -0400
From: meow <meowing@banet.net>
Subject: Re: Maybe too academic: How to build a (binary) tree (structure)
Message-Id: <87zoz7h0ue.fsf@slip-32-100-243-84.ma.us.ibm.net>

Ulf Rimkus <ulf.rimkus@okay.net> wrote:

> When I was just looking through my computer language books like them
> for C and PASCAL everyone takes a huge amount of paper to explain
> all about trees, pre-order, in-order search and stuff like that. Now
> I was trying to find out how to do that in Perl, but donīt have even
> an idea how to implement such a data structure in Perl.

See the standard DB_File module (or get BerkeleyDB for an alternative
interface).  For either, you'll want to link in with DB 2.x for any
large data sets, because DB 1.x had a buggy b-tree implementation.
(Don't worry about the name 'File' in the module; as you'll see in the
docs, in-memory trees are supported.)

This will let you treat your data as ordinary hashes, with the keys
automagically sorted.

> Maybe someone out there likes to give me a hint (well, Iīd like to
> programme it by myself, but itīs just the lack of an idea, or sort
> of wrong way of thinking while poisend by C and Pascal ;-) ).

If you really, really want to do this yourself, see the perlref
documentation.  References are pretty much the same things as the
pointers you're likely looking for.


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

Date: Wed, 01 Sep 1999 01:28:59 GMT
From: Watcher <watcher_q@my-deja.com>
Subject: Re: Perl on PalmPilot
Message-Id: <7qhvgh$jva$1@nnrp1.deja.com>

In article <37C97208.9C4E4AD9@busprod.com>,
  Dan Baker <dtbaker_@busprod.com> wrote:
> I dunno where you heard that.... if you find a windowsCE port, please
> post!
> The only free scripting language I've found there is a new one called
> REBOL, which is pretty interesting, new, but not real standard. I
think
> python is available?!

Yep,
You're right.  Python on CE has been available for more than a year
already.  It came out something June last year.


Watcher


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 01 Sep 1999 01:40:33 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: Perl Y2K Bugs on the Internet
Message-Id: <37cc8411$0$226@nntp1.ba.best.com>

Bbirthisel <bbirthisel@aol.com> wrote:

> Perhaps you should check the exact context in Pink Camel.
> The "rest of the story" is relevant.

>     # These next few lines are legal in both Perl and nroff.
> [snip]
> ';__END__ ##### From here on it's a standard manual page #####
> .TH $PROG 1 "$month $mday, 19$year"

> Maybe we should direct the Y2K police to read everything
> ever generated via nroff ;-)

Well, it's an ancient scroll at this point, anyway, of interest only to
Perl archaeologists. I just found it surprising that something like
that was in there.

-- 
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: Wed, 01 Sep 1999 01:54:54 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Perl Y2K Bugs on the Internet
Message-Id: <OH%y3.575$1I2.44572@typhoon01.swbell.net>

In article <19990831095634.17669.00001919@ng-fd1.aol.com>,
Bbirthisel <bbirthisel@aol.com> wrote:
>Hi John:
>
>>Mark W. Schumann <catfood@apk.net> wrote:
>>>>Worse - it didn't mention 'ctime' in relation to tm structs 
>>>>and on page 321 it actually *used* "19$year"! 
>>
>>> Your example from the Pink Camel is indeed apalling if true.
>>
>>It's in there, in the "real programming examples" chapter (or whatever
>>that was called). I had to see it to believe it myself.
>
>Perhaps you should check the exact context in Pink Camel.
>The "rest of the story" is relevant.
>
>    # These next few lines are legal in both Perl and nroff.
>[snip]
>';__END__ ##### From here on it's a standard manual page #####
>.TH $PROG 1 "$month $mday, 19$year"
>
>Maybe we should direct the Y2K police to read everything
>ever generated via nroff ;-)

No sale - you didn't read enough of the context. The nroff 
fragment is _rewritten_ by the script to have an embedded 
year _before_ attachment to the processed file as a static 
four digit year.  This is _before_ nroff ever has a shot
at it - nroff never sees the '19$year' - it only sees the
_post_ processed static date. 

The bug has nothing to do with nroff other than
that the Perl script is _feeding_ a bad date to nroff. 
The output can be seen on page 323 - with the date 
expanded to a static four digit date. Or five digit date
starting next year.

The bug could be 100% fixed by the usual $year += 1900 and
$year usage - all on the Perl side.

-- 
Benjamin Franz



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

Date: Wed, 1 Sep 1999 01:59:05 +0200
From: "Nando" <nando@tetecma.com>
Subject: R: Dos Perl and System command
Message-Id: <Nu_y3.8642$E4.15524@typhoon.libero.it>

This is a multi-part message in MIME format.

------=_NextPart_000_00FE_01BEF41D.91FF2900
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Yes.
try: perl -e "print qx(dir)";
Careful with "C:\" which must be "C:\\" ;-)
I use Active State Perl build 519

--=20
Fernando
  George M. Pieri <george.pieri@mci.com> wrote in message =
TUuy3.354$jA1.64005@pm02news...

  Has anyone successfully used the system command or back ticks
  to execute a command from a DOS perl script ?

  system "dir " ; or=20

  `dir`


  produces no results.

  P.S. I have to use the dos perl because I created a utility that needs
         to run from a bootable floppy but it appears NOT to execute =
commands.

  Thanks in advance!


------=_NextPart_000_00FE_01BEF41D.91FF2900
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Yes.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>try: perl -e "print =
qx(dir)";</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Careful with "C:\" which must be "C:\\" =

;-)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I use Active State Perl build =
519</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>-- <BR>Fernando</FONT></DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
  <DIV>George M. Pieri &lt;<A=20
  href=3D"mailto:george.pieri@mci.com">george.pieri@mci.com</A>&gt; =
wrote in=20
  message TUuy3.354$jA1.64005@pm02news...</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3D"Times New Roman">Has anyone successfully used the =
system=20
  command or back ticks</FONT></DIV>
  <DIV><FONT face=3D"Times New Roman">to execute a command from a DOS =
perl script=20
  ?</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3D"Times New Roman">system "dir " ; </FONT><FONT=20
  face=3D"Times New Roman">or </FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3D"Times New Roman">`dir`</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3D"Times New Roman">produces no results.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3D"Times New Roman">P.S. I have to use the dos perl =
because I=20
  created a utility that needs</FONT></DIV>
  <DIV><FONT face=3D"Times New =
Roman">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to run=20
  from a bootable floppy but it appears NOT to execute =
commands.</FONT></DIV>
  <DIV>&nbsp;</DIV>
  <DIV><FONT face=3D"Times New Roman">Thanks in=20
advance!<BR></FONT></DIV></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_00FE_01BEF41D.91FF2900--



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

Date: Wed, 1 Sep 1999 02:34:24 +0200
From: "Nando" <nando@tetecma.com>
Subject: R: newbie needs help
Message-Id: <pv_y3.8644$E4.15524@typhoon.libero.it>

Some suggestions:
1 - you better use 'eq' for string comparisons because '==' is for numbers.
2 - You must chomp $inputline2 to get rid of the \n otherwise it will NEVER
match "quit".
3 - You should test lc($inputline2) so that QUIT or quit exits the program.
--
Fernando

Wyzelli <wyzelli@yahoo.com> wrote in message
0kMx3.7$1X4.3639@vic.nntp.telstra.net...
> The DeLongs <tsaaedel@bright.net> wrote in message
> news:qNEx3.158$q_6.4055@cletus.bright.net...
> > Attention all knowledgeable Perl people sirs,
> >
> >     I am in need of assistance. I'm running Perl in Win32, specifically
> > Win98 (yeah, I actually got it to work). Problem is, whenever I run a
Perl
> > program, the program closes before I can ever see the output. So, I
> decided
> > to make a little bit of code that would make the user type 'quit' before
> the
> > program exits. Here's the code:
> >
> > $inputline = <STDIN>;
> > print( $inputline );
> > print( "\n \n" );
> > print ( "Type quit to exit.\n" );
> > $inputline2 = <STDIN>;
> > $quitline = "quit";
> > until ( $inputline2 == $quitline) {
> > print ( "Please type quit to exit. \n" );
> > $inputline2 = <STDIN>;
> > }
> >
> >
> > Problem is, if the user types anything at the prompt, the program exits.
> > Please correct my foolish errors.
> >
> > Adel
>
> Try running from the command prompt with perl scriptname.pl
>
> What is happening is what is supposed to happen... the program runs and
then
> closes.
>
> It is also possible to turn off the 'close on exit' property from the icon
> which runs the script if desired.
>
> Wyzelli
>
>




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

Date: Wed, 1 Sep 1999 02:13:46 +0200
From: "Nando" <nando@tetecma.com>
Subject: R: regex bug: (?:\d{3})+ loses count
Message-Id: <bv_y3.8643$E4.15524@typhoon.libero.it>

I use Active State Build 519, Aug 12 1999, Windows 98 and it works OK.
I did cut-and-paste of your script.

--
Fernando
Bart Lateur <bart.lateur@skynet.be> wrote in message
37cefc90.5143231@news.skynet.be...
> Can somebody confirm or deny this is indeed a bug, or that it has been
> fixed already. I've tried this on the latest (?) ports of Activestate
> (MSWin32) and DJGPP (dos) (both 5.005). It looks like the {n} modifier
> looses count if it's inside a (?:...) construct, followed by a '*', '+'
> or '?' modifier.
>
> I stumbled across it when I tried to roll my own "commify" code. (This
> version only "works" for integers.)
>
>     #! perl -w
>     $_ = '1234567890';
>     ($good = $_) =~ s/(\d)(?=(?:\d\d\d)+(?!\d))/$1,/g;
>     print "Good: $good\n";
>     ($bad = $_) =~ s/(\d)(?=(?:\d{3})+(?!\d))/$1,/g;
>     print "Bad: $bad\n";
>     ($ugly = $_) =~ s/(\d)(?=(?:\d{3})(?:\d{3})*(?!\d))/$1,/g;
>     print "Ugly: $ugly\n";
> -->
>     Good: 1,234,567,890
>     Bad: 1,2,3,4,5,6,7,8,9,0
>     Ugly: 1,2,3,4,5,6,7,890
>
> IMO, it should give the same result for all three. Why would '\d\d\d'
> give different results than '\d{3}'?
>
> This one is fun (but equally wrong), too:
>
>     ($ugly = $_) =~ s/(\d)(?=(\d{3})(\d{3})*(?!\d))/$1,/g;
>     print "Ugly: $ugly\n";
> -->
>     Ugly: 1,2,3,4,567,890
>
>
> p.s. I can't use perlbug, because I can't mail from within perl. The
> script simply dies. Bloody scripts... ;-)
>
> --
> Bart.




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

Date: Tue, 31 Aug 1999 17:52:28 -0700
From: Xah Lee <xah@weborder.com>
Subject: socket programing: implementing minSpare etc.
Message-Id: <37CC78CC.7DE7481@weborder.com>

How to implement a spawing server spawn according to traffic?

Detail:

Currently my company has a network pre-forking server app written in perl. The server pre-forks to a specified number of children, and the children exit after serving a fixed number of requests. We'd like to change it so that the process number increase and decrease with the traffic. Much like Apache accepting directives like MinSpare, MaxSpare, and MaxClient.

My question is, how do I go about doing this? I'm new to network programing. We are on Solaris 2.6.

Thanks for any hints. (hi Tom, hi Nandor.)

 Xah
 xah@best.com
 http://www.best.com/~xah/PageTwo_dir/more.html


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

Date: Wed, 01 Sep 1999 00:41:40 GMT
From: fart123@my-deja.com
Subject: Re: socket timeout
Message-Id: <7qhso2$i6j$1@nnrp1.deja.com>

I am having the same timeout problem with the
latest version of IO::Socket::INET

And it says this in the perldoc page:
"Although it is not illegal, the use of MultiHomed
on a socket which is in non-blocking mode is of
little use. This is because the first connect will
never fail with a timeout as the connaect call
will not block."

I suspect my problem is related to that statement,
although I am doing a very simple single homed
http get.

I also noticed that all the code relating to
timeouts is COMMENTED OUT OF INET.pm.

I think we are S.O.L on this.  I noticed that
Net::Telnet's timeout works fine though, so I
don't think its a lower level issue.

Tim



In article <37C4FC1C.3F6ED044@worldonline.nl>,
  accprob@worldonline.nl wrote:
> GiN wrote:
> >
> > Hi  I am having problems with my portscanner
in PERL.
> >
> >
> > while ($beginport < $maxport) {
> >     print "Scanning: $beginport\n";
> >
> >     if ($child = fork) {
> >         sleep 4;
> >         kill 9, $child if
$child;                                 #
> > this should kill the child if it takes to long
to connect
> >     }
> >     else {
> >
> >         if (scan($beginport))
> > {
> > #the socket opener
> >             print "SERVER: $target  PORT:
$beginport  STATUS:
> > open.\n";
> >         }
> >     }
> >     $beginport++;
> > }
> >
> >
> > my problem is: the loop is weird and the
timeout/kill is not functioning wel..
> >
> > if you know the answer, please e-mail to :
no-gin@dds.nl   (without "no-")
> >
> > thanks advanced!!!
> >
> > --
> > #phreak.nl http://www.casema.net/~gin
> >
> >
> Install the latest IO-module from CPAN, you
shouldnt have to use the
> forking then, because the time-out on
IO::Socket::INET will work.
> --
>
> Daniel Kupfer   -=> featuring accprob <=-
>



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 31 Aug 1999 17:04:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: subtraction error
Message-Id: <MPG.12360d4c8ede55c6989ef8@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7qhmdf$dkj$1@nnrp1.deja.com> on Tue, 31 Aug 1999 22:53:40 
GMT, hojo <i_tel@my-deja.com> says...
+ While running a simple subtraction, we get a floating point error
+ where a value of -1.77635683940025e-15 shows up rather than 0.  Below
+ is our output that consistantly fails.  Starting with a current
+ balance of 0 we run transaction amounts.  The final transaction amount
+ returns the bogus data:
+ 
+ Trans Amount		$curbal
+ 			0
+ -79.31 			-79.31
+ 79.31 			0
+ -77.00 			-77
+ 77.00 			0
+ -127.87 		-127.87
+ 127.87 			0
+ -53.43 			-53.43
+ 103.44 			50.01
+ -59.75 			-9.74
+ 9.74			-1.77635683940025e-15  (should be 0)
+ 
+ I would call this a bug.  Has anybody run into/fixed this problem?

You might call this a bug, but very few others would agree.  It is a 
fundamental property of floating-point numbers that they are 
approximations to the true mathematical values.  When two such numbers 
that are nearly the same in magnitude are subtracted, there is likely to 
be loss of precision.

I strongly recommend that you do all calculations using whole numbers 
for your currency amounts, and divide by 100 and use [s]printf '%.2f' 
for output only.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 31 Aug 1999 16:58:23 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: variable help
Message-Id: <MPG.12360bfa631eb321989ef7@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <37CC6264.BD13E305@agevision.com> on Tue, 31 Aug 1999 
19:16:52 -0400, magicrat <magicrat@agevision.com> says...
> Hi, new to perl.  I have a web form that I am grabbing info from.  Now,
> let's say I have input boxes for songs 1-10.  The name of the input  on
> the html form is song1, song2, song3...
> So, in defining the variables in the perl script, I would do:
> 
> my $song1 = $FORM{song1};
> my $song2 = $FORM{song2};
> my $song3 = $FORM{song3};
> etc.
> 
> my question is, how to I grab all of these values from the form and
> define my perl variables without going through the manual process listed
> above.
> I know it can be done, i just don't remember how.

Good, because you don't want to do it that way.  Don't create Perl 
variables with names based on other variables.  Use a hash:

my %songs;
$songs{$_} = $FORM{"song$_"} for 1 .. 99;

Even better, you can use an array; it is best to start counting from 0.

my @songs = @FORM{map "song$_" => 0 .. 99};

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 31 Aug 1999 18:36:31 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why doesn't my undef an array?
Message-Id: <37cc750f@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    Ian Smith <iansmith@pepper.ncinter.net> writes:
:Ugh.  The defined function does ugly things with arrays indeed.
:In the modified cod belowe, it generates no error since Perl is 
:generating a brand new thingy for each call.  I would have 
:assumed that my produced a 100% fresh and unopened varable
:each time, but it re-uses some internal things apparently.

% perl -wce 'print "$yn : $array[2]\n" if defined @array'
 ./perl -we 'print "$yn : $array[2]\n" if defined @array'
defined(@array) is deprecated at -e line 1.
(Maybe you should just omit the defined()?)
Name "main::yn" used only once: possible typo at -e line 1.
-e syntax OK

Lesson: don't use defined() on aggregates.  The documentation
has said this for quite a long time.  And now -w will tell
you so, as well.

--tom
-- 
    char program[1];        /* Unwarranted chumminess with compiler. */
	    --Larry Wall in the Perl source code
    (quoting Henry Spencer (quoting Dennis Ritchie (quoting Brian Kerninghan)))


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

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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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