[15860] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3273 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 7 06:05:36 2000

Date: Wed, 7 Jun 2000 03:05:15 -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: <960372315-v9-i3273@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 7 Jun 2000     Volume: 9 Number: 3273

Today's topics:
    Re: Activeware perl 313 and makemake.pm <pds@x-datcon.co.uk>
    Re: Anoymous hash slices <lr@hpl.hp.com>
        Crypt-IDEA-1.01 <felix.staehlin@kuoni.ch>
        Crypt-IDEA-1.01 <felix.staehlin@kuoni.ch>
        Date format [4]++ / [5]+=1900 ? euterpe21@yahoo.com
    Re: Date format [4]++ / [5]+=1900 ? (Eric Bohlman)
        Extract filename from path? <henrik.jonsson@sesig.mail.abb.com>
    Re: Extract filename from path? <abe@ztreet.demon.nl>
    Re: global chown ?? (Ken Pizzini)
    Re: good perl coding style <bill.kemp@wire2.com>
    Re: Help with OO needed. (Bart Lateur)
    Re: Help with OO needed. (Bart Lateur)
        how to return multiple hashtables from sub <pkrusenoNOpkSPAM@ley.de.invalid>
    Re: how to write on a file? <the_tickNOthSPAM@inet.net.nz.invalid>
    Re: how to write on a file? (Eric Bohlman)
        mail attachments.. <admin@megagiga.com>
    Re: Need help with error msg <lr@hpl.hp.com>
    Re: needs help w system interaction <michael_roper@hotmail.com>
        Obtaining stats of a remote file <jason@generationterrorists.com>
    Re: Perl -VS- PHP (Andreas Kahari)
    Re: Perl 5.6 stable?? lvirden@cas.org
        Perl and memory consumption <jasonb885@my-deja.com>
    Re: Perl and memory consumption <godzilla@stomp.stomp.tokyo>
    Re: Perl and memory consumption (Eric Bohlman)
    Re: Perl and memory consumption (brian d foy)
    Re: perl Configure <wwx@chi.is.tw>
        Perl Crypt function <gurumuhk@my-deja.com>
        Perl's evaluation order for a logical expression <talexb@tabsoft.on.ca>
    Re: Perl's evaluation order for a logical expression (Eric Bohlman)
        Perl-5.6.0 on SGI's IRIX <bjoho@centralnet.ch>
        perlscript & wsh <phantomias@hotmail.com>
    Re: please?? (Bart Lateur)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 7 Jun 2000 09:03:23 +0100
From: "Paul D.Smith" <pds@x-datcon.co.uk>
Subject: Re: Activeware perl 313 and makemake.pm
Message-Id: <8hkvl8$krj$1@soap.pipex.net>

Aha - by "official and supported" I meant that if I have a problem using
tools which were written "in house" using this version of Perl then I get
support but if I try to go "off the beaten track" then I'm on my own.  And
the old adage "if it ain't broke, don't fix it" is rigourously applied until
we find an "official" need to "move up" to a later level of Perl.

Thanks for the suggestions though.  I'll try "ActiveWare".
Paul DS

--
Please remove the "x-" if replying to sender.
"Abe Timmerman" <abe@ztreet.demon.nl> wrote in message
news:ilhqjso8nf432qbeives3tskfctcp90ht4@4ax.com...
> On Tue, 6 Jun 2000 16:20:30 +0100, "Paul D.Smith" <pds@x-datcon.co.uk>
> wrote:
>
> > Anyone hit this?  I have tried to install some Perl libraries (libnet)
but
> > have found that ExtUtils/MakeMaker.pm is absent.  This is with the
Windows
> > NT Activeware port of Perl (build 313).  Anyone know the "correct"
solution
> > to this?
> >
> > FYI: I cannot upgrade as this is the "official and supported" version of
> > Perl which we currently use. No doubt in time we'll upgrade but for now,
> > this is what I have :-).
> Well since it is official and *supported*, ask whoever supports this
> rather old version. If they won't help you, it's not supported I would
> say.
> In that case go to: http://www.activestate.com/ and get the 522 or 613
> build.
>
> There are reasons for not using perl 5.003 anyway :-)
>
> --
> Good luck,
> Abe




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

