[10802] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4403 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 11 09:08:17 1998

Date: Fri, 11 Dec 98 06:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 11 Dec 1998     Volume: 8 Number: 4403

Today's topics:
    Re: @INC newbie question (M.J.T. Guy)
        Any modules/code for accessing Fidelity NetBenefits at  <john-cavanaugh@cableone.net>
        Apache <-> Informix <-> Perl <Dirk.Schumacher@depot147.dpd.de>
    Re: Apache <-> Informix <-> Perl <ilia@jet.msk.su>
    Re: Diagnostic Scrolls by (Bart Lateur)
    Re: Diagnostic Scrolls by scott@softbase.com
    Re: HTML Embedded in Perl (JuNat)
        ip to name lookup (reverse name lookup) <adegutis@isi-info.com>
    Re: Learning Perl, 2nd edition, exercise 7.1b <ajohnson@gatewest.net>
        Magic Windows and CGI (Zinc Plate)
        New module Net::RawIP <ksv@gw.al.lg.ua>
    Re: opening /dev/sequencer <etienne@anonimo.isr.ist.utl.pt>
    Re: Out of memory!?? <sansil@pchome.com.tw>
    Re: panic: leave_scope inconsistancy (M.J.T. Guy)
    Re: Perl code for CM11a X10 interface <john@dlugosz.com>
    Re: Perl tip needed: High CPU Usage (Craig Berry)
    Re: Perl tip needed: High CPU Usage <l.brocard@elsevier.nl>
    Re: Perl tip needed: High CPU Usage <conmara@tcon.net>
    Re: Precision(?) of Perl <qdtcall@esb.ericsson.se>
    Re: recursive dir in perl <qdtcall@esb.ericsson.se>
    Re: Regular Expression help (Larry Rosler)
    Re: running one script from another <ebohlman@netcom.com>
        Send variables with <a href> petra_danielsson@my-dejanews.com
    Re: Send variables with <a href> <gernot@cat.at>
    Re: TCL <-> PERL, what's better. (Cameron Laird)
        Writing to filehandles and STDOUT charlie66@my-dejanews.com
    Re: Writing to filehandles and STDOUT <ebohlman@netcom.com>
    Re: Y2K potential problem in localtime() <aas@sn.no>
    Re: Y2K potential problem in localtime() (Bart Lateur)
    Re: Y2K potential problem in localtime() <rick.delaney@home.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 11 Dec 1998 13:26:11 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: @INC newbie question
Message-Id: <74r6hj$q3u$1@pegasus.csx.cam.ac.uk>

Brand Hilton <bhilton@tsg.adc.com> wrote:
>Cathy Huang  <huang2@andrew.cmu.edu> wrote:
>>-------------------
>>use Cwd;
>
>BEGIN {
>
>>$dir = cwd();
>>print "sess2 dir = $dir\n";
>>use lib $dir;
>>#$dir2 = "d:\\listen\\data\\scripts\\";
>>#use lib $dir2;
>
>}
>
>>
>>require("name_decoders.pl");

That won't fix it.   The "use lib $dir" is done *when the BEGIN{} is
compiled*, so it'll still not see the value for $dir.

Move the closing } up to just before the "use lib $dir" line.


Mike Guy


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

Date: Thu, 10 Dec 1998 23:52:14 -0800
From: John Cavanaugh <john-cavanaugh@cableone.net>
Subject: Any modules/code for accessing Fidelity NetBenefits at www.401k.com???
Message-Id: <3670CF2E.EE9859C1@cableone.net>


Boy it sure would be handy if someone had already figured out how
to do this.  Im a little confused about how to handle the
authentications etc...

Any leads???

--John Cavanaugh


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

Date: Fri, 11 Dec 1998 09:34:56 +0100
From: Dirk Schumacher <Dirk.Schumacher@depot147.dpd.de>
Subject: Apache <-> Informix <-> Perl
Message-Id: <3670D930.FB2244CA@depot147.dpd.de>

Hi
i have some problem:

I have a Linux-Server 5.3 with Apache 1.3.0 and Informix working.

I have a perlscript witch contact to the database corectly from the
Shell, but when i start the Script from my Browser an error occurded.
(Look at the End of the text)

I have installed this perl-Scripts:

Storable-0.6@3
pRPC-modules-0.1005
DBI-1_02
DBD-Informix-0.58

2. problem:

On Linux 5.2 i have set variables in file httpd.conf with "SetEnv DBPATH
/u/informix" ....

But on 5.3 it goes wrong with this error:

Invalid command 'SetEnv', perhaps mis-spelled or defined by a module not
included in the server configurationd

How can i set variables under 5.3 in the httpd.conf

Thanks
Dirk

