[21770] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3974 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 15 11:10:40 2002

Date: Tue, 15 Oct 2002 08:10:15 -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, 15 Oct 2002     Volume: 10 Number: 3974

Today's topics:
        OS interface <frank.winkler@sun.com>
    Re: OS interface <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
        Perl Memory Management (MMichalow)
    Re: Perl Memory Management <mjcarman@mchsi.com>
    Re: Perl2exe problem. (MMichalow)
    Re: Perl2exe problem. <spikey-wan@bigfoot.com>
        Q: does there exist an HTTP redirect script ? <smillet751@nospammersplz.hotmail.com>
    Re: Regular Expression Hell (RealServer Log) (Joe Follansbee)
    Re: Switching from Python to Perl <REMOVEsdnCAPS@comcast.net>
    Re: Switching from Python to Perl <derek@wedgetail.com>
        tee (=?ISO-8859-1?Q?Olivier_Bo=EBl?=)
    Re: tee <bernard.el-hagin@DODGE_THISlido-tech.net>
    Re: Win32::NetAdmin a246456@fmr.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 15 Oct 2002 13:58:26 +0200
From: Frank Winkler - Sun Germany - Enterprise Services <frank.winkler@sun.com>
Subject: OS interface
Message-Id: <1034683107.3214@intranet.consol.de>

Hi there !

Does anybody know a module which provides an interface to OS specific
information like "ps" or "df"? I want to prevent explicitly opening a
command pipe to keep it portable ...

If such a module already existed I wouldn't have to invent the wheel
myself :) ...

TIA

-- 
---------------------------------------------------------------------------
Frank Winkler                                 frank.winkler@germany.sun.com
Sun Microsystems - Remote Admin Center
Sonnenallee 1                                       Voice +49 89 46008.2755
85551 Heimstetten - Germany                           Fax +49 89 46008.2740



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

Date: Tue, 15 Oct 2002 16:10:26 +0200
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: OS interface
Message-Id: <newscache$ep014h$khe$1@news.emea.compuware.com>

Frank Winkler - Sun Germany - Enterprise Services wrote (Tuesday 15 October 
2002 13:58):

> Hi there !
> 
> Does anybody know a module which provides an interface to OS specific
> information like "ps" or "df"? I want to prevent explicitly opening a
> command pipe to keep it portable ...
> 
> If such a module already existed I wouldn't have to invent the wheel
> myself :) ...
> 
> TIA
> 

Not that I know of, but then again... the goal is commendable but my guess 
is you will be overtaken by reality pretty quick: The output for these 
commands will probably be not the same. That means you need to interpretate 
the output (based on the platform you run it). If you need to know the 
platform to figure out what it means, might as well take it into 
consederation in the first place...

-- 
KP



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

Date: 15 Oct 2002 03:56:44 -0700
From: michalowski@interred.de (MMichalow)
Subject: Perl Memory Management
Message-Id: <7cd9e5d7.0210150256.63aaae32@posting.google.com>

Hi!

I have a question concerning perl's memory management. The Topic is
about clearing up arrays, so that the memory is given back to the
operating system.

Let me first say, that I read the question "How can I free an array or
hash so my program shrinks?" from PerlFAQ. So, the answer there does
not really satisfy me :-)

Here is my backround:
I need to implement a queue-tool in perl (using perl's i-threads),
which buffers the output of a foreign task and gives it to a second
foreign task, if it is listening.
The tool uses two FIFOs to be connected. Internal there are three perl
threads. The first takes an input line from the first FIFO and throws
it to the queue, the second watches the queue and writes some logfiles
and finally one thread to dequeue and print the line to the second
fifo.

Here are my problems:
While the queue is filled, it (and so the perl process) grows to a
certain value of used memory. Then the queue is read out and the
shifted elemets should be handled by perl's garbage collection. The
problem is, that the memory cleared by the garbage collector is not
given back to the OS. So, the queue has 100% fragmentation towards the
operating system.

Here are my dispositions:
I used lexical scopes ({ ... }), tried to 'undef' the array and it's
elements and of course used 'my' to initialise.

Here is my system:
Perl 5.8.0 running on a RedHat 7.x Linux Distribution.

Here are my questions:
I heard that it should be possible to replace perl's malloc function
by operation system based malloc functions, is that right? If this is
right, how can I do this and what malloc functions can be used? Is it
possible to compile perl in a way, that allows to give free memory
back to the os? The PerlFAQ is not very meaningful regarding this
question. If there is such a way, who can I do it?
The other way I read from PerlFAQ is to restart the perl process
cyclic. Is it  sufficient to restart single thread?

And finally:
Here is my apology for my bad english ;-)