Date: Tue, 6 Jun 2000 22:03:50 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Anoymous hash slices
Message-Id: <MPG.13a777876b0402fd98ab33@nntp.hpl.hp.com>

In article <393D965F.2B26738D@My-Deja.com>, makarand_kulkarni@My-Deja.com 
says...

 ...

> @v = map  { {'key1'=> (split)[0], 'key2'=> (split)[1], 'key3'=> (split)[2]} }
>      <DATA>;

Sound of up-chucking at three splits when one would do, as I posted.

Where have all the cycles gone?

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


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

Date: Wed, 07 Jun 2000 08:35:38 +0200
From: Felix Staehlin <felix.staehlin@kuoni.ch>
Subject: Crypt-IDEA-1.01
Message-Id: <393DED39.25254CD6@kuoni.ch>

Hi,
Need Help, to include Crypt-IDEA-1.01 to Perl 5.005 on AIX 4.3.3

I have download this Module from CPAN, but i dont have the include-files

endian.h, features.h
I have no gcc, only AIX-C compiler.
The Problem is, i can compile the module, but the test.pl does not work
!
Any solution ?

----------------------------------------------------------
Regards,
Felix Staehlin  Kuoni Travel Ltd.
----------------------------------------------------------
Unix-Admin AIX/RS6000
Answer mailto:felix.staehlin@kuoni.ch
----------------------------------------------------------




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

Date: Wed, 07 Jun 2000 09:27:52 +0200
From: Felix Staehlin <felix.staehlin@kuoni.ch>
Subject: Crypt-IDEA-1.01
Message-Id: <393DF978.DC4CC42D@kuoni.ch>

Hi,
Need Help, to include Crypt-IDEA-1.01 to Perl 5.005 on AIX 4.3.3

I have download this Module from CPAN, but i dont have the include-files

endian.h, features.h
I have no gcc, only AIX-C compiler.
The Problem is, i can compile the module, but the test.pl does not work
!
Any solution ?

----------------------------------------------------------
Regards,
Felix Staehlin  Kuoni Travel Ltd.
----------------------------------------------------------
Unix-Admin AIX/RS6000
Answer mailto:felix.staehlin@kuoni.ch
----------------------------------------------------------


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

Date: Wed, 07 Jun 2000 11:26:21 +0200
From: euterpe21@yahoo.com
Subject: Date format [4]++ / [5]+=1900 ?
Message-Id: <eo4sjs4j2ordc96qdt08kgb52dlo46t0np@4ax.com>

Hi,

I'm currently using this :

@d_date = localtime(time);
$d_date[4] ++;
$d_date[5] += 1900;

but I don't know what ++ and += really do

+ is defined as a model searching character, ok ?
But what means ++ applied to the month element only and not to hours,
minutes and seconds?
On the other way, what means += applied to the year element ?
TIA for any explanation.
Jack


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

Date: 7 Jun 2000 09:37:03 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Date format [4]++ / [5]+=1900 ?
Message-Id: <8hl53v$mkg$1@slb7.atl.mindspring.net>

euterpe21@yahoo.com wrote:
: Hi,
: 
: I'm currently using this :
: 
: @d_date = localtime(time);
: $d_date[4] ++;
: $d_date[5] += 1900;
: 
: but I don't know what ++ and += really do
: 
: + is defined as a model searching character, ok ?
: But what means ++ applied to the month element only and not to hours,
: minutes and seconds?
: On the other way, what means += applied to the year element ?

I think you want to read the perlop man page; it should clear up quite a 
bit of confusion.



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

Date: Wed, 07 Jun 2000 08:52:03 +0200
From: Henrik Jönsson <henrik.jonsson@sesig.mail.abb.com>
Subject: Extract filename from path?
Message-Id: <VfA9Oan+eXxZzmAPOg25l9xJx7da@4ax.com>

I am trying to create a function that extract the filename from a
path. 

