[15668] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3081 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 17 21:05:34 2000

Date: Wed, 17 May 2000 18:05:11 -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: <958611911-v9-i3081@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 17 May 2000     Volume: 9 Number: 3081

Today's topics:
    Re: [OT] Annoying -w messages from standard distributed <johnlin@chttl.com.tw>
    Re: Check to see if an array value is null <sue@pennine.com>
        credit card validation.....isn't working <babylon93@ariannaoils.com>
    Re: credit card validation.....isn't working <rootbeer@redcat.com>
    Re: credit card validation.....isn't working <makarand_kulkarni@My-Deja.com>
        DBM File Examples? <garcia868@yahoo.com>
    Re: DBM File Examples? <rootbeer@redcat.com>
    Re: determining existence of object method <jc@juliancardarelli.com>
    Re: generating gif image from cgi <makarand_kulkarni@My-Deja.com>
    Re: generating gif image from cgi (Reo M.)
    Re: help - undef $/; ? (Craig Berry)
    Re: help - undef $/; ? <spam-abuse@uk2.net>
        How to get command line arg? <epost1@my-deja.com>
    Re: How to get command line arg? <makarand_kulkarni@My-Deja.com>
        Large hash handling <thomas@x-tekcorp.com>
    Re: Large hash handling <lauren_smith13@hotmail.com>
    Re: MS Documents to text---help <jgoss@goss-com.com>
    Re: MS Documents to text---help <jeff@vpservices.com>
        Newbie Question - find command in Perl <akil1@mindspring.com>
    Re: Newbie Question - find command in Perl <makarand_kulkarni@My-Deja.com>
    Re: Newbie Question - find command in Perl <tony_curtis32@yahoo.com>
    Re: Odd fork() problem (Kenneth Herron)
    Re: Perl-W32 #EXEC error <rootbeer@redcat.com>
        Q: Encryption of client - server communication  <thomas2@dalnet.se>
    Re: Sending mail from Perl on NT aphiny6592@my-deja.com
    Re: simple newbie question <rootbeer@redcat.com>
        Suffling A List <mouimet@direct.ca>
    Re: Suffling A List <sumengen@hotelspectra.com>
    Re: tracking the memory <sumengen@hotelspectra.com>
    Re: Why does STDOUT->fdopen(...) work? (Ilya Zakharevich)
    Re: zen and the art of trolling [OT] <brian@bluecoat93.org>
    Re: zen and the art of trolling [OT] <andrew.mcguire@walgreens.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 18 May 2000 08:21:04 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: [OT] Annoying -w messages from standard distributed modules
Message-Id: <8fvd20$l78@netnews.hinet.net>

I just mailed 3 different perlbugs to perlbug@perl.com.
The mail server thought I was SPAMming them, so all were rejected.

   ----- The following addresses had permanent fatal errors -----
<perlbug@perl.com>

   ----- Transcript of session follows -----
 ... while talking to mail.perl.com.:
>>> MAIL From:<johnlin@chttl.com.tw>
<<< 550 5.0.0 Your site is blacklisted as a spam haven.
554 <perlbug@perl.com>... Service unavailable

Blacklisted?  Yes, they won't accept my mails anymore.
It's sad to be blacklisted...

John Lin




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

Date: 17 May 2000 14:55:48 -0700
From: Sue Spence <sue@pennine.com>
Subject: Re: Check to see if an array value is null
Message-Id: <8fv4h4$gc4@drn.newsguy.com>

In article <23857c7c.5fcd31fa@usw-ex0110-076.remarq.com>, Ben says...
>
>I am trying to write a while loop that runs through an
>array and stops as soon as an array possition has no value.
>

So, how's it going?  What have you got so far?



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

Date: Wed, 17 May 2000 16:26:32 -0600
From: "babylon93" <babylon93@ariannaoils.com>
Subject: credit card validation.....isn't working
Message-Id: <OFETy6Ew$GA.249@cpmsnbbsa02>

Hello,

I'm doing a flash e-commerce site ( http://www.cowboypottery.com ) and
decided I should have some kind of credit card number verification, since
the cards aren't being processed real-time.  I have been working with
something I thought would work for 16-digit card numbers, but it doesn't
really do that well.........

I have converted it into actionscript for Flash, and it just doesn't make
any sense, now, why it would work.  First the perl I'm speaking of....