Michael Michalowski


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

Date: Tue, 15 Oct 2002 08:12:05 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: Perl Memory Management
Message-Id: <aoh476$6qg1@onews.collins.rockwell.com>

On 10/15/02 5:56 AM, MMichalow wrote:
> 
> I have a question concerning perl's memory management. The Topic is
> about clearing up arrays, so that the memory is given back to the
> operating system.

In general, you can't. One possibile workaround is to have your program
exec() itself, but you may need to save off state information first.

> Let me first say, that I read the question "How can I free an array or
> hash so my program shrinks?" from PerlFAQ. So, the answer there does
> not really satisfy me :-)

Did you also read "How can I make my Perl program take less memory?" It
doesn't address your specific situation, but it may be useful anyway.

> I used lexical scopes ({ ... }), tried to 'undef' the array and it's
> elements and of course used 'my' to initialise.

Unfortunately, that part of the FAQ answer is in error. Perl would
rather keep the memory to avoid the risk of having to re-alloc it later.
Spaced used by my() variables that have gone out of scope will *not* be
reused elsewhere. (It will be reused by the same variable if it comes
back into scope.) Space used by undef'd globals can be reused elsewhere.
But... this still doesn't mean that the memory goes back to the OS.

> I heard that it should be possible to replace perl's malloc function
> by operation system based malloc functions, is that right? If this is
> right, how can I do this and what malloc functions can be used?

Check the INSTALL file in the source distribution.

> Is it possible to compile perl in a way, that allows to give free
> memory back to the os?

Depending on the OS, maybe.

> The other way I read from PerlFAQ is to restart the perl process
> cyclic.

Yep, that's the more portable/robust solution.

> Is it sufficient to restart single thread?

Hmm... dunno. I've never really played with threads.

-mjc



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

Date: 15 Oct 2002 06:56:25 -0700
From: michalowski@interred.de (MMichalow)
Subject: Re: Perl2exe problem.
Message-Id: <7cd9e5d7.0210150556.332d8cad@posting.google.com>

Hi!

Seems like you are missing some perl modules:

> Converting 'testing.pl' to testing.exe
> Warning: Can't locate Convert/EBCDIC.pm at D:\Perl\site\lib\Net\Cmd.pm line
> 19
> @INC = D:\Perl\lib, D:\Perl\site\lib, .
Perl is looking for Convert::EBCDIC and cannot find it.

> Warning: Can't locate Mac/InternetConfig.pm at
> D:\Perl\site\lib\Net\Config.pm line 40
> @INC = D:\Perl\lib, D:\Perl\site\lib, .
Perl is looking for Mac::InternetConfig and cannot find it.

The modules have to be installed in your @INC-path, that means they
have to exist in 'D:\Perl\lib' or in 'D:\Perl\site\lib' or in your
working directory ('.').


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

Date: Tue, 15 Oct 2002 15:28:21 +0100
From: "Richard S Beckett" <spikey-wan@bigfoot.com>
Subject: Re: Perl2exe problem.
Message-Id: <aoh8ne$7rp$1@newshost.mot.com>


"MMichalow" <michalowski@interred.de> wrote in message
news:7cd9e5d7.0210150556.332d8cad@posting.google.com...
> Hi!
>
> Seems like you are missing some perl modules:
>
> > Converting 'testing.pl' to testing.exe
> > Warning: Can't locate Convert/EBCDIC.pm at D:\Perl\site\lib\Net\Cmd.pm
line
> > 19
> > @INC = D:\Perl\lib, D:\Perl\site\lib, .
> Perl is looking for Convert::EBCDIC and cannot find it.
>
> > Warning: Can't locate Mac/InternetConfig.pm at
> > D:\Perl\site\lib\Net\Config.pm line 40
> > @INC = D:\Perl\lib, D:\Perl\site\lib, .
> Perl is looking for Mac::InternetConfig and cannot find it.
>
> The modules have to be installed in your @INC-path, that means they
> have to exist in 'D:\Perl\lib' or in 'D:\Perl\site\lib' or in your
> working directory ('.').

Hmmm. I don't know what those modules are, or why it would need them.

The .pl version works fine, and so does a .exe compiled by perlapp.

I really don't understand what's going on.

Thanks.

R.




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