The problem is that the function must accept both Windows path and
Unix paths. So I can't use File::Basename, this must be given the os
type before calling basename. And I dont know the users os when
running my script (cgi uploading script).

Is this possible?

Thanks!

/henrik


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

Date: Wed, 07 Jun 2000 10:58:10 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Extract filename from path?
Message-Id: <4e2sjsov1oullbkr15u9npnea04oipbo2v@4ax.com>

On Wed, 07 Jun 2000 08:52:03 +0200, Henrik Jönsson
<henrik.jonsson@sesig.mail.abb.com> wrote:

> I am trying to create a function that extract the filename from a
> path. 
> 
> The problem is that the function must accept both Windows path and
> Unix paths. So I can't use File::Basename, this must be given the os
> type before calling basename. And I dont know the users os when
> running my script (cgi uploading script).
And you don't expect uploads from other file systems (Mac...)?
In general it is not good practice to use user-supplied filenames. Have
your own system of naming the incoming files, and maybe keep some sort
of index file to map your name to the original name. You don't want
those names on your filesystem.

If you really want you could examine the 'USER_AGENT' header field to
see if there is info on the OS, but that is not guarantied.

You might want to read some documentation:
perldoc perlport
perldoc File::Spec

-- 
Good luck,
Abe


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

Date: 7 Jun 2000 04:19:53 GMT
From: ken@halcyon.com (Ken Pizzini)
Subject: Re: global chown ??
Message-Id: <8hkih9$55d$5@brokaw.wa.com>

On 6 Jun 2000 09:16:18 GMT,
Villy Kruse <vek@pharmnl.ohout.pharmapartners.nl> wrote:
>>    find . -user sam | xargs chown joe
>This will fail if there are any file names containing "funny" characters
>such as spaces or shell metacharacters.  No real unix user would ever
>dream of creating such files, but if the unix systems acts as a file
>server for win9x systems, then these file names are becomming quite
>common.
>
>   find . -user sam -exec chown joe {} \;
>
>would be safer, although slower.

Which is why -print0 was invented:
    find . -user sam -print0 | xargs -0 chown joe

It isn't universally available, but it is a highly valuable
feature worth checking for.

		--Ken Pizzini


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

Date: Wed, 7 Jun 2000 08:53:54 +0100
From: "W Kemp" <bill.kemp@wire2.com>
Subject: Re: good perl coding style
Message-Id: <960364537.23308.0.nnrp-06.c3ad6973@news.demon.co.uk>

<snip>

>+ Would you answer the question if I told you to think about English?

computer programmers that are good verbal communicators? (wow)


<snip>

>I don't recall if anyone else suggested an origin for this.  I do recall
>thinking how weird it was when I began to learn Perl.  Now it makes
>eminent sense, of course.  :-)


So perhaps the "if X then Y " logic is better for the brain of a C
programmer ( back to the start of the thread).






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

Date: Wed, 07 Jun 2000 07:41:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Help with OO needed.
Message-Id: <393ff94c.2342825@news.skynet.be>

James Kufrovich wrote:

>    my $class  = ref($temp) || $temp;
>    my $parent = ref($temp) && $temp;
>
>	I understand that ref taken on an object will return ARRAY, HASH,
>SCALAR or whatever type it is, and so that would evaluate as true.

Not with a blessed object. Have you tried it?

For example:

	my $object = {};
	bless $object, 'Foo::Bar';
	print ref $object;

This prints 'Foo::Bar', not 'HASH'. It's an interesting experiment to
print out the object itself:

	print $object
-->
	Foo::Bar=HASH(0x1391e0)

>The
>Cookbook says that ref taken on a class will return the class name - a
>string.  How does that evaluate to false?

Well, if you take ref() of a string, it will return an empty string.

	print "<", ref("Foo::Bar"), ">\n";
-->
	<>

And if you note that you can call a method either as a class method

	Foo::Bar->new(...)
or
	new Foo::Bar(...)

or as an object method

	$object->new(...)