# 16 digit card numbers
sub card16 {
    $cc0 = substr($cardnumber,0,1);
    $cc1 = substr($cardnumber,1,1);
    $cc2 = substr($cardnumber,2,1);
    $cc3 = substr($cardnumber,3,1);
    $cc4 = substr($cardnumber,4,1);
    $cc5 = substr($cardnumber,5,1);
    $cc6 = substr($cardnumber,6,1);
    $cc7 = substr($cardnumber,7,1);
    $cc8 = substr($cardnumber,8,1);
    $cc9 = substr($cardnumber,9,1);
    $cc10 = substr($cardnumber,10,1);
    $cc11 = substr($cardnumber,11,1);
    $cc12 = substr($cardnumber,12,1);
    $cc13 = substr($cardnumber,13,1);
    $cc14 = substr($cardnumber,14,1);
    $cc15 = substr($cardnumber,15,1);

    $cc0a = $cc0 * 2;
    $cc2a = $cc2 * 2;
    $cc4a = $cc4 * 2;
    $cc6a = $cc6 * 2;
    $cc8a = $cc8 * 2;
    $cc10a = $cc10 * 2;
    $cc12a = $cc12 * 2;
    $cc14a = $cc14 * 2;

    if ($cc0a >= 10) {
 $cc0b = substr($cc0a,0,1);
 $cc0c = substr($cc0a,1,1);
 $cc0 = $cc0b+$cc0c;
    } else {
 $cc0 = $cc0a;
    }
    if ($cc2a >= 10) {
 $cc2b = substr($cc2a,0,1);
 $cc2c = substr($cc2a,1,1);
 $cc2 = $cc2b+$cc2c;
    } else {
 $cc2 = $cc2a;
    }
    if ($cc4a >= 10) {
 $cc4b = substr($cc4a,0,1);
 $cc4c = substr($cc4a,1,1);
 $cc4 = $cc4b+$cc4c;
    } else {
 $cc4 = $cc4a;
    }
    if ($cc6a >= 10) {
 $cc6b = substr($cc6a,0,1);
 $cc6c = substr($cc6a,1,1);
 $cc6 = $cc6b+$cc6c;
    } else {
 $cc6 = $cc6a;
    }
    if ($cc8a >= 10) {
 $cc8b = substr($cc8a,0,1);
 $cc8c = substr($cc8a,1,1);
 $cc8 = $cc8b+$cc8c;
    } else {
 $cc8 = $cc8a;
    }
    if ($cc10a >= 10) {
 $cc10b = substr($cc10a,0,1);
 $cc10c = substr($cc10a,1,1);
 $cc10 = $cc10b+$cc10c;
    } else {
 $cc10 = $cc10a;
    }
    if ($cc12a >= 10) {
 $cc12b = substr($cc12a,0,1);
 $cc12c = substr($cc12a,1,1);
 $cc12 = $cc12b+$cc12c;
    } else {
 $cc12 = $cc12a;
    }
    if ($cc14a >= 10) {
 $cc14b = substr($cc14a,0,1);
 $cc14c = substr($cc14a,1,1);
 $cc14 = $cc14b+$cc14c;
    } else {
 $cc14 = $cc14a;
    }

    $val =
$cc0+$cc1+$cc2+$cc3+$cc4+$cc5+$cc6+$cc7+$cc8+$cc9+$cc10+$cc11+$cc12+$cc13+$c
c14+$cc15;
    if (substr($val,1,1) !=0 ) {
 &invalid_cc;
    }
}



now for the actionscript replacement:


On (Release, Key: <Enter>)
      Set Variable: "i" = "1"
      Loop While (i <= 16)
            Set Variable: "cc"&i = ""
            Set Variable: "cc"&i&"a" = ""
            Set Variable: "cc"&i&"b" = ""
            Set Variable: "cc"&i&"c" = ""
            Set Variable: "cc"&i&"d" = ""
            Set Variable: "i" = i +1
      End Loop
      If (Length (cardnumber) = 16)
            Set Variable: "i" = "1"
            Loop While (i <= 16)
                  Set Variable: "q" = i - 1
                  Set Variable: "cc"&i = Substring ( cardnumber, i, 1 )
                  Set Variable: "i" = i +1
            End Loop
            Comment: getting "key numbers"
            Set Variable: "i" = 1
            Loop While (i <= 17)
                  Set Variable: "cc"&i&"a" = (Eval ("cc"&i)) * 2
                  Set Variable: "i" = i + 2
            End Loop
            Set Variable: "i" = "1"
            Loop While (i <= 17)
                  If (Eval ("cc"&i&"a") >= 10)
                        Set Variable: "cc"&i&"b" = Substring ( Eval
("cc"&i&"a"), 0, 1 )
                        Set Variable: "cc"&i&"c" = Substring ( Eval
("cc"&i&"a"), 2, 1 )
                        Set Variable: "temp1" = Eval ("cc"&i&"b")
                        Set Variable: "temp2" = Eval ("cc"&i&"c")
                        Set Variable: "cc"&i&"d" = temp1 + temp2
                  Else If (Eval ("cc"&i&"a") < 10)
                        Set Variable: "cc"&i&"d" = Eval ("cc"&i&"a")
                  End If
                  Set Variable: "i" = i + 1
            End Loop
            Set Variable: "valid" = cc1d + cc2d + cc3d + cc4d + cc5d + cc6d