Date: Tue, 15 Oct 2002 15:59:14 +0200
From: Gros Loup <smillet751@nospammersplz.hotmail.com>
Subject: Q: does there exist an HTTP redirect script ?
Message-Id: <MPG.18163d9dce81146398968c@news.free.fr>

Hello,

I need to trace HTTP connections between two given points and an easy 
way to proceed would be insert a PERL script, that would just listen and 
forward datas in telnet format (thus, not necessarily port 80) in both 
directions (and log it).

Do you know of a PERL script that is capable of doing it (I didn't find 
in CPAN) ?

Gros Loup from Grenoble, France.


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

Date: 15 Oct 2002 07:10:55 -0700
From: jfollansbee@speakeasy.net (Joe Follansbee)
Subject: Re: Regular Expression Hell (RealServer Log)
Message-Id: <38076b12.0210150610.ea6c29c@posting.google.com>

Friends,

I should've included the entire lines when I wrote the post. Here's
the two lines that contain the field I want. You can see it's somewhat
similar to Common Log Format, but I need to extract the particular
RealPlayer client info. In the first line, the field starts with the
string "[Moz..." In the second line, the string I want starts with
"[WinNT..." You can see that they are very different. Any regex
thoughts are helpful. Thanks!

Joe

192.168.1.3 - - [13/Oct/2002:09:03:38 -0700]  "GET
ramgen/compelinteractive/compel_message.smil HTTP/1.0" 200
 383 [Mozilla/4.0 (compatible;MSIE 5.01;Windows NT 5.0;AT&T CSM6.0)]
[] [] 186 0 0 0 0 7899
192.168.1.3 - - [13/Oct/2002:09:03:58 -0700]  "GET
compelinteractive/compel_message.smil?cloakport=8080,554,7
070 RTSP/1.0" 200 1775
[WinNT_5.0_6.0.10.505_play32_RN9GPD_en-US_686_axembed]
[54ce7c91-034a-11d6-e54a-c5d718818907] [] 1822 0 19 0 0 7900

tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnaqmfrg.1vv.tadmc@magna.augustmail.com>...
> Joe Follansbee <jfollansbee@speakeasy.net> wrote:
> 
> > I'm tearing me hair out to
> > build a regex that will match the "client info" entry. The regex has
> > to be able to find these two typical entries:
> > 
> > [Mozilla/4.0 (compatible;MSIE 5.01;Windows NT 5.0;AT&T CSM6.0)]
> > [WinNT_5.0_6.0.10.505_play32_RN9GPD_en-US_686_axembed]
> > 
> > Please help!
> 
> 
> Help us help you.
> 
> 
> the regexes below will _all_ match those two examples:  
> 
>    m/./
>    m/^.[A-Z]/
>    m/\d+\.\d+/
>    m/Win/
> 
> That is the direct answer to the question that you asked.
> 
> But let's continue, because the you probably meant to ask
> some other question...
> 
> 
> What is it that distinguishes the "good" lines from the "bad" lines?
> 
> I'll guess: match when the line starts and ends with square brackets:
> 
> 
>    m/^ [[]  [^]]+ ] $/x
> 
> 
> or with comments:
> 
>    m/^       # start of string
>      [[]     # opening sq bracket
>      [^]]+   # any chars that are not closing sq brackets
>      ]       # closing sq bracket
>      $       # end of the string
>     /x;


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

Date: Tue, 15 Oct 2002 06:22:59 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Switching from Python to Perl
Message-Id: <Xns92A84B293BAEAsdn.comcast@216.166.71.239>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Derek Thomson <derek@wedgetail.com> wrote in
news:3daac76f$0$23174$afc38c87@news.optusnet.com.au: 

> And that's about it, from my personal perspective. YMMV.
> 

Thanks for a great comparison.  Thanks for taking the time to go into such 
detail.  Lots of information there for me to process.

- -- 
Eric
print scalar reverse sort qw p ekca lre reh 
ts uJ p, $/.r, map $_.$", qw e p h tona e;

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPav6pWPeouIeTNHoEQKpHwCg20c2wnTMVARk/HaMKYFdN+LHfAAAoNZ5
pFU/3A/fzcFhQUqQ/wUuVwnF
=JN7E
-----END PGP SIGNATURE-----


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

Date: Tue, 15 Oct 2002 22:08:49 +1000
From: Derek Thomson <derek@wedgetail.com>
Subject: Re: Switching from Python to Perl
Message-Id: <3dac0553$0$12757$afc38c87@news.optusnet.com.au>

Hi Eric,

Eric J. Roode wrote:

> 
> Thanks for a great comparison.  