In the case of a class method, the name of the class is passed as a
string, as the first argument. Actually, the class name IS a string:

	$class = 'Foo::Bar';
	$class->new()

This wil call Foo::Bar's new method with "Foo::Bar" as the first
argument.

In an object method, the first argument is the object itself.

In summary: called as a class method, $parent becomes the emtpy string,
and $class becomes the string that is the first argument. Called as an
object method, $class becomes the class of the object, and $parent
becomes the object itself. So I gather the new object will be a child of
that object; or at least: the passed object will be the parent of the
new object. That usually means the same thing...   ;-)

-- 
	Bart.


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

Date: Wed, 07 Jun 2000 07:42:01 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Help with OO needed.
Message-Id: <3940fc9c.3190208@news.skynet.be>

James Kufrovich wrote:

>    my $class  = ref($temp) || $temp;
>    my $parent = ref($temp) && $temp;
>
>	I understand that ref taken on an object will return ARRAY, HASH,
>SCALAR or whatever type it is, and so that would evaluate as true.

Not with a blessed object. Have you tried it?

For example:

	my $object = {};
	bless $object, 'Foo::Bar';
	print ref $object;

This prints 'Foo::Bar', not 'HASH'. It's an interesting experiment to
print out the object itself:

	print $object
-->
	Foo::Bar=HASH(0x1391e0)

>The
>Cookbook says that ref taken on a class will return the class name - a
>string.  How does that evaluate to false?

Well, if you take ref() of a string, it will return an empty string.

	print "<", ref("Foo::Bar"), ">\n";
-->
	<>

And if you note that you can call a method either as a class method

	Foo::Bar->new(...)
or
	new Foo::Bar(...)

or as an object method

	$object->new(...)


In the case of a class method, the name of the class is passed as a
string, as the first argument. Actually, the class name IS a string:

	$class = 'Foo::Bar';
	$class->new()

This wil call Foo::Bar's new method with "Foo::Bar" as the first
argument.

In an object method, the first argument is the object itself.

In summary: called as a class method, $parent becomes the emtpy string,
and $class becomes the string that is the first argument. Called as an
object method, $class becomes the class of the object, and $parent
becomes the object itself. So I gather the new object will be a child of
that object; or at least: the passed object will be the parent of the
new object. That usually means the same thing...   ;-)

p.s. I just noticed that the usual OO semantics all assume that the
class name will never be "0" (zero).

-- 
	Bart.


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

Date: Wed, 07 Jun 2000 02:58:04 -0700
From: Patrick_Krusenotto <pkrusenoNOpkSPAM@ley.de.invalid>
Subject: how to return multiple hashtables from sub
Message-Id: <05a235dc.384a0167@usw-ex0104-026.remarq.com>

Hello,
  i have a problem with the return function.

my sub shall return three hashtables to the caller. Ive tried
this by   "return (%a,´%b,%c)".
if i call my function with   "(%x,%y,%z) = foo()" , the caller
receives the three tables unified in %x. What do I wrong ?

Thank you for help.

Regards
   Patrick

* 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: Tue, 06 Jun 2000 23:20:54 -0700
From: The_tick <the_tickNOthSPAM@inet.net.nz.invalid>
Subject: Re: how to write on a file?
Message-Id: <00702683.eebe8105@usw-ex0101-006.remarq.com>

Here is how you write to a file:

open(FILE,"location/to/file.txt");
flock(FILE, 2);
print FILE "text goes here";
flock(FILE, 8);
close(FILE);

the file must already exist


----------------------------------------------------------------
Free Web Pages
http://www.digital-avatar.com

* 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: 7 Jun 2000 06:32:45 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: how to write on a file?
Message-Id: <8hkqad$ejd$1@slb6.atl.mindspring.net>

The_tick (the_tickNOthSPAM@inet.net.nz.invalid) wrote:
: Here is how you write to a file:
                 ^ don't

: open(FILE,"location/to/file.txt");

Attempts to open the file for reading, blindly assumes the attempt was 
successful.

 : flock(FILE, 2);