Software error:

Can't load '/usr/lib/perl5/site_perl/i586-linux/auto/DBI/DBI.so' for
module DBI: Unable to
resolve symbol at /usr/lib/perl5/i586-linux/5.00404/DynaLoader.pm line
166. at
/usr/lib/perl5/site_perl/DBI.pm line 164

Please send mail to this site's webmaster for help. Content-type:
text/html

Software error:

[Fri Dec 11 16:09:45 1998] DBI.pm: Can't load
'/usr/lib/perl5/site_perl/i586-linux/auto/DBI/DBI.so' for module DBI:
Unable to resolve symbol
at /usr/lib/perl5/i586-linux/5.00404/DynaLoader.pm line 166. [Fri Dec 11
16:09:45 1998] DBI.pm:
[Fri Dec 11 16:09:45 1998] DBI.pm: at /usr/lib/perl5/site_perl/DBI.pm
line 164 BEGIN
failed--compilation aborted at /usr/lib/perl5/site_perl/DBI.pm line 164.

Please send mail to this site's webmaster for help. Content-type:
text/html

Software error:

[Fri Dec 11 16:09:45 1998] DBI.pm: [Fri Dec 11 16:09:45 1998] DBI.pm:
Can't load
'/usr/lib/perl5/site_perl/i586-linux/auto/DBI/DBI.so' for module DBI:
Unable to resolve symbol
at /usr/lib/perl5/i586-linux/5.00404/DynaLoader.pm line 166. [Fri Dec 11
16:09:45 1998] DBI.pm:
[Fri Dec 11 16:09:45 1998] DBI.pm: [Fri Dec 11 16:09:45 1998] DBI.pm:
[Fri Dec 11 16:09:45
1998] DBI.pm: at /usr/lib/perl5/site_perl/DBI.pm line 164 [Fri Dec 11
16:09:45 1998] DBI.pm:
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/DBI.pm
line 164.

Please send mail to this site's webmaster for help. Content-type:
text/html

Software error:

[Fri Dec 11 16:09:45 1998] DBI.pm: [Fri Dec 11 16:09:45 1998] DBI.pm:
[Fri Dec 11 16:09:45
1998] DBI.pm: Can't load
'/usr/lib/perl5/site_perl/i586-linux/auto/DBI/DBI.so' for module DBI:
Unable to resolve symbol at
/usr/lib/perl5/i586-linux/5.00404/DynaLoader.pm line 166. [Fri Dec
11 16:09:45 1998] DBI.pm: [Fri Dec 11 16:09:45 1998] DBI.pm: [Fri Dec 11
16:09:45 1998] DBI.pm:
[Fri Dec 11 16:09:45 1998] DBI.pm: [Fri Dec 11 16:09:45 1998] DBI.pm:
[Fri Dec 11 16:09:45
1998] DBI.pm: at /usr/lib/perl5/site_perl/DBI.pm line 164 [Fri Dec 11
16:09:45 1998] DBI.pm:
[Fri Dec 11 16:09:45 1998] DBI.pm: BEGIN failed--compilation aborted at
/usr/lib/perl5/site_perl/DBI.pm line 164. BEGIN failed--compilation
aborted at
/usr/local/httpd/cgi-bin/ds_test.pl line 19.

Please send mail to this site's webmaster for help. HTTP/1.1 200 OK
Date: Fri, 11 Dec 1998 15:09:45 GMT Server:
Apache/1.3.0 (Unix) S.u.S.E./5.3 mod_perl/1.12 Connection: close
Content-Type: text/html

OK

The server encountered an internal error or misconfiguration and was
unable to complete your request.

Please contact the server administrator, you@your.address and inform
them of the time the error occurred, and anything you
might have done that may have caused the error.






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

Date: 11 Dec 1998 14:51:41 +0300
From: Ilia Perminov <ilia@jet.msk.su>
Subject: Re: Apache <-> Informix <-> Perl
Message-Id: <hunsoemaoc2.fsf@goliath.jet.msk.su>

Dirk Schumacher <Dirk.Schumacher@depot147.dpd.de> writes:

> Hi
> i have some problem:
> 
> I have a Linux-Server 5.3 with Apache 1.3.0 and Informix working.
> 
> I have a perlscript witch contact to the database corectly from the
> Shell, but when i start the Script from my Browser an error occurded.
> (Look at the End of the text)

You should set correct LD_LIBRARY_PATH for your CGI-script. Add 
PutEnv LD_LIBRARY_PATH path-to-dbi-libs:path-to-informix-libs
to httpd.conf