+ cc7d + cc8d + cc9d + cc10d + cc11d + cc12d + cc13d + cc14d + cc15d + cc16d
      End If
End On


you can check out the actionscript above in action at
http://www.ariannaoils.com/media/test/validator2.html if you have the flash
plugin installed.

Thanks!
http://www.ariannaoils.com/media























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

Date: Wed, 17 May 2000 16:10:21 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: credit card validation.....isn't working
Message-Id: <Pine.GSO.4.10.10005171607450.25459-100000@user2.teleport.com>

On Wed, 17 May 2000, babylon93 wrote:

> I have converted it into actionscript for Flash, and it just doesn't make
> any sense, now, why it would work.  

It just doesn't make any sense, now, what Flash is. :-)  But I'm probably
happier not knowing.

> First the perl I'm speaking of....
> 
> 
> # 16 digit card numbers
> sub card16 {
>     $cc0 = substr($cardnumber,0,1);
>     $cc1 = substr($cardnumber,1,1);
>     $cc2 = substr($cardnumber,2,1);
>     $cc3 = substr($cardnumber,3,1);

Eek! Why aren't you using a module?

    http://search.cpan.org/search?dist=Business-CreditCard

> now for the actionscript replacement:
> 
> 
> On (Release, Key: <Enter>)
>       Set Variable: "i" = "1"
>       Loop While (i <= 16)

That's not Perl. Maybe you want to search for docs, FAQs, and newsgroups
about that, whatever it is. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 17 May 2000 16:52:54 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: credit card validation.....isn't working
Message-Id: <392330D6.BC520E97@My-Deja.com>

>
> I'm doing a flash e-commerce site ( http://www.cowboypottery.com ) and
> decided I should have some kind of credit card number verification, since
> the cards aren't being processed real-time.  I have been working with
> something I thought would work for 16-digit card numbers, but it doesn't
> really do that well.........
>
> I have converted it into actionscript for Flash, and it just doesn't make
> any sense, now, why it would work.  First the perl I'm speaking of....
>
> # 16 digit card numbers
> sub card16 {
>     $cc0 = substr($cardnumber,0,1);
>     $cc1 = substr($cardnumber,1,1);
>     $cc2 = substr($cardnumber,2,1);
>     $cc3 = substr($cardnumber,3,1);
>     $cc4 = substr($cardnumber,4,1);
>     $cc5 = substr($cardnumber,5,1);

---8< ---------------------------------8< --------------------

if all this was doing is verifying a credit card then why
dont you use Business::CreditCard module from CPAN.




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

Date: Wed, 17 May 2000 16:01:46 -0700 (PDT)
From: J Garcia <garcia868@yahoo.com>
Subject: DBM File Examples?
Message-Id: <20000517230146.18310.qmail@web1611.mail.yahoo.com>

I want to use DBM file database on my Web site to 
enable visitors to register themselves. I would like
to know of any pre-written/tested scripts that I can
use on my site. Anybody have any recommendations?
Thanks for helping out.

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/


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

Date: Wed, 17 May 2000 16:22:14 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: DBM File Examples?
Message-Id: <Pine.GSO.4.10.10005171621500.25459-100000@user2.teleport.com>

On Wed, 17 May 2000, J Garcia wrote:

> I want to use DBM file database on my Web site to enable visitors to
> register themselves. I would like to know of any pre-written/tested
> scripts that I can use on my site. Anybody have any recommendations?

If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 18 May 2000 00:56:07 GMT
From: "Julian L. Cardarelli" <jc@juliancardarelli.com>
Subject: Re: determining existence of object method
Message-Id: <HcHU4.2738$Rf.27214@news1.rdc1.on.wave.home.com>

my $refval        =    ref(\&{$object->sub}) Actually, I can't remember how
to suppress the actual running of the code but ref will return 'CODE' which
will tell you if the method exists.  If you can find out how to suppress the
running of the code, you're on your way.  Just let me know how you did it to
refresh my memory.

= Julian


Kenneth Lee <kenneth.lee@alfacomtech.com> wrote in message
news:3922244D.B80A1EF8@alfacomtech.com...
> i want to test whether an object can invoke an arbitrary method.
> defined() (or exists() in 5.6.0) only works for class methods, but not
> object ones.
>
> i tried eval(), which set $@ if the method doesn't exists, but it sets $@
> also if that method exists and raises exception when called.
>
> there's no way to identify the error except parsing the value in $@.
> Any thought?
>
> kenneth




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

Date: Wed, 17 May 2000 15:06:24 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: generating gif image from cgi
Message-Id: <392317E0.6F3794E5@My-Deja.com>

> How can I read (using perl I guess) a text file that contains a number.  ie.
> a hit counter,  stores it into a string and then go thru this string and
> takes each number and generates a gif representation of that number assuming
> there are all gif images existing as in 1.gif, 2.gif.

No special cgi script is required ( unless you want to determine
the characteristics of the gif file at runtime ..)

if $counter has the number  --

print  join  ( '',map { "<image border=0 src=$_\.gif>"} split ( //, $counter )
);

--



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

Date: Wed, 17 May 2000 23:50:53 GMT
From: reo@infi.net (Reo M.)
Subject: Re: generating gif image from cgi
Message-Id: <3923304d.10545267@news.infi.net>

On Wed, 17 May 2000 15:06:24 -0700, Makarand Kulkarni
<makarand_kulkarni@My-Deja.com> wrote:


use  php3

>No special cgi script is required ( unless you want to determine
>the characteristics of the gif file at runtime ..)
>
>if $counter has the number  --
>
>print  join  ( '',map { "<image border=0 src=$_\.gif>"} split ( //, $counter )
>);
>
>--
>



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

Date: Wed, 17 May 2000 22:28:14 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: help - undef $/; ?
Message-Id: <si677uk88ta118@corp.supernews.com>

Nadja Herkova (spam-abuse@uk2.net) wrote:
: could someone explain the function of the command
: undef $/;

See perlvar.  In short, $/ is the input record terminator, \n by default;
if it's undefined, the first <> on it reads the entire file, a situation
commonly called "slurp mode".

It's friendlier to other parts of your program to do this locally inside a
block, so the global value of $/ remains intact elsewhere.

So, for example, assuming a file is open for input on the handle F,

  my $text = do { local $/; <F>; }

will read the entire file into $text.

: the code functions correctly (and yes i will be adding else clauses),
: but I can't find an explanation of the undef command that I understand
: wholly

'undef' simply makes its argument variables value undefined, which is a
distinct value in Perl.  If you know C, you can think of it being a
generalization of what NULL means for pointers -- "this variable exists,
but it explicitly has no current useable value".

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "The road of Excess leads to the Palace
      of Wisdom" - William Blake


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

Date: Thu, 18 May 2000 01:28:08 +0100
From: Nadja Herkova <spam-abuse@uk2.net>
Subject: Re: help - undef $/; ?
Message-Id: <3923390D.1B896753@uk2.net>

thankyou Makarand and craig

it makes good sense now. I checked perlvar, but was difficult to
understand. I read a dictionary to find slurp and I saw it  is greedy -
good, and undef is undefined - ok.

so, if i undef $/ - it will only affect if i use $/ elsewhere in the
program ? or does it have affect on other commands - i will look

once again thankyou
n*dja



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

Date: Thu, 18 May 2000 00:14:29 GMT
From: Ethan Post <epost1@my-deja.com>
Subject: How to get command line arg?
Message-Id: <8fvcko$fcf$1@nnrp1.deja.com>

How do I get a command line argument from a perl file.

i.e.

some_file.pl "/tmp/data"

Want to grab the /tmp/data argument in some_file.pl?

Thanks,
Ethan

--
http://www.freetechnicaltraining.com/home/ethan


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


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

Date: Wed, 17 May 2000 17:22:14 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: How to get command line arg?
Message-Id: <392337B6.77359D61@My-Deja.com>

> How do I get a command line argument from a perl file.

see inside @ARGV




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

Date: Wed, 17 May 2000 18:36:11 -0500
From: Thomas Rock <thomas@x-tekcorp.com>
Subject: Large hash handling
Message-Id: <MPG.138ce8cf3db628439896bb@news.anet-chi.com>

I have a very large hash (potentially 10's of millions of
entries) wherein each entry is a regular array reference. 

I was wondering a couple of things: 

First, is it possible for the OS (Unix or Windows) to use
swap space to hold part of the hash, or must it all be 
contained in memory?

Second (kind of related to the first), is there a way
to explicitly buffer part of a hash out to a file so 
that it doesn't grow too large in memory?

Thanks for any and all pointers.

Tom



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

Date: Wed, 17 May 2000 16:47:08 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: Large hash handling
Message-Id: <8fvb2i$ngp$1@brokaw.wa.com>


Thomas Rock <thomas@x-tekcorp.com> wrote in message
news:MPG.138ce8cf3db628439896bb@news.anet-chi.com...
> I have a very large hash (potentially 10's of millions of
> entries) wherein each entry is a regular array reference.
>
> I was wondering a couple of things:
>
> First, is it possible for the OS (Unix or Windows) to use
> swap space to hold part of the hash, or must it all be
> contained in memory?
>
> Second (kind of related to the first), is there a way
> to explicitly buffer part of a hash out to a file so
> that it doesn't grow too large in memory?

Try looking at the documentation for 'tie()'.  It seems to be exactly what
you need.

perldoc -f tie

Lauren




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

Date: Wed, 17 May 2000 23:01:11 GMT
From: "JB Goss" <jgoss@goss-com.com>
Subject: Re: MS Documents to text---help
Message-Id: <XwFU4.296$e4.4357@news1.rdc1.ne.home.com>

Well, since I posted this is lang.perl, I thought one would understand I
wanted something in Perl to do this...
I shall be more explicit... I am looking for a Perl script  for a Unix
machine that will strip the crud out of a MS Word document and just leave
the text (all text).

"Lynn Killingbeck" <killbeck@pointecom.net> wrote in message
news:39220560.7A65@pointecom.net...
> JB Goss wrote:
> >
> > I am looking for something simple to strip the crud out of MS documents
and
> > just leave the text... any ideas?
> >
> > Thanks,
> > JB
>
> "SaveAs" a *.txt file. (Via File - SaveAs menus).
>
> Lynn Killingbeck
>
> P.S. That 'crud' is a lot of formatting, so make sure that you really do
> want to get down to a plain-vanilla ASCII (or MSDOS) format!




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

Date: Wed, 17 May 2000 16:07:01 -0700
From: Jeff Zucker <jeff@vpservices.com>
To: JB Goss <jgoss@goss-com.com>
Subject: Re: MS Documents to text---help
Message-Id: <39232615.D778A289@vpservices.com>

JB Goss wrote:
> 
> Well, since I posted this is lang.perl, I thought one would understand I
> wanted something in Perl to do this...
> I shall be more explicit... I am looking for a Perl script  for a Unix
> machine that will strip the crud out of a MS Word document and just leave
> the text (all text).

And did you find something wrong with my advice to try OLE::Storage
which works on Unix to manipulate  MS Word documents?

-- 
Jeff


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

Date: Wed, 17 May 2000 17:59:49 -0400
From: "Kevin Bass" <akil1@mindspring.com>
Subject: Newbie Question - find command in Perl
Message-Id: <8fv50q$45i$1@slb6.atl.mindspring.net>

How does the following Unix command translate into Perl:

find . -name 'samp*' -exec <command>

Kevin




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

Date: Wed, 17 May 2000 15:08:20 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Newbie Question - find command in Perl
Message-Id: <39231854.83741F03@My-Deja.com>

> How does the following Unix command translate into Perl:
> find . -name 'samp*' -exec <command>

perldoc File::Find
-



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

Date: Thu, 18 May 2000 00:16:48 GMT
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Newbie Question - find command in Perl
Message-Id: <87k8gs7lvy.fsf@shleppie.uh.edu>

>> On Wed, 17 May 2000 17:59:49 -0400,
>> "Kevin Bass" <akil1@mindspring.com> said:

> How does the following Unix command translate into Perl:
> find . -name 'samp*' -exec <command>

perldoc File::Find

    http://www.cpan.org/

or use "cpan" (perl -MCPAN -eshell) )to install on your
system.

Difficult, eh? :-)

hth
t


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

Date: 17 May 2000 22:44:14 GMT
From: kherron@sgum.mci.com (Kenneth Herron)
Subject: Re: Odd fork() problem
Message-Id: <8fv7bu03g4@enews2.newsguy.com>

Hmm, it looks like the fork() is causing STDIN to lose its place.  I
got it down to the following:


	#!/usr/local/bin/perl5.00403 -w
	use strict;

	$| = 1;
	while (<STDIN>) {
		if ( ($. % 20) == 0 )
		{
			printf "%s: line %d, pos %d\n",
				"before wait", $., tell(STDIN);
			wait();
			printf "%s: line %d, pos %d\n",
				"before fork", $., tell(STDIN);
			if (0 == fork()) {
				exit(0);
			}
			printf "%s: line %d, pos %d\n",
				"after fork ", $., tell(STDIN);
		}
	}

	printf "%s: line %d, pos %d\n",  "after loop ", $., tell(STDIN);
	wait();
	exit(0);

When I run this with /etc/passwd as its stdin (45 lines on my system),
I get:

	before wait: line 20, pos 926
	before fork: line 20, pos 926
	after fork : line 20, pos -540
	before wait: line 40, pos 620
	before fork: line 40, pos 620
	after fork : line 40, pos 314
	before wait: line 60, pos 1433
	before fork: line 60, pos 1433
	after fork : line 60, pos 474
	before wait: line 80, pos 1658
	before fork: line 80, pos 1658
	after fork : line 80, pos 1658
	after loop : line 92, pos 2392

This happens on either 5.004_03 or 5.005_02 (the two versions I have
available).  The exact output isn't completely consistent.

According to truss, perl is doing a small backwards seek in the child
process.  Since they're sharing the stdin descriptor, that would affect
the parent as well:

	12402:  read(0, " r o o t : x : 0 : 1 : 0".., 8192)     = 2392
	12402:  llseek(0, 0, SEEK_CUR)                          = 2392
	12402:  ioctl(1, TCGETA, 0xEFFFEDAC)                    = 0
	before wait: line 20, pos 926
	12402:  write(1, " b e f o r e   w a i t :".., 30)      = 30
	12402:  waitid(P_ALL, 0, 0xEFFFEF48, WEXITED|WTRAPPED)  Err#10 ECHILD
	12402:  llseek(0, 0, SEEK_CUR)                          = 2392
	before fork: line 20, pos 926
	12402:  write(1, " b e f o r e   f o r k :".., 30)      = 30
	12402:  fork()                                          = 12403
	12403:  fork()          (returning as child ...)        = 12402
	12403:  llseek(0, 0xFFFFFFFFFFFFFA46, SEEK_CUR)         = 926
	12403:  _exit(0)
	12402:  llseek(0, 0, SEEK_CUR)                          = 926
	after fork : line 20, pos -540
	12402:  write(1, " a f t e r   f o r k   :".., 31)      = 31
	12402:  llseek(0, 0, SEEK_CUR)                          = 926
	before wait: line 40, pos 620
	12402:  write(1, " b e f o r e   w a i t :".., 30)      = 30
	12402:  waitid(P_ALL, 0, 0xEFFFEF48, WEXITED|WTRAPPED)  = 0
	12402:  llseek(0, 0, SEEK_CUR)                          = 926
	before fork: line 40, pos 620
	12402:  write(1, " b e f o r e   f o r k :".., 30)      = 30
	12402:  fork()                                          = 12405
	12405:  fork()          (returning as child ...)        = 12402
	12405:  llseek(0, 0xFFFFFFFFFFFFFECE, SEEK_CUR)         = 620
	12405:  _exit(0)


-- 
Kenneth Herron -- kherron@sgum.mci.com
"Netscape pollution must be eradicated."
    -- Jeff Raikes, Vice president, Microsoft


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

Date: Wed, 17 May 2000 16:15:57 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl-W32 #EXEC error
Message-Id: <Pine.GSO.4.10.10005171612300.25459-100000@user2.teleport.com>

On Wed, 17 May 2000, Steve wrote:

> Any suggestions on where to start.  

Well, Yahoo has a page of information on webservers:

    http://dir.yahoo.com/Computers_and_Internet/Software/Internet/World_Wide_Web/Servers/

You can go from there to all sorts of server categories, including two
different web servers which claim to be the world's smallest. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 17 May 2000 22:27:42 GMT
From: "Thomas Åhlen" <thomas2@dalnet.se>
Subject: Q: Encryption of client - server communication 
Message-Id: <y1FU4.14$VF1.4480@dummy.bahnhof.se>

Hi!

I wonder which encryption method is best to use when encrypting
communications between a client and a server.

The server is written in perl.
The client can be either perl or VBasic or some other language.
So there must be a free Crypt module for atleast perl and VB.

My first choise was Twofish since i heard of it before and know
there is both perl and VB implementations.
After trying both Crypt::Twofish and Crypt::Twofish2 i am sad to say
that the first did install on all platforms but didn't  work properly.
The second i didn't even get to install an all platforms. So now i think
i'll give up twofish.

Any suggestions are welcome.

-Thomas Åhlen




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

Date: Wed, 17 May 2000 22:50:28 GMT
From: aphiny6592@my-deja.com
Subject: Re: Sending mail from Perl on NT
Message-Id: <8fv7ne$9lf$1@nnrp1.deja.com>

Hi.  I'm trying to do much the same thing, and I wanted to know if you
were using the Mail::Mailer or Net::SMTP modules (Perl only solution).
I don't seem to have them in build 613 of activeperl, and I was
wondering if you might know where to get them.

Thanks,
Yin
yaphin01@amsi.egginc.com

In article <8fp1u4$8rj$1@nnrp1.deja.com>,
  old_flyer@my-deja.com wrote:
> Ok. I am familiar with calling system commands in UNIX, but I also
have
> Active Perl on my NT machine. I want to use MS Outlook to mail out
from
> a list of e-mail addresses.  I have done this easily in Perl, but
> anyone have any experience calling Outlook from the command line?  Can
> it be done, or do I need to get another mail client?
>
> Thanks,
>
> Dwight Taylor
>
> email: ldtaylor@swbell.net
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


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


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

Date: Wed, 17 May 2000 16:03:55 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: simple newbie question
Message-Id: <Pine.GSO.4.10.10005171602270.25459-100000@user2.teleport.com>

On Wed, 17 May 2000 d.frost@dtn.ntl.com wrote:

> Subject: simple newbie question

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> I am interested in how to put sub routines into their own files, and
> use them from other programs ?

Check out the 'require' function, in the perlfunc manpage. But making a
module is probably a better way to go, in general, so see the perlmod
manpage as well. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 17 May 2000 22:21:28 GMT
From: "Marcus" <mouimet@direct.ca>
Subject: Suffling A List
Message-Id: <IXEU4.20445$au2.227816@news1.rdc1.bc.home.com>

I have figured out how to shuffle my list using rand. But it only displays
one random name out of the list of many names , it displays all the names
ust using sort. I am new to perl so I am still getting used to it. Here is
what I tried and can't get any further:

foreach $service (@servicelist) {
  chomp($service);
  if( ($in{service} eq "NS")||($in{service} eq "")||($in{service} eq
$service) ) {
   $servicechunk = "";
   $servicename = $service;
   $servicename =~ s/_/ /g;
   $servicechunk .= "<LI><FONT SIZE='+1'>$servicename</FONT>\n<UL>\n";
   open(USERLIST, "ls $servicesfolder/$service |");
   @userlist = <USERLIST>;
   srand ();
   @userlist = sort($userlist[rand @userlist]);
   $x = 0;
   foreach $user (@userlist) {
    chomp($user);
    $infofilestring =
FileToString("$servicesfolder/$service/$user/$infofilename");
    $infofilestring =~ s/\n|\s+|\t/ /g;
    $name = Extract('name',$infofilestring);
    $company = Extract('company',$infofilestring);
    $city = Extract('city',$infofilestring);
    $state = Extract('state',$infofilestring
    }










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

Date: Wed, 17 May 2000 15:33:25 -0700
From: "Baris" <sumengen@hotelspectra.com>
Subject: Re: Suffling A List
Message-Id: <39231d43$1_1@goliath.newsfeeds.com>

take a look at "perlfaq4"
Question: "How do I shuffle an array randomly?"
Baris.

"Marcus" <mouimet@direct.ca> wrote in message
news:IXEU4.20445$au2.227816@news1.rdc1.bc.home.com...
> I have figured out how to shuffle my list using rand. But it only displays
> one random name out of the list of many names , it displays all the names
> ust using sort. I am new to perl so I am still getting used to it. Here is
> what I tried and can't get any further:
>
> foreach $service (@servicelist) {
>   chomp($service);
>   if( ($in{service} eq "NS")||($in{service} eq "")||($in{service} eq
> $service) ) {
>    $servicechunk = "";
>    $servicename = $service;
>    $servicename =~ s/_/ /g;
>    $servicechunk .= "<LI><FONT SIZE='+1'>$servicename</FONT>\n<UL>\n";
>    open(USERLIST, "ls $servicesfolder/$service |");
>    @userlist = <USERLIST>;
>    srand ();
>    @userlist = sort($userlist[rand @userlist]);
>    $x = 0;
>    foreach $user (@userlist) {
>     chomp($user);
>     $infofilestring =
> FileToString("$servicesfolder/$service/$user/$infofilename");
>     $infofilestring =~ s/\n|\s+|\t/ /g;
>     $name = Extract('name',$infofilestring);
>     $company = Extract('company',$infofilestring);
>     $city = Extract('city',$infofilestring);
>     $state = Extract('state',$infofilestring
>     }
>
>
>
>
>
>
>
>




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: Wed, 17 May 2000 15:57:17 -0700
From: "Baris" <sumengen@hotelspectra.com>
Subject: Re: tracking the memory
Message-Id: <392322da$1_4@goliath.newsfeeds.com>

Hello,
I think I kind of find the bottleneck.
I am using a hash to check and avoid duplicates.
I am initializing this hash in  the beginning of each loop and clearing at
the end. At each loop, this hash grows to about 1000 keys. Unfortunately
undef %hash;
doesn't mean that memory is returned to the OS.
from Perlfaq("How can I free an array or hash so my program shrinks?")
But perl is supposed to reuse that memory, right? My feeling is that, for
arrays, it does, but for hashes, if your new hash has different keys, the
old memory doesn't seem to be reused???
Any comments?
Baris.


"Tom Phoenix" <rootbeer@redcat.com> wrote in message
news:Pine.GSO.4.10.10005161540380.25459-100000@user2.teleport.com...
> On Tue, 16 May 2000, Baris wrote:
>
> > I want to use a tool which can tell me which data structure is using how
> > much memory. I need to be ablle to track this while running the program.
>
> You may be able to do some of this by using the debugging mode of Perl's
> malloc. Of course, that'll probably require recompiling Perl (or, better,
> compiling a special debugging binary).
>
> > I am also suspicious about the modules i am using and wondering if
> > they have any memory leaks or not.
>
> Stop wondering; they do. :-)  It's very easy to make a memory leak in an
> XS-based module. Fortunately, it's generally not hard to stress-test the
> code, calling it thousands of times, to try to catch a leak. When you find
> a leak, be sure to send a patch (of the test, if nothing else) to the
> author.
>
> > (I wonder if there are problems of perl clearing the memory right
away???).
>
> Well, it won't destroy everything the moment that it can, in general. But
> it'll re-use memory when possible, mostly.
>
> > I am defining module variables using my inside the while loop. I assume
at
> > each loop the old module variables are cleared and new one is created..
>
> Do you mean package variables, or something else? Of course, you can't use
> my() to make package variables, and I don't know what "module variables"
> would be. Hmmm.
>
> Cheers!
>
> --
> Tom Phoenix       Perl Training and Hacking       Esperanto
> Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/
>




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: 17 May 2000 22:08:37 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Why does STDOUT->fdopen(...) work?
Message-Id: <8fv595$7g3$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Tom Phoenix 
<rootbeer@redcat.com>],
who wrote in article <Pine.GSO.4.10.10005171438080.25459-100000@user2.teleport.com>:

> > 	STDOUT->fdopen($file, 'w');      # Why does this work?

> Perl cheats. :-)  I think Perl just makes the filehandle work that way so
> that this can work....

But I think the question was "How exactly does it cheat?".  My vague
memory of several years ago is that barewords filehandles are made new
*packages*, which were kind ISA-ed into IO::Handle.

Ilya


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

Date: Wed, 17 May 2000 19:19:54 -0400
From: "Brian Landers" <brian@bluecoat93.org>
Subject: Re: zen and the art of trolling [OT]
Message-Id: <XNFU4.7867$ri6.94913@news4.atl>

"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3922CAD1.3BF038@stomp.stomp.tokyo...
> I both ask and demand you desist posting
> commentary of a racially insulting intent.

Two words, *free speech* - it's called the Bill of Rights, check it out.
You're in no position to demand anything. If you don't like what you read,
don't read it. There are X000 other newsgroups out there.





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

Date: Wed, 17 May 2000 18:43:04 -0500
From: "Andrew N. McGuire" <andrew.mcguire@walgreens.com>
Subject: Re: zen and the art of trolling [OT]
Message-Id: <39232E88.1F8D3FB0@walgreens.com>

Brian Landers wrote:
> 
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
> news:3922CAD1.3BF038@stomp.stomp.tokyo...
> > I both ask and demand you desist posting
> > commentary of a racially insulting intent.
> 
> Two words, *free speech* - it's called the Bill of Rights, check it out.

I would bet that not everyone in this NG is protected by the 1st
amendment.  Usenet is international.  Also libel and slander
are not protected by the Bill of Rights.  Do I think that
Godzilla has been slandered? No, but that is irrelevant, as
she believes she has been, whether she has or not.

> You're in no position to demand anything.

On the contrary, she is in a perfect postition, that she
has worked hard to gain.  Especially considering most
ISP's have rather strict TOS agreements, a well formed
email by her could cause you considerable grief.  All
you have to do is lose your temper, and say something
you shouldn't.  Like it or not, (I do not) I can say
that I do see one very positive point to her stay here.
I think most people have had to raise their tolerance
level up a notch.. This is good, if not taken to excess.
Everyone has a breaking point.

> If you don't like what you read,
> don't read it. There are X000 other newsgroups out there.

I am afraid you have missed the point of her stay here.

Best Wishes,

anm
-- 
/*-------------------------------------------------------.
| Andrew N. McGuire                                      |
| andrew.mcguire@walgreens.com                           |
`-------------------------------------------------------*/


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

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


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