Uses magic number rather than symbolic constant from Fcntl.pm to represent
exclusive lock which most OS's won't give you on a file opened for
reading. 

: print FILE "text goes here";

Attempts to write to filehandle open for reading only.

: flock(FILE, 8);

Uses magic number to release lock, possibly before buffers have been 
flushed (newer perls will flush buffers automatically here, or would if 
the filehandle were actually writable).

: close(FILE);

Wow!  A statement without any problems!

: 
: the file must already exist

Well, the open() will surely fail if it doesn't...


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

Date: Wed, 7 Jun 2000 11:34:24 +0200
From: "MegaGiga" <admin@megagiga.com>
Subject: mail attachments..
Message-Id: <8hl1j4$eks$3@news3.inter.net.il>

How do I add attachments to mail sent through a form?








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

Date: Tue, 6 Jun 2000 22:17:43 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Need help with error msg
Message-Id: <MPG.13a77ad45fca36d598ab34@nntp.hpl.hp.com>

In article <8hkacu$1ka$1@nnrp1.deja.com>, pornpira@beta.tricity.wsu.edu 
says...
> I've got a question about this error message.
> 
> "Odd number of elements in hash list at /opt/perl5.004/lib/CGI.pm line
> 617."
> 
> I don't understand what this means and how to fix this.  Can anyone
> help?

I will do your reading (of perldiag, which lists all perl error messages) 
for you.

  Odd number of elements in hash assignment

     (S) You specified an odd number of elements to initialize a hash, 
         which is odd, because hashes come in key/value pairs. 

As I am sure there is no error in CGI.pm at that point, in all likelihood 
there is a problem in your code, where you are invoking a CGI function.  
Ah, I see it now.  It is at line 17!

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


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

Date: Wed, 7 Jun 2000 18:14:38 +1000
From: "Michael Roper" <michael_roper@hotmail.com>
Subject: Re: needs help w system interaction
Message-Id: <8hl05s$m11$1@metro.ucc.usyd.edu.au>

> Is there anyway to run a unix program from within a perl script??
Why not just use backticks
eg
@result_lines = `ls -la`
If you need to catch stderr you need to do redirection s.t. like this
(depends on your shell):
@result_lines = `some_unix_program -arg 2>err.file`;
Good luck.
-Michael




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

Date: Wed, 07 Jun 2000 16:07:43 +0800
From: "Jason Q." <jason@generationterrorists.com>
Subject: Obtaining stats of a remote file
Message-Id: <393E02CF.1D736543@generationterrorists.com>

Hi there

Is it possible, via a Perl script, to obtain info (equivalent of Perl's
"stat" function) of a file that is on a remote server?

Any help would be appreciated.

Thanks.


Jason Q.


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

Date: 5 Jun 2000 17:14:11 +0100
From: andkaha@hello.to.REMOVE (Andreas Kahari)
Subject: Re: Perl -VS- PHP
Message-Id: <393bc3c3@merganser.its.uu.se>

In article <393BAEB1.ED02E00E@backwoods.org>, MC  <mc@backwoods.org> wrote:
>Maybe I asked this in the wrong group? You all seem biased. <g> Is there a PHP
>NG? *grin*

You shouldn't go to a Perl or PHP NG for un-biased comments!

There's a couple of PHP mailing list at
<URL:http://www.se.php.net/support.php> and the same page also
contains info about NGs related to PHP.

[cut]
>-- 
>---------------------------------------------------------------------
>My email address(s) are my private property.  They are NOT to be used
>or recorded for ANY reason without my explicit permission.  Disregard
>of this statement is in violation of federal privacy & copyright law.

I guess you will have to talk about Deja.com about that last thing...

/A

-- 
# Andreas Kähäri, <URL:http://hello.to/andkaha/>
# -----------------------------------------------------------
# All junk e-mail is reported to the appropriate authorities. 
# Quidquid latine dictum sit, altum viditur.


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

Date: 7 Jun 2000 04:20:17 GMT
From: lvirden@cas.org
Subject: Re: Perl 5.6 stable??
Message-Id: <8hkii1$svg$2@srv38.cas.org>