Hey, thanks! It's nice to be appreciated.

> Thanks for taking the time to go into such 
> detail.  Lots of information there for me to process.

That's okay. Despite the fact that the author of the slightly trollish 
original post has disappeared without even the having courtesy to 
acknowledge to my *first* reply, which did answer his question, I 
decided to take the opportunity to belt out that comparison I've been 
meaning to write, and douse a potential flame-war with reason at the 
same time.

Since I did end up spending so much time writing it (I couldn't stop 
once I started!), I may put it on a web site somewhere. I've also 
thought of some things to add since. If anybody thinks my words are 
useful, you may also put them up on a web site, or reprint them 
elsewhere, as long as my authorship is clearly noted.

I'd really appreciate any thoughts or feedback, or experience from 
people who know Python and are trying Perl, or vice versa, or even (like 
me) have just been using both happily for roughly the same period of time.

Perhaps this should be done on another thread, in case the OP was 
trolling. That way we avoid feeding a troll with the gratification of 
seeing a thread continue, even though the intent has been neatly 
subverted. (Apologies to the OP if it was not a troll, it's hard to tell)

--
D.



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

Date: 15 Oct 2002 05:37:21 -0700
From: oboel@dorrboel.com (=?ISO-8859-1?Q?Olivier_Bo=EBl?=)
Subject: tee
Message-Id: <e8f69cf.0210150437.d59ead2@posting.google.com>

Can you help?

I have a bunch of interactive Perl scripts that I would like to wrap
into ksh scripts to log in a file whatever is displayed. Without
modifying my Perl scripts.
tee seems to be the answer. However, the screen output is displayed
only when the script finishes.
Example :
#!/usr/bin/perl
print "Starting\n";
print "Type anything then hit <enter> : ";
$input = <STDIN>;
print "You typed $input";
print "End\n";

#mytest.pl | tee log
blabla
Starting
Type anything then hit <enter> : You typed blabla
End

The output is displayed only after I hit <enter>.

TIA,


Olivier


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

Date: Tue, 15 Oct 2002 12:45:09 +0000 (UTC)
From: Bernard El-Hagin <bernard.el-hagin@DODGE_THISlido-tech.net>
Subject: Re: tee
Message-Id: <slrnaqo3au.7rm.bernard.el-hagin@gdndev25.lido-tech>

In article <e8f69cf.0210150437.d59ead2@posting.google.com>, Olivier Boël wrote:
> Can you help?
> 
> I have a bunch of interactive Perl scripts that I would like to wrap
> into ksh scripts to log in a file whatever is displayed. Without
> modifying my Perl scripts.
> tee seems to be the answer. However, the screen output is displayed
> only when the script finishes.


perldoc -q flush


Cheers,
Bernard
--
echo 42|perl -pe '$#="Just another Perl hacker,"'


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

Date: Tue, 15 Oct 2002 08:36:25 -0400
From: a246456@fmr.com
Subject: Re: Win32::NetAdmin
Message-Id: <3DAC0BC9.2FD64D53@fmr.com>

Hi,

   I am the administrator and i support all the servers in this environment. I
am checking for a local user on the local workstation. It works on a single
machine, but it fails when i try to process list of servers from a text file.

Do i miss anything in my script..COuld you please tell me.

Thanks.

Helgi Briem wrote:

> On Mon, 14 Oct 2002 14:10:17 -0400, a246456@fmr.com wrote:
>
> >  I wrote a script which process a text file which contains list of
> >servers, and checks whether the user account exist on the remote server.
> >I am getting incorrect information like User does`nt exist on machine.
> >
> >I am not able to find what is the problem? Could you pls help me...
>
> Simplify first and separate parsing the hosts file from
> using Win32::NetAdmin::UsersExist.
>
> When I try it for a single
> $User = 'Administrator';
> and my own workstation, it works fine.
>
> When I check it for another workstation however,
> it doesn't and is very slow about returning.
>
> On the other hand, when I check for a legitimate
> username and a domain server, it  works again.
>
> So, my suggestion is this (unchecked).  I think you are
> not allowed (rightly) to check another workstation for
> local users unless you are a local user on that particular
> workstation, but you can check for the existence
> of domain users if you are a member of that domain.
>
> None of this has anything to do with Perl.  The Perl
> part works just fine.
> --
> Regards, Helgi Briem
> helgi AT decode DOT is
>
>                            A: Top posting
>                            Q: What is the most irritating thing on Usenet?
>                                            - "Gordon" on apihna



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 3974
***************************************


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