> 
> I have installed this perl-Scripts:
> 
> Storable-0.6@3
> pRPC-modules-0.1005
> DBI-1_02
> DBD-Informix-0.58
> 
> 2. problem:
> 
> On Linux 5.2 i have set variables in file httpd.conf with "SetEnv DBPATH
> /u/informix" ....
> 
> But on 5.3 it goes wrong with this error:
> 
> Invalid command 'SetEnv', perhaps mis-spelled or defined by a module not
> included in the server configurationd
> 
> How can i set variables under 5.3 in the httpd.conf
> 
> Thanks
> Dirk

Probably, your Apache configuration does not include mod_env. You 
can check which modules are included to Apache binary by command:
httpd -l
If you have dynamically loadable module mod_env.so in 'libexec'
subdirectory, add 
LoadModule env_module         mod_env.so
and (below ClearModuleList)
AddModule mod_env.c
to httpd.conf to include 'mod_env' module to Apache.

Best regards,

Ilia


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

Date: Fri, 11 Dec 1998 09:01:05 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Diagnostic Scrolls by
Message-Id: <3672da40.3976789@news.skynet.be>

gemhound@gemhound.com wrote:

>I decided to use the statement   "use diagnostics;"  but now long diagostic
>messages scroll right by in the DOS screen (I'm using win32 perl by
>Activestate), so that I only see the bottom part of the message.  I tried
>redirecting by using  "perl myprogram.pl  >  diagfile"   but for some reason
>redirection doesn't work -- they still scroll by on the screen too quickly to
>see.

The "reason" probably being that the diagnostics use STDERR. I haven't
found the way to redirect STDERR in DOS, although it might be possible.

But anyway, solutions:

 1) Use an editor that catches both STDOUT and STDERR, for example PFE,
to run the script. (<http://pfe.iquill.net/>)

 2) Redirect STDERR to a file: put the next code at the start of the
script:

    BEGIN {
        open STDERR,'>errors.txt' or die "Can't redirect STDERR: $!";
    }	

 3) Redirect STDERR to STDOUT:

    BEGIN {
        open STDERR,'>&STDOUT' or die "Can't redirect STDERR: $!";
    }	

If you do #3, your method WILL work.

   HTH,
   Bart.


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

Date: 11 Dec 1998 14:30:52 GMT
From: scott@softbase.com
Subject: Re: Diagnostic Scrolls by
Message-Id: <36712c9c.0@news.new-era.net>

gemhound@gemhound.com wrote:
> I decided to use the statement   "use diagnostics;"  but now long diagostic
> messages scroll right by in the DOS screen (I'm using win32 perl by
> Activestate), so that I only see the bottom part of the message.  I tried
> redirecting by using  "perl myprogram.pl  >  diagfile"   but for some reason
> redirection doesn't work -- they still scroll by on the screen too quickly to
> see.

> Is there any way I can see the whole message?

Use M-x shell in GNU Emacs for Windows. It will keep as many
lines as you have memory for.

> And yes, I know I should get away from evercrashing Windows and DOS, if only
> because Msoft keeps breaking the Java and Javascripts standards on purpose,
> making webmastering much harder...

When did Microsoft break *JavaScript* on purpose? They implement the
EMWACKO whatever-the-heck-it-is standard, as does Netscape now. Before
that, JavaScript was defined as "whatever Netscape did", and their
implementation often didn't work the way it was documented. (IE's
JScript often worked along with the documentation, and scripts that
worked in it would break in Netscape.)

For web purposes, Java 1.1 broke Java far worse than anything Microsoft
ever did by not allowing 1.1 programs to run in 1.0 virtual machines
which the 3.0 browsers had. Sun destroyed Java client portability all
by themsevles. If Microsoft did not exist Java would still have not
been portable to client browsers.

Scott


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

Date: Fri, 11 Dec 1998 13:37:40 GMT
From: nhoop@centuryinter.net (JuNat)
Subject: Re: HTML Embedded in Perl
Message-Id: <36721f3f.1965064@news.ot.centuryinter.net>

>Any suggestions?
>
>
>   I suggest checking the Perl FAQ before posting.

That's a mean suggestion. Dang! How quickly these "Experts" forget what
it's like to be a beginner. It's an unfortunate attitude that seem to be
endemic in the Perl community. I made the mistake of asking for help in the
wrong place and got roundly flamed for it.

Nat



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

Date: Fri, 11 Dec 1998 07:21:51 -0600
From: "Al Degutis" <adegutis@isi-info.com>
Subject: ip to name lookup (reverse name lookup)
Message-Id: <74r5vo$jim$1@news.megsinet.net>

Is it possible to do a reverse name lookup of an IP address using perl?  I'd
like to writing a firewall log analyzer and want to display the IP address
and host.domain where available.

Thanks
Al




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