According to sergei_kucherov  <sergei_kucherov@3com.com>:
:available. Why aren't all patches available bundled in with the source
:distribution (eg. under a "develop.tar.gz" name)?

Because instead they are available via ftp, rsync, etc...

rsync -auvz rsync://ftp.linux.activestate.com/perl-current/ perl-5.6.0/
-- 
<URL: https://secure.paypal.com/refer/pal=lvirden%40yahoo.com>
<URL: mailto:lvirden@cas.org> <URL: http://www.purl.org/NET/lvirden/>
Unless explicitly stated to the contrary, nothing in this posting
should be construed as representing my employer's opinions.


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

Date: Wed, 07 Jun 2000 04:24:23 GMT
From: |Odo| <jasonb885@my-deja.com>
Subject: Perl and memory consumption
Message-Id: <8hkipc$79e$1@nnrp1.deja.com>

I have a script which is running into Apache RLimitMEM walls and so I'm
trying to reduce the amount of memory it uses.

What kind of overhead is associated with using modules?

If I use module A and B in a script and module A uses module B, do I end
up with two copies of module B or just one?

I've been trying to use (soft) references as often as possible.  Could I
be overlooking things that are increasing memory consumption more than
might otherwise need to occur?


I attempted to figure out how much memory some of the modules I use
consume with top (just total memory, not accounting for shared or
anything).  I came up with these figures:

Perl = 2228KB
DBI = 580KB
Empty Module = 8KB (108K - 100K module penalty)
POSIX = 820KB
Carp = 32KB
Time::ParseDate = 396KB
CGI = 296KB
First Module Penalty: 100KB

I came up with First Module Penalty because using two empty modules only
consumed 8K more, so I guessed that it costs me 100K to use at least one
module.

Are those figures even remotely accurate?

There must be some HOWTOs or something I overlooked that explain how to
reduce memory consumption / overheat when using Perl.

Thanks!


--
Sincerely,
Jason Boxman


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


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

Date: Tue, 06 Jun 2000 22:00:23 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Perl and memory consumption
Message-Id: <393DD6E7.E704E99A@stomp.stomp.tokyo>

|Odo| wrote:

(snipped here and there)
 
> I have a script which is running into Apache RLimitMEM walls 
> and so I'm trying to reduce the amount of memory it uses.

> What kind of overhead is associated with using modules?


Module overhead is roughly analogous to the
size of Godzilla's head, or perhaps the
size of King Kong's head.
 

> There must be some HOWTOs or something I overlooked 
> that explain how to reduce memory consumption / overheat
> when using Perl.

Best and most reliable method to prevent blowing
a Perl radiator hose, is use of your fingers and
your keyboard, along with some elbow grease.

As a very loose and rough guesstimation, each
module, averaging all modules together, represents
a memory bloat factor of one-thousand percent over
what your fingers can do with a keyboard.

What your fingers and a keyboard can do is write
your own code to do what you want without modules,
reducing your memory bloat down to a size analogous
to dear little Tinker Bell's head.

Clear example. With a Steve Brenner type read and
parse, including security coding, you can do in
less than five kilobytes, a very generous amount,
what takes cgi.pm to do in a quarter of megabyte.

If you truly want to reduce module memory bloat,
write your own custom coding unless there is a 
darn good reason to use a Godzilla size module.


Godzilla!


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

Date: 7 Jun 2000 06:47:30 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl and memory consumption
Message-Id: <8hkr62$ejd$2@slb6.atl.mindspring.net>

|Odo| (jasonb885@my-deja.com) wrote:
: I have a script which is running into Apache RLimitMEM walls and so I'm
: trying to reduce the amount of memory it uses.
: 
: What kind of overhead is associated with using modules?

Very little unless the modules contain lots of code that's never used in 
most invocations of the process.  If they do, and they're under your 
control, look into autoloading.

: If I use module A and B in a script and module A uses module B, do I end
: up with two copies of module B or just one?

Just one.

: I've been trying to use (soft) references as often as possible.  Could I
: be overlooking things that are increasing memory consumption more than
: might otherwise need to occur?

"Soft" references usually means symbolic references.  You shouldn't be
using those anyway, and they require more memory than hard (true)
references. 

: There must be some HOWTOs or something I overlooked that explain how to
: reduce memory consumption / overheat when using Perl.

Did you read the section on "efficiency" in Chapter 8 of the Camel book?

I rather suspect that your data structures, not the amount of code 
you have, are the main influence on how much memory you're using.  Watch 
out for cases where you maintain too much "in-process inventory" (e.g. 
reading an entire file into an array, processing the array line-by-line 
and building another array, and so on).  Avoid constructs like 
"@array=(@array,$newitem)" that make temporary copies of potentially 
large things (remember that once perl grabs memory, it doesn't return it 
to the system when it becomes unused; it just sets it aside for its own 
future use).  Watch out for memory leaks.



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

Date: Wed, 07 Jun 2000 04:20:42 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Perl and memory consumption
Message-Id: <brian-ya02408000R0706000420420001@news.panix.com>

In article <393DD6E7.E704E99A@stomp.stomp.tokyo>, "Godzilla!" <godzilla@stomp.stomp.tokyo> posted:

> What your fingers and a keyboard can do is write
> your own code to do what you want without modules,
> reducing your memory bloat down to a size analogous
> to dear little Tinker Bell's head.

this is ridiculous.  whether or not you type it in 
yourself is not that significant necessarily (especially
with autoloading).

however, i realize that challenging your lies are unlikely
to be meant with any hard numbers.

> Clear example. With a Steve Brenner type read and
> parse, including security coding, you can do in
> less than five kilobytes, a very generous amount,
> what takes cgi.pm to do in a quarter of megabyte.

or, you could use some of the other CGI modules, like
CGI::Request.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>


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

Date: Wed, 7 Jun 2000 14:16:05 +0800
From: "www.hinet.net" <wwx@chi.is.tw>
Subject: Re: perl Configure
Message-Id: <8hkpou$abb@netnews.hinet.net>


what is CWD?