Date: Fri, 11 Dec 1998 02:15:58 -0600
From: Andrew Johnson <ajohnson@gatewest.net>
Subject: Re: Learning Perl, 2nd edition, exercise 7.1b
Message-Id: <3670D4BE.190A0542@gatewest.net>

David Christensen wrote:
!
! Hello, World!
! 
! I'm working my way through the above book, and everything was rosy
! until I met exercise 7.1b.  My attempt at a solution is as
! follows:
! 
! #!/usr/bin/perl -w
! 
! while (<>) {
!     if ( /\\*\**/ ) {
!         print $& . "\n";
!     }
! }
! 
! Looking at the solution given in the back of the book, my regular
! expression appears to be correct.  But, the program doesn't give
! the expected output.  For example, running it on my Linux box:
! 
! /home/david/perl$ex07_1b
! howdy!
! 
! \* howdy doody!
! \*
! \\\*
! \\\*
! \**********\****\***
! \**********
! howdy \* doody!
! 
!  \* howdy!
! 
! 
! Note the space preceding the backslash in the last example.
! 
! I was expecting the output to be "\*" for the last two lines...

remember, you are asking to match a \ zero-or-more times, followed
by a * zero-or-more times ... it'll match the first thing that matches
that pattern --- in your latter cases, null matches that pattern just
fine and long before the regex engine ever gets to the point where a
backslash and asterisk occur (hey, I just matched matched zero
backslashes and zero asterisks and I didn't even have to leave the
beginning of the string...) --- in other words, what might you expect
zero whatevers to look like?

hope this helps
regards
andrew


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

Date: 11 Dec 1998 09:44:21 GMT
From: zincplate@aol.com (Zinc Plate)
Subject: Magic Windows and CGI
Message-Id: <19981211044421.00887.00001142@ng-bw1.aol.com>


Has anyone else had problems using CGI.pm with magic target names? (with
frames)

when I set: print $cgi->header(-target=>"_top")

it works fine in Netscape, but not with Internet Explorer (with IE, it sets the
new frameset WITHIN that existing frame, without clearing the entire page
first...)  

Thanks in advance for any possible solutions...




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

Date: Fri, 11 Dec 1998 11:24:35 +0200
From: "Sergey V. Kolychev" <ksv@gw.al.lg.ua>
Subject: New module Net::RawIP
Message-Id: <Pine.LNX.3.96.981211111805.6957B-100000@gw.al.lg.ua>

Net::RawIP just alpha release, please test it and write to me
about your feelings. 

This module can be download from

http://www.al.lg.ua/~ksv/Net-RawIP-0.01.tar.gz

Here is a README file:
-----------------------------------------------------------------------
This is Net::RawIP, a perl module related to manipulating raw ip packets
This is first alpha release.
I do test module only on Linux 2.0.3x whith glibc.