Elaine Ashton <elaine@chaos.wustl.edu> wrote in message
news:B55FEA70.5606%elaine@chaos.wustl.edu...
> in article 8hatqt$btc@netnews.hinet.net, www.hinet.net at wwx@chi.is.tw
> quoth:
> > The system tells me [   Can't open Perl Script "Configure" No such file
> > ordirectory" ]
>
> http://www2.psy.uq.edu.au/~ftp/Crypto/ssleay/Building.html
>
> This isn't a Perl problem. It's already telling you what happened...it
> cannot find 'Configure'. Now, if you think really hard you might be able
to
> divine that CWD or '.' isn't in your path.....
>
> e.
>
>




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

Date: Wed, 07 Jun 2000 06:46:17 GMT
From: GuruMuhk <gurumuhk@my-deja.com>
Subject: Perl Crypt function
Message-Id: <8hkr3m$ctm$1@nnrp1.deja.com>

Hi there,

I just have a little question about crypt function,..

while testing my login form which require a nickname/password,
the password was encrypted using the crypt() function

and for examples my password is
$pass = 'thisismypass';
$encryptedpass = 'Fd\.lfdkjdsf'; <- fake I came up with for examples..

if ( crypt( $pass, $encryptedpass ) eq $encryptedpass )
{
      print "worked\n";
}

this works perfectly, but if I set $pass to
'thisismypassANDTHISISIGNORED';

this will also show as a valid password,
and I also tried adding random chars at my linux login prompt and it
also saw my password as valid even though I added extra chars after the
password..

so I was just wondering if this was normal or not, is it ?


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


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

Date: Wed, 07 Jun 2000 04:44:20 GMT
From: T. Alex Beamish <talexb@tabsoft.on.ca>
Subject: Perl's evaluation order for a logical expression
Message-Id: <mmkrjsc62dsehlaflaj2afdl3v1cgtfec7@4ax.com>

I'm having fits with a script that has code like

  if ( ( $Col > 1 ) &&
       ( defined ( $Table[ $Col - 1 ][ $Row ] ) ) &&
       ( $Table[ $Col - 1 ][ $Row ] eq $TableHash->{ 'stmt_date' } ) )

Apache is complaining that there is the "Use of uninitialized value"
somewhere in the line. I'm damned if I can find it .. however it may
depend on the order that perl evaluates the logical expression.

If it does the third part before the second part, there could be a
problem. I don't think I can change the order of evaluation by adding
brackets, so I suppose one solution would be

  if ( ( $Col > 1 ) &&
       ( defined ( $Table[ $Col - 1 ][ $Row ] ) )
  {
    if ( $Table[ $Col - 1 ][ $Row ] eq $TableHash->{ 'stmt_date' } )
    {
    }
  }

So by the time we get inside, we know that the matrix element exists.

Thoughts? Comments? Thanks!



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

Date: 7 Jun 2000 06:53:54 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl's evaluation order for a logical expression
Message-Id: <8hkri2$ejd$3@slb6.atl.mindspring.net>

T. Alex Beamish (talexb@tabsoft.on.ca) wrote:
: I'm having fits with a script that has code like
: 
:   if ( ( $Col > 1 ) &&
:        ( defined ( $Table[ $Col - 1 ][ $Row ] ) ) &&
:        ( $Table[ $Col - 1 ][ $Row ] eq $TableHash->{ 'stmt_date' } ) )
: 
: Apache is complaining that there is the "Use of uninitialized value"
: somewhere in the line. I'm damned if I can find it .. however it may
: depend on the order that perl evaluates the logical expression.

That order is quite well defined, as a glance at perlop would have told
you; the three "&&" clauses are evaluated strictly left-to-right, each
successive one being evaluated only if the previous one succeeded. 

The only thing that could cause that message (which is coming from 
perl, not apache) would be an uninitialized $Row.  Try printing out its 
value.


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

Date: Wed, 07 Jun 2000 10:02:45 +0100
From: Bruno Joho <bjoho@centralnet.ch>
Subject: Perl-5.6.0 on SGI's IRIX
Message-Id: <393E0FB5.7E5AA362@centralnet.ch>

Hi folks

I've tried to compile the latest perl (with gcc2.95.2) so far so good,
but when I ran "make test" I get errors on
lib/io_multihomed Failed at test 3 and 4
lib/io_xs  Failed at test 0
I have also a strange "skip": lib/ipc_sysv  skipped: no semctl possible
Are those errors related? Do I need to install something additional?

I apreciate any help

--
Bruno Joho




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

Date: Wed, 07 Jun 2000 12:05:20 +0200
From: mao <phantomias@hotmail.com>
Subject: perlscript & wsh
Message-Id: <393E1E60.352AD0F0@hotmail.com>

hello,

i've downloaded and installed the windows scripting host on my win95
system and i registered my activeperl installation to work with the WSH.

but wether i run it via "cscript test.plc foo bar" or "cscript test.plc
/foo /bar", the @ARGV is always empty.
do i need another array or even a function to get the parameters in my
perl script?
or is there another way to pass them to the script?
i'v already spent hours for searching any helpful sourcecode or faq but
i found no solution at all so i would appreciate any help.

thanks,
mao



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

Date: Wed, 07 Jun 2000 09:44:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: please??
Message-Id: <394a1914.10478536@news.skynet.be>

Helza wrote:

>I just started with perl (sorry) but i have this project i'm working which
>is completely stuck until i can fix this :(

You need to incorporate a shorter timeout. For example (untested):

	eval {
		$SIG{ALRM} = sub { die "Timeout\n" };
		alarm 5;  # seconds
		.... # prompt the server
	};
	alarm 0;  # disable alarm() as soon as you get a response!
	if($@) {
		print STDERR "Server is not responding...\n";
	} 

See the entry for "alarm" in perlfunc.

I hope you're not on Activestate (Windows) because that's the one
platform for which I know where alarm() doesn't work.

-- 
	Bart.


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

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


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