Help me please whith my horrible english grammar ;(

You require perl 5.001 or later to use this module
You do need have installed libpcap , available from

ftp://ftp.ee.lbl.gov/libpcap.tar.Z

You install the module by running these commands:

   perl Makefile.PL
   make
   make test
   make install

There are also some example scripts.

Please report any bugs/suggestions to Sergey Kolychev <ksv@al.lg.ua>

All files contained in this installation are Copyright (c) 1998 Sergey Kolychev
unless otherwise specified. All rights reserved.

This library is free software; you can redistribute it and/or modify it under 
the same terms as Perl itself.


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

   ----------------------Alchevsk Linux User Group-----------------------
      UNIX is user friendly. It's just selective who the friends are.
      Linux is like wigwam - no windows, no gates, apache inside. 
      http://www.ic.al.lg.ua/~ksv | e-mail: ksv@gw.al.lg.ua
      PGP key & Geekcode: finger ksv@gw.al.lg.ua




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

Date: 11 Dec 1998 09:30:39 +0000
From: Etienne Grossmann <etienne@anonimo.isr.ist.utl.pt>
Subject: Re: opening /dev/sequencer
Message-Id: <87emq710w0.fsf@anonimo.isr.ist.utl.pt>



  Hello,

  thanks for the answer; Here is the complete date (sorry for not
putting it to start with) :

======================================================================  
etienne@anonimo: perl -w
    use diagnostics ;
    use strict ;
    print "=" x 70 , "\n";
    if( ! open(FD,">/dev/sequencer") ){
        print "Error :  $!\n" ;
        die "NOPE\n"; 
    }
    print FD "";
    END{ print "=" x 70 , "\n"; }
======================================================================
Error :  Operation not permitted
Uncaught exception from user code:
        NOPE
======================================================================
etienne@anonimo: perl -w
    print "=" x 70 , "\n";
    use diagnostics ;
    use strict ;
    use Fcntl; 
    use IO::File; 
    $main::fh = new IO::File "/dev/sequencer", O_WRONLY; 
    unless( defined($main::fh) ){
        print "Error :  $!\n" ;
        print "NOPE\n" ;
    }
    END{ print "=" x 70 , "\n"; }
======================================================================
Error :  Bad file descriptor
NOPE
======================================================================
etienne@anonimo: perl -w
    print "=" x 70 , "\n"; 
    use diagnostics ;
    use strict ;
    use Fcntl; 
    sysopen(FD,"/dev/sequencer",O_WRONLY) ; 
    print "Error :  $!\n" ;
    print FD "" ;
    print "Error :  $!\n" ;
    END{ print "=" x 70 , "\n"; }

======================================================================
Error :  Operation not permitted
print on closed filehandle main::FD at - line 7 (#1)
    
    (W) The filehandle you're printing on got itself closed sometime before now.
    Check your logic flow.
    
Error :  Bad file descriptor
======================================================================


    For the moment, my best guess is to do a xs module that just opens
the device. Looks like overkill, doesn't it?


  cheers,


  Etienne


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

Date: Fri, 11 Dec 1998 21:21:35 +0800
From: Silver CHEN <sansil@pchome.com.tw>
To: Andrew Allen <ada@fc.hp.com>
Subject: Re: Out of memory!??
Message-Id: <36711C5F.835816DC@pchome.com.tw>

Dear Allen:

  I knew the reason - it's the shell resource limit.

  When I 'unlimit' the default limit, the problem gone.

  Anyway, thanks for your kind help. my program uses about 50M swap.

--
Silver 

Andrew Allen wrote:
> 
> Silver CHEN (sansil@pchome.com.tw) wrote:
> : Dear sir:
> 
> :   I've a FreeBSD w/ 32M memory and very very big swap (about 200M+)
> 
> :   but when I run a data-comsuming perl program, it told me "Out of Memory!"
> :   and quit.
> 
> :   I do sure the swap is large enough for this program, but why I got this
> :   message still?
> 
> How do you know this? Have you run "gnutime" or "top" or some other
> memory-monitoring program? Perl can be a memory hog, especially with
> associate arrays.
> 
> :   is there anything that can't be put in swap for perl? or something I missed?
> 
> :   However, I can run this program on a solaris 2.6 w/ 512M RAM smoothly.
> 
> Try running "gnutime" or another memory monitor and checking the max
> memory usage. I'd _assume_ perl on FreeBSD would use a similar amount
> of memory. From your description, I would guess your program is using
> between 200M and 512M of memory. On a long shot, it might be requiring
> more than 32M resident (but that seems unlikely-- you can almost
> always page-as-needed).
> 
> Andrew


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

Date: 11 Dec 1998 10:53:32 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: panic: leave_scope inconsistancy
Message-Id: <74qtjc$ij2$1@pegasus.csx.cam.ac.uk>

Peter Hamilton <peter@cityc.co.uk> wrote:
>We've investigated things further and one thing that is happening is
>that we have code such as
>
>print STDOUT ("\030\030\030") ; # Framing characters
>print STDOUT ("DATA"); 
>print STDOUT ("\n");
>
>We have a C program that runs the script and listens for PERL writing
>to STDOUT. We're tidying up our PERL 4 syntax and getting rid of
>unnecessary brackets and STDOUT. However what happens is that the
>above code works 98% of the time, but occassionaly the C code gets
>"\030\030\030DATA\n\030\030\030DATA\n\030\030\030DATA\n\030\030\030DATA\n"
>from PERL, when the above lines appear in the script once, with no
>looping code. We think that PERL 5.004 is assembling the print buffer,
>trying to dispatch it, getting an EAGAIN or some such system error,
>trying again, failing to clear its error indicator and getting stuck
>in an infinite loop trying to put the data out. 

Do your programs fork at all?    You can get effects like this if you
(or some module you call) is using fork() and not flushing buffers
correctly.


Mike Guy


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

Date: Fri, 11 Dec 1998 01:14:45 -0600
From: "John M. Dlugosz" <john@dlugosz.com>
Subject: Re: Perl code for CM11a X10 interface
Message-Id: <2670B11117DD919F.ADAAE44BBA064E75.041C37A838FFF3CD@library-proxy.airnews.net>

I've been banging on Keeware's ActiveX control and he's been making changes
to get it to work properly and completely under Perl.  I'm going to throw
together a "native" Perl interface to wrap around it as soon as I get his
latest ... hopefully this weekend.

--John


keatlim@my-dejanews.com wrote in message
<74mn6f$nm5$1@nnrp1.dejanews.com>...
>I was wondering if anyone has made a perl code to interface with the CM11A
>and willing to share it with me! I am trying to make a web interface so
that
>it can be run from any web browser to control the house!
>
>Any help will be greatly appreciated!
>
>Thanks!
>-Keat
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: 11 Dec 1998 07:35:02 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl tip needed: High CPU Usage
Message-Id: <74qhv6$pkc$1@marina.cinenet.net>

Larry Rosler (lr@hpl.hp.com) wrote:
: In article <74pegb$fgp$3@marina.cinenet.net> on 10 Dec 1998 21:29:47 
: GMT, Craig Berry <cberry@cinenet.net> says...
: > This is a double baddy.  First, why not just juse Perl's built-in chmod()
: > function?  Second, this version of the system call spawns a whole separate
: > shell for the command, eating time and other resources.  See the doc on
: > system() for alternatives.
: 
: Actually, this version of the system call *doesn't* spawn a whole 
: separate shell for the command.  See the doc on system():
[snip]

Ah, thanks for the catch, I'd forgotten the metacharacters-only rule.

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "The hills were burning, and the wind was raging; and the
       clock struck midnight in the Garden of Allah."


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

Date: Fri, 11 Dec 1998 13:02:52 +0100
From: Leon Brocard <l.brocard@elsevier.nl>
Subject: Re: Perl tip needed: High CPU Usage
Message-Id: <367109EC.D28389DD@elsevier.nl>

wyndo@cxo.com wrote:

> This leads me to believe that the Perl interpret itself... not my
> program... is what's spiking CPU usage up so high. It's churning away
> compiling an 1800-line program, all the while hogging CPU time. :(

It may seem like a Perl question, but here's a non-Perl answer: % of CPU
used means nothing. The unix scheduler will deal small timeslices to
each running process that is able to run. If it's taking a *really
long* time to run, or eating up *lots* of memory, then you may
want to change the code.

Running close to 100% of the CPU time just means your program
isn't IO-bound.

HTH, Leon
--
$monger{'Amsterdam.pm'}[0] # $laptop--


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

Date: Fri, 11 Dec 1998 08:05:30 -0500
From: Ken McNamara <conmara@tcon.net>
Subject: Re: Perl tip needed: High CPU Usage
Message-Id: <3671189A.E2CBB2F7@tcon.net>

wyndo -

You might wnat to install the TOP program at:

ftp://ftp.groupsys.com/pub/top

it's very handy for monitoting system utilization realtime.

Another possibility is that your program has an endless loop.

KenMc

wyndo@cxo.com wrote:

> I'm trying to troubleshoot a problem in a set of Perl CGI programs. Server
> CPU usage (reported in "ps aux | grep perl) is uncommonly high. In fact, perl
> processes are listed as using anywhere from 36 to 99.9% CPU time. With
> multiple users online, this tends to bring the server to a sluggish halt for
> a period of time.
>





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

Date: 11 Dec 1998 12:58:35 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Precision(?) of Perl
Message-Id: <isr9u6ubys.fsf@godzilla.kiere.ericsson.se>

Johnson Kou <kou@ssa-de.sel.sony.com> writes:

> I wonder if there are simple ways to tell Perl that I need, let's
> say, 72-bit bin/hex number for specific variables.

Have a look at the Math::BigInt module, it should be helpful.
-- 
   Calle Dybedahl, qdtcall@esavionics.se, http://www.lysator.liu.se/~calle/
    "...a festering realization that all you do is no more than the futile
      slapping of paint onto the rotting, decayed infrastructure of the
		   Information Superhighway." -- Jinx_tigr


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

Date: 11 Dec 1998 12:27:53 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: recursive dir in perl
Message-Id: <iszp8uuddy.fsf@godzilla.kiere.ericsson.se>

pser <pascal.serode@alcatel.fr> writes:

> What I need, in fact, is just a script able to go down directories
> , recursively, building a list of every file met.

perldoc File::Find
-- 
   Calle Dybedahl, qdtcall@esavionics.se, http://www.lysator.liu.se/~calle/
    "...a festering realization that all you do is no more than the futile
      slapping of paint onto the rotting, decayed infrastructure of the
		   Information Superhighway." -- Jinx_tigr


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

Date: Thu, 10 Dec 1998 22:25:22 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Regular Expression help
Message-Id: <MPG.10da5aac7d47b1f5989950@nntp.hpl.hp.com>

In article <1djui7b.tey90rjd7amtN@bay1-511.quincy.ziplink.net> on Thu, 
10 Dec 1998 23:59:06 -0500, Ronald J Kimball 
<rjk@linguist.dartmouth.edu> says...
!> Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
!> 
!> > > >    /<a href="(.*?)"/
!> > > 
!> > > Actually, you might want the more efficient
!> > > 
!> > > /<a href="([^"]*)"/
!> > 
!> > It is already several days today since the moment the first
!> > expression is *much* quickier than the second one, as it should be
!> > (especially if you through in //s).
!> 
!> Dang...  Now what am I going to bitch about?
!> 
!> Would you mind posting an explanation of the changes made so that the
!> former is now faster?  i.e., how does the new regex engine apply the
!> former regular expression?
!> 
!> (I assume this only applies to perl5.005, though. :-)

I am thoroughly confused.  I measured this on 5.005_02, and 'nongreedy' 
was ~20% slower than 'explicit'.  And //s made little difference.

So I don't know what Ilya was trying to convey.

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


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

Date: Fri, 11 Dec 1998 10:52:28 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: running one script from another
Message-Id: <ebohlmanF3srJG.A3u@netcom.com>

Jesper Bork <jbo@dator.dk> wrote:
: I have a script which is meant to be run from the commandline and e.g. uses
: getopt. I would like to execute that script from another script modifying it
: and without loading a second Perl interpreter! Anyone knows if I can do this
: using maybe eval ?

If you take a look at the code for the Getopt:: series of modules, you'll 
see that all they do is diddle around with the @ARGV array.  So all you 
need to do is set up @ARGV with the appropriate arguments and then do(), 
require() or what have you, the second script.



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

Date: Fri, 11 Dec 1998 08:22:08 GMT
From: petra_danielsson@my-dejanews.com
Subject: Send variables with <a href>
Message-Id: <74qknf$39a$1@nnrp1.dejanews.com>

Hi,
I hope someone can help me with my problem. I have two perl-files, one.pl and
two.pl, and the problem is that I don't know how to send a "<a href..." from
one.pl to two.pl with a $Refnr - variable. I have tried everything I can think
of, like the Kornshell way:

print "<td width=\"12%\" align=\"center\" height=\"36\" ><strong><a href=
\"two.pl\"?$Refnr><b>$Refnr</b></a></strong></td>"

I give up!! Please, help me. I will be so grateful.
Thanks!
/Bettis


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 11 Dec 1998 14:53:56 +0100
From: Gernot Homma <gernot@cat.at>
Subject: Re: Send variables with <a href>
Message-Id: <367123F4.801928EB@cat.at>

This is a multi-part message in MIME format.
--------------61F0F5D893555551CB601559
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi,
You have to put a field=value pair in the href. So your code have to look like
this
print "<td width=12% align=center height=36 ><strong>
<a href=two.pl?yourfield=$Refnr><b>$Refnr</b></a></strong></td>"

You don't have to put the attributes of the <TD>-Tag  parameters under "".

Hope that helps
Greetings
Gernot


petra_danielsson@my-dejanews.com wrote:

> Hi,
> I hope someone can help me with my problem. I have two perl-files, one.pl and
> two.pl, and the problem is that I don't know how to send a "<a href..." from
> one.pl to two.pl with a $Refnr - variable. I have tried everything I can think
> of, like the Kornshell way:
>
> print "<td width=\"12%\" align=\"center\" height=\"36\" ><strong><a href=
> \"two.pl\"?$Refnr><b>$Refnr</b></a></strong></td>"
>
> I give up!! Please, help me. I will be so grateful.
> Thanks!
> /Bettis
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own

--------------61F0F5D893555551CB601559
Content-Type: text/x-vcard; charset=us-ascii;
 name="gernot.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Gernot Homma
Content-Disposition: attachment;
 filename="gernot.vcf"

begin:vcard 
n:Homma;Gernot
x-mozilla-html:FALSE
org:Cyber-Atelier
adr:;;;Vienna ;;1210;Austria
version:2.1
email;internet:gernot@cat.at
tel;fax:+43 1 272 92 51 9
tel;work:+43 1 272 92 51
x-mozilla-cpt:;0
fn:Homma, Gernot
end:vcard

--------------61F0F5D893555551CB601559--



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

Date: 11 Dec 1998 06:17:10 -0600
From: claird@Starbase.NeoSoft.COM (Cameron Laird)
Subject: Re: TCL <-> PERL, what's better.
Message-Id: <74r2g6$8k9$1@Starbase.NeoSoft.COM>

In article <74ok5a$mu9$3@zware.space.ru>,
Victor B Wagner <vitus@brass.fe.msk.ru> wrote:
			.
			.
			.
>Another advantage of Tcl is builtin event model, which allows to
>write non-forking TCP/IP servers without resort to low-level select
>call. 
It has costs (complexification of embedding under non-standard
OSs; continuing confusion of beginners) as well as benefits,
but I agree with you:  one of the great underadvertised appeals
of Tcl is the simplicity of server applications <URL:http://
starbase.neosoft.com/~claird/comp.lang.tcl/tcl-examples.html#socket>.
Lots of us have written networking daemons in Perl, too, and I 
recognize that its programming model is somewhat more general;
still, I strongly urge Tcl on anyone looking to start with
server-side programming.
>
>But perl have -wc switch which is a great advantage when you are writing
>something which runs unattended.
While Tcl has no built-ins to compare with -wc, <URL:http://
starbase.neosoft.com/~claird/comp.lang.tcl/tcl_compilers.html#analyzers>
points to several means of static analysis.
			.
			.
			.
-- 

Cameron Laird           http://starbase.neosoft.com/~claird/home.html
claird@NeoSoft.com      +1 281 996 8546 FAX


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

Date: Fri, 11 Dec 1998 09:41:10 GMT
From: charlie66@my-dejanews.com
Subject: Writing to filehandles and STDOUT
Message-Id: <74qpbm$6rs$1@nnrp1.dejanews.com>

I had a Perl problem yesterday which I have resolved, but I am still not sure
how it works exactly.

What my script was trying to do was write a series of lines to file on the
server, then output some response to STDOUT. My problem was that after the
data was written to the local server file, the HTML response to STDOUT was
showing up as just that - uninterpreted HTML.

I now find the problem has gone away after jiggling a few things round
(always worth a try ;-), but I still don't understand why the HTML was
successfully sent to STDOUT, but not interpreted. The headers were identical
to the usual headers I send, which work.

I cannot give you the exact code, but here are some details in order of
occurence in the script:

1. To open and write to the local file:

	$exclusive_lock = 2;
	$unlock = 8;

	open(NEWREV,">$loc_path$my_file.html") || print  $!;
	flock (NEWREV, $exclusive_lock);
	print NEWREV <<End_of_Stuff;
Bla bla bla
 ...
End_of_Stuff

2. To close the local file:

	flock (NEWREV, $unlock);
	close (NEWREV);

3. To write to STDOUT:

 	print <<End_of_HTML;
Content-type: text/html
<HTML><HEAD><TITLE>Bla Bla</TITLE></HEAD>
 ...
End_of_HTML

I got the same problem even if I added STDOUT after that last "print". Any
clues?

--
Regards,

CW.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 11 Dec 1998 11:14:14 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Writing to filehandles and STDOUT
Message-Id: <ebohlmanF3ssJq.Au9@netcom.com>

charlie66@my-dejanews.com wrote:
: 3. To write to STDOUT:

:  	print <<End_of_HTML;
: Content-type: text/html

You need to print a blank line here; otherwise the stuff below will be 
interpreted as part of your headers.

 : <HTML><HEAD><TITLE>Bla Bla</TITLE></HEAD>
: ...
: End_of_HTML


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

Date: 11 Dec 1998 12:01:38 +0100
From: Gisle Aas <aas@sn.no>
Subject: Re: Y2K potential problem in localtime()
Message-Id: <m3zp8v3pt9.fsf@furu.g.aas.no>

bart.lateur@skynet.be (Bart Lateur) writes:

> I've thought of a better alternative after I posted mine. This probably
> will get your approval.
> 
>     $year = sprintf('%02d',$year % 100);
> 
> 
> Note taht this will fail for years before 1900... :-)

No, for perl5.004 or better the % operator will do the right thing.

$ perl -le 'print -1 % 100'
99


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

Date: Fri, 11 Dec 1998 13:03:51 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Y2K potential problem in localtime()
Message-Id: <367215ad.5983474@news.skynet.be>

Gisle Aas wrote:

>No, for perl5.004 or better the % operator will do the right thing.
>
>$ perl -le 'print -1 % 100'
>99

I'm glad you call this "the right thing".

So why does int() still round up for negative numbers?

Note that this is supposed to be equivalent:

	n = int( n / d ) + ( n % d ) 

Therefore, a negative result for the modulo operator if n<0, and int()
doing awkward things for negative numbers, IS related.

	Bart.


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

Date: Fri, 11 Dec 1998 13:34:13 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Y2K potential problem in localtime()
Message-Id: <3671210A.2F4FDF79@home.com>

[posted & mailed]

Bart Lateur wrote:
> 
> So why does int() still round up for negative numbers?

int() doesn't round.  It is only expected to truncate the decimal
portion of a number, which is what it does.

> 
> Note that this is supposed to be equivalent:
> 
>         n = int( n / d ) + ( n % d )

I think you're confusing int() with the greatest integer function.  I
think some languages call this floor().

floor() is mentioned in perlfaq4.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4403
**************************************

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