[14070] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1480 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 24 14:10:44 1999

Date: Wed, 24 Nov 1999 11:10:25 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943470624-v9-i1480@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 24 Nov 1999     Volume: 9 Number: 1480

Today's topics:
    Re: Problem with file locking(?) using Perl 5.005_03, D (Benjamin Franz)
        Profiler question <schmickl@magnet.at>
        recipe 1.11 in Cookbook  Where? Here documents <tom.kralidis@ccrs.nrcanDOTgc.ca>
    Re: reg expr question <aqumsieh@matrox.com>
    Re: reg expr question <vincent.murphy@cybertrust.gte.com>
        remove html codes ? <hanz@chello.nl>
    Re: runing a executable from CGI/Perl script nextar@my-deja.com
    Re: runing a executable from CGI/Perl script <tony_curtis32@yahoo.com>
    Re: Search Engine <peter@berghold.net>
    Re: sprintf help <rhomberg@ife.ee.ethz.ch>
    Re: sprintf help <lr@hpl.hp.com>
        system("ksh_script") - STDOUT Messed Up srhadden@my-deja.com
        system("ksh_script") - STDOUT Messed Up srhadden@my-deja.com
        system("ksh_script") - STDOUT Messed Up srhadden@my-deja.com
        system("ksh_script") - STDOUT Messed Up srhadden@my-deja.com
        system("ksh_script") - STDOUT Messed Up srhadden@my-deja.com
    Re: Test for eval() without using eval() ?? (Simon Cozens)
    Re: Test for eval() without using eval() ?? <gellyfish@gellyfish.com>
    Re: Test for eval() without using eval() ?? <mkruse@rens.com>
    Re: Test for eval() without using eval() ?? <mkruse@rens.com>
    Re: Test for eval() without using eval() ?? (Abigail)
    Re: Test for eval() without using eval() ?? <mkruse@rens.com>
    Re: Test for eval() without using eval() ?? (Craig Berry)
        Threads and memory leaks <martin@sluka.de>
        variable scoping <helmut@cancon.com>
    Re: What is a good book on Perl bwb@acm.org
    Re: win32 alarm workaround??? <cassell@mail.cor.epa.gov>
    Re: write(FILEHANDLE) ??? <aqumsieh@matrox.com>
    Re: write(FILEHANDLE) ??? <aqumsieh@matrox.com>
    Re: write(FILEHANDLE) ??? <rzijp@dds.nl>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 24 Nov 1999 17:44:03 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: Problem with file locking(?) using Perl 5.005_03, DB_File 1.17 and libdb 2.2.7 via CGI script
Message-Id: <DtV_3.186$Wo6.3133@typhoon01.swbell.net>

In article <81frs5$4js$1@nnrp1.deja.com>,  <wanix@my-deja.com> wrote:
>I'm having a real pain tracking this one down...
>seems like a file locking problem because
>virtually all my CGI programs are now getting
>choked up by a message "Retrying in 1 seconds..."
>getting printed prior to the content-type header.
>Obviously the web server doesn't like this, but I
>can't seem to stop it. It doesn't always get
>printed before the header, so some pages will
>display correctly (but end up with said message
>inside or after the HTML being generated).
>
>The message is being printed right around DB_File
>calls (using "tie %database, "DB_File", $db_loc").

If that is _exactly_ what you are using, then it probably
isn't the tie causing you trouble - because no file locking
is being performed there. Try reducing it to a test case
of just a few lines and posting the code. 

My guesses would be that either you are _also_ passing 
some flags you are not showing above and so trying to get 
the tie to do the locking for you or your _seperate_ 
(not shown) use of 'flock' has a print statement
in it. 

You could try using a 'fence' lock by getting a _seperate_
file lock on another file _before_ you open DB_File. This
is probably a good idea anyway because Berkeley DB 2.x
and lower does an evil thing with its cache that causes
a failure of locks to work correctly when you use the
locking method given in 'perldoc DB_File'. You should
always use a 'fence' lock to avoid the problem by 
guarenteeing you have a lock _before_ the database
is tied and should always untie/re-tie the database
(without releasing the 'fence' lock) when changing
lock levels.

-- 
Benjamin Franz


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

Date: Wed, 24 Nov 1999 19:50:29 +0100
From: Thomas Schmickl <schmickl@magnet.at>
Subject: Profiler question
Message-Id: <383C3375.8169EC58@magnet.at>

Hi !

I tried to use the Devel:Dprof package to see what code  takes the most
amount of time, but when I try to use it with my
application "edoc.pl" i get the following error message.

> H:\projekte\edoc\win32>perl -d:DProf edoc.pl
> Uncaught exception from user code:
>         Uncaught exception from user code:
>         DProf prof_mark() lost on CODE ref CODE(0xdec5f4)
>         eval {...} called at edoc.pl line 0
> END failed--cleanup aborted.

I am working with ActivePerl (Perl version 5.005_03) on Windows NT 4.0
The error message claims "eval {...} called as edoc.pl line 0" but in
reality the file "edoc.pl" starts like this:

#!/usr/bin/perl -w

#This source file belongs to e:doc
#Copyright (C) 1999  Thomas M. Schmickl
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#See the GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
USA

use strict;
use diagnostics;
use IO::File;
use Tk;
 ...


So does anybody see, why the profiler terminates unexpectedly ?

Thanx, thomas.

----------------------------------------------------
Thomas Schmickl,
Department for zoology
Karl Franzens University Graz, Austria.
----------------------------------------------------
Visit the GPL e:doc-project on http://members.magnet.at/hfbuch/edoc
or mail me at schmickl@magnet.at
----------------------------------------------------




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

Date: Wed, 24 Nov 1999 13:22:48 -0500
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: recipe 1.11 in Cookbook  Where? Here documents
Message-Id: <383C2CF8.61BD1ADF@ccrs.nrcanDOTgc.ca>

Hi,

I'm use the here document quoting mechanism often, and would like to
update my code to allow indented here documents.

This works, but the problem is what I'm here documenting is flushed out
indented, even if the code looks better and clearer.  I've attached a
simple example and output:

#!/public/bin/perl -w

use strict;

my $me = "";
my $var = "";

if (not $me)
{
  ($var = print <<'  HERE_TARGET') =~ s/^\s+//gm;
  my text
  goes here
  HERE_TARGET
}
else
{
  print "ok\n";
}

 ....and here's my output:

[host:/home/me/]% test.pl
  my text
  goes here
[host:/home/me/]%

I would like my outpout text to be flush on STDOUT as well, not
indented.

Any ideas?  I've looked through the recipe and am puzzled.

Thanks

 ..Tom
 
=================================
Tom Kralidis
Geo-Spatial Developer
Canada Centre for Remote Sensing
Tel: (613) 947-1828
Fax: (613) 947-1408
http://www.ccrs.nrcan.gc.ca
=================================


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

Date: Wed, 24 Nov 1999 11:25:23 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: reg expr question
Message-Id: <x3yogcj3lho.fsf@tigre.matrox.com>


Magnus Johansson <di5majo@my-deja.com> writes:

> If I want to check if a text only contains characters a-z how should I
> do then?

There are multiple ways. All of which are described in the docs.
Here's a couple:

	if ($text =~ /^[a-z]+$/) {
		# bla
	}

	unless ($text =~ tr/a-z//c) {
		# bla
	}


--Ala



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

Date: Wed, 24 Nov 1999 17:37:48 GMT
From: Vincent Murphy <vincent.murphy@cybertrust.gte.com>
Subject: Re: reg expr question
Message-Id: <xjgbt8jaiz8.fsf@gamora.ndhm.gtegsc.com>

>>>>> "Uri" == Uri Guttman <uri@sysarch.com> writes:

>>>>> "VM" == Vincent Murphy <vincent.murphy@cybertrust.gte.com> writes:
>>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:
    Larry> In article <81g8ul$dmv$1@nnrp1.deja.com> on Wed, 24 Nov 1999 08:51:33 
    Larry> GMT, Magnus Johansson <di5majo@my-deja.com> says...
    >>>> If I want to check if a text only contains characters a-z how should I
    >>>> do then?

    Larry> Assuming the string is in $_:

    Larry> Slower way:

    Larry> /^[a-z]*\z/ and print "Yes.\n";
    VM> ------------------------^
    VM> At first I thought this was wrong, but I tested it and sure enough it
    VM> works.  I looked at perlre and nowhere did it say \z.  \Z yes, but not
    VM> \z.  Where is this little pearl?

    Uri> from perlre, 5.005_03 (edited):

% perl -v

This is perl, version 5.004_04 built for sun4-solaris

Damn!!!  I'm out of the loop. :-(

    Uri>      Perl defines the following zero-width assertions:

    Uri>          \A  Match only at beginning of string
    Uri>          \Z  Match only at end of string, or before newline at the end
    Uri>          \z  Match only at end of string




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

Date: Wed, 24 Nov 1999 18:24:05 GMT
From: "Hanzie" <hanz@chello.nl>
Subject: remove html codes ?
Message-Id: <93W_3.12968$Ox4.162126@typhoon.chello.nl>

Hi!

I'm coding some sort of newsgroup perl program. Is there any short code to
remove any sort of HTML code from the user's input?

Thnx,
HPK




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

Date: Wed, 24 Nov 1999 17:54:08 GMT
From: nextar@my-deja.com
Subject: Re: runing a executable from CGI/Perl script
Message-Id: <81h8nu$4eu$1@nnrp1.deja.com>

Hi Kragen,
Thank you for your help, but my problem is the same.
The exec_file is executed (I receive in my browser a succes message,
but it not generate the desired file (which is generated when I run the
CGI script from console (on my Apache server).
What can I do?
I can't understant what's hapening.
What must I do to run this script from my browser in the same way which
I run from my Web server?
Any comments greatly appreciated!
Thanx again

Regards,
Bogdan Coman
bcoman@usa.net


In article <jkD_3.41389$YI2.2035097@typ11.nn.bcandid.com>,
  kragen@dnaco.net (Kragen Sitaker) wrote:
> In article <819eed$gqs$1@nnrp1.deja.com>,  <nextar@my-deja.com> wrote:
> >I have try with system ('exec_file', 'text_file') but exec_file still
> >not generate my the desired file.
>
> OK, that's progress.  What does it do instead of what you want?  Does
> it log an error message, do nothing apparent, or what?
>
> --
> <kragen@pobox.com>       Kragen Sitaker
<http://www.pobox.com/~kragen/>
> The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
> <URL:http://www.pobox.com/~kragen/bubble.html>
>


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


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

Date: 24 Nov 1999 18:09:49 +0000
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: runing a executable from CGI/Perl script
Message-Id: <wkln7nrcb6.fsf@yahoo.com>

nextar@my-deja.com writes:

> Thank you for your help, but my problem is the same.
> The exec_file is executed (I receive in my browser a succes message,
> but it not generate the desired file (which is generated when I run the
> CGI script from console (on my Apache server).
> What can I do?
> I can't understant what's hapening.
> What must I do to run this script from my browser in the same way which
> I run from my Web server?
> Any comments greatly appreciated!

I'd guess your problem is:

    http://www.htmlhelp.org/faq/cgifaq.html

       Question 3.20

This isn't really a perl problem, you'll get better
info from a WWW/CGI group.

hth
tony


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

Date: Wed, 24 Nov 1999 19:01:23 GMT
From: "Peter L. Berghold" <peter@berghold.net>
Subject: Re: Search Engine
Message-Id: <Pine.LNX.3.96.991124140039.2881D-100000@uboat.berghold.net>




On 20 Nov 1999, Jonathan Stowe wrote:

> On Sat, 20 Nov 1999 20:38:54 +0100 Alan J. Flavell wrote:
> > On Sat, 20 Nov 1999, Jaime Perez wrote:
> > 
> >> Well, the code does not work because it doesn't do anything.
> > 
> > So it really _does_ lounge around on the couch all day.  It was bound to
> > happen, sooner or later. 
> > 
> 
> I blame the parents.
> 

Next it will want the TV remote...


-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Peter L. Berghold                        Peter@Berghold.Net
"Linux renders ships                     http://www.berghold.net
 NT renders ships useless...."           ICQ# 11455958




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

Date: Wed, 24 Nov 1999 18:39:21 +0100
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: sprintf help
Message-Id: <383C22C9.904E1D0B@ife.ee.ethz.ch>

esalmon@packet.net wrote:
> 
> How would I round up a scallar using the sprintf format?

I don't think you can do that using sprintf.


to round $_ up, use POSIX ceil:

perl -MPOSIX -le'$_=4.3; print ceil $_'

or int:

$_++ unless $_ < 0 || $_ == int;
$_ = int;

- Alex


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

Date: Wed, 24 Nov 1999 09:59:25 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: sprintf help
Message-Id: <MPG.12a5c753899c3d7798a277@nntp.hpl.hp.com>

In article <81h4u5$1b9$1@nnrp1.deja.com> on Wed, 24 Nov 1999 16:49:10 
GMT, Samuel Kilchenmann <skilchen@swissonline.ch> says...
> In article <slrn83nm2s.gfs.simon@othersideofthe.earth.li>,
>   simon@brecon.co.uk wrote:
> > esalmon@packet.net (comp.lang.perl.misc):
> > >How would I round up a scallar using the sprintf format?
> > >	$weight = 2.25
> > >	$rounded_up = sprintf("?????", $weight);
> > >$weight should = 3
> >
> > perldoc -q round
> >
> > Makes you think the FAQ was written for a reason, doesn't it?
> >
> Please, please, please: Show me, how you do round up with sprintf or
> anything else mentioned in the FAQ ...

Er, umm, you read the FAQ.  The clue is even in the title.  Here's how 
the FAQ begins:

Does Perl have a round() function? What about ceil() and floor()? Trig 
functions?

Remember that int() merely truncates toward 0. For rounding to a certain 
number of digits, sprintf() or printf() is usually the easiest route. 

    printf("%.3f", 3.1415926535);       # prints 3.142

The POSIX module (part of the standard perl distribution) implements 
ceil(), floor(), and a number of other mathematical and trigonometric 
functions. 

    use POSIX;
    $ceil   = ceil(3.5);                        # 4
    $floor  = floor(3.5);                       # 3

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


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

Date: Wed, 24 Nov 1999 18:06:25 GMT
From: srhadden@my-deja.com
Subject: system("ksh_script") - STDOUT Messed Up
Message-Id: <81h9et$50d$1@nnrp1.deja.com>



I have a perl script that calls a ksh script using the system command.
The problem is that the standard output from the ksh script is a bit
"messed up", such as missing letters here and there, and some lines are
displayed in the wrong order.

My solution was to do this, so I'd like to know if this is correct,
which I got from the perl cookbook pg248.  The idea is to flush the
stdout from any previous print calls before I make the system call.
This seems to work, but not entirely... some letters are still missing
here and there.

$old_fh=select(STDOUT);
    $| = 1;

system("ksh_script");

select($old_fh);

The other weird thing is that I use the tee command to also log the
output from this ksh_script, the lessed file output appears fine, EXCEPT
I'm getting this ESC[A at the beginning of each line.  Anyone know why I
get this and how to get rid of it??

Thanks for any help.


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


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

Date: Wed, 24 Nov 1999 18:15:29 GMT
From: srhadden@my-deja.com
Subject: system("ksh_script") - STDOUT Messed Up
Message-Id: <81h9vs$5em$1@nnrp1.deja.com>



I have a perl script that calls a ksh script using the system command.
The problem is that the standard output from the ksh script is a bit
"messed up", such as missing letters here and there, and some lines are
displayed in the wrong order.

My solution was to do this, so I'd like to know if this is correct,
which I got from the perl cookbook pg248.  The idea is to flush the
stdout from any previous print calls before I make the system call.
This seems to work, but not entirely... some letters are still missing
here and there.

$old_fh=select(STDOUT);
    $| = 1;

system("ksh_script");

select($old_fh);

The other weird thing is that I use the tee command to also log the
output from this ksh_script, the lessed file output appears fine, EXCEPT
I'm getting this ESC[A at the beginning of each line.  Anyone know why I
get this and how to get rid of it??

Thanks for any help.


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


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

Date: Wed, 24 Nov 1999 18:15:30 GMT
From: srhadden@my-deja.com
Subject: system("ksh_script") - STDOUT Messed Up
Message-Id: <81h9vs$5en$1@nnrp1.deja.com>



I have a perl script that calls a ksh script using the system command.
The problem is that the standard output from the ksh script is a bit
"messed up", such as missing letters here and there, and some lines are
displayed in the wrong order.

My solution was to do this, so I'd like to know if this is correct,
which I got from the perl cookbook pg248.  The idea is to flush the
stdout from any previous print calls before I make the system call.
This seems to work, but not entirely... some letters are still missing
here and there.

$old_fh=select(STDOUT);
    $| = 1;

system("ksh_script");

select($old_fh);

The other weird thing is that I use the tee command to also log the
output from this ksh_script, the lessed file output appears fine, EXCEPT
I'm getting this ESC[A at the beginning of each line.  Anyone know why I
get this and how to get rid of it??

Thanks for any help.


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


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

Date: Wed, 24 Nov 1999 18:15:48 GMT
From: srhadden@my-deja.com
Subject: system("ksh_script") - STDOUT Messed Up
Message-Id: <81ha0f$5es$1@nnrp1.deja.com>



I have a perl script that calls a ksh script using the system command.
The problem is that the standard output from the ksh script is a bit
"messed up", such as missing letters here and there, and some lines are
displayed in the wrong order.

My solution was to do this, so I'd like to know if this is correct,
which I got from the perl cookbook pg248.  The idea is to flush the
stdout from any previous print calls before I make the system call.
This seems to work, but not entirely... some letters are still missing
here and there.

$old_fh=select(STDOUT);
    $| = 1;

system("ksh_script");

select($old_fh);

The other weird thing is that I use the tee command to also log the
output from this ksh_script, the lessed file output appears fine, EXCEPT
I'm getting this ESC[A at the beginning of each line.  Anyone know why I
get this and how to get rid of it??

Thanks for any help.


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


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

Date: Wed, 24 Nov 1999 18:15:55 GMT
From: srhadden@my-deja.com
Subject: system("ksh_script") - STDOUT Messed Up
Message-Id: <81ha0l$5eu$1@nnrp1.deja.com>



I have a perl script that calls a ksh script using the system command.
The problem is that the standard output from the ksh script is a bit
"messed up", such as missing letters here and there, and some lines are
displayed in the wrong order.

My solution was to do this, so I'd like to know if this is correct,
which I got from the perl cookbook pg248.  The idea is to flush the
stdout from any previous print calls before I make the system call.
This seems to work, but not entirely... some letters are still missing
here and there.

$old_fh=select(STDOUT);
    $| = 1;

system("ksh_script");

select($old_fh);

The other weird thing is that I use the tee command to also log the
output from this ksh_script, the lessed file output appears fine, EXCEPT
I'm getting this ESC[A at the beginning of each line.  Anyone know why I
get this and how to get rid of it??

Thanks for any help.


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


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

Date: 24 Nov 1999 17:06:34 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Test for eval() without using eval() ??
Message-Id: <slrn83o6oq.ram.simon@othersideofthe.earth.li>

Matt Kruse (comp.lang.perl.misc):
>I've found that you cannot depend on CGI.pm being installed on a target web
>server. Also, CGI.pm is huge and non-intuitive, IMO. I don't like it. And
>no, I'm certainly not alone in this feeling. Don't even try to tell me that
>everyone likes and uses CGI.pm.

It's part of the core now, and has been for quite some time, I'm led to
believe.

>>  matt kruse's use of ancient
>> code like this [1]:
>>   if ($ENV{'REQUEST_METHOD'} eq "GET")
>>      { $in = $ENV{'QUERY_STRING'};}
>>   elsif ($ENV{'REQUEST_METHOD'} eq "POST")
>>      {read(STDIN,$in,$ENV{'CONTENT_LENGTH'});}
>> isn't really providing anyone much of a service.
>
> I've never had a complaint.

What do you call the above, then?

-- 
How many Unix hacks does it take to change a light bulb?
   Let's see, can you use a shell script for that or does it need a C program?


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

Date: 24 Nov 1999 17:06:16 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Test for eval() without using eval() ??
Message-Id: <383c1b08_2@newsread3.dircon.co.uk>

Matt Kruse <mkruse@rens.com> wrote:
> Tom Phoenix <rootbeer@redcat.com> wrote
>> Without any dependencies AT ALL!
> 
> Your sarcasm is noted...
> 
> In case you did actually miss my point... My goal is to write the script so
> that it runs on any OS, any web server, any version of perl 5, and without
> using any modules that may or may not be on the machine. My target audience
> is not perl experts, CGI experts, or people who read this newsgroup. It's
> people who may not even understand CGI very well, but want to make a program
> work with little or no modifications necessary. So far, I've been very
> successful.
> 
> In some cases, the version of perl installed is not even 'standard'. Such is
> the case with the complaints I've had about eval(). In these cases, I would
> at least like to trap this situation and give a nice error message back. I'm
> not going to support a version of perl that won't use eval() but I at least
> want to detect it.
> 

I dont think that anyone has missed the point - but what are you going to
do when someone reports that open() or print() are disabled ?

/J\
-- 
"Over the years I've always had Max Factor in my box" - Tina Earnshaw,
Chief Make-Up Artist, Titanic


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

Date: Wed, 24 Nov 1999 11:46:34 -0600
From: "Matt Kruse" <mkruse@rens.com>
Subject: Re: Test for eval() without using eval() ??
Message-Id: <81h81t$g9r$1@ffx2nh3.news.uu.net>

Jonathan Stowe <gellyfish@gellyfish.com> wrote
> I dont think that anyone has missed the point - but what are you going to
> do when someone reports that open() or print() are disabled ?

If that actually happens, I would add code to detect that up-front and tell
them that the programm cannot be run. I would much rather do this than have
the script not work at all.

For example, some people were trying to run the script on Win95/98 and found
that it does not have flock. So, I put that in an eval. Easy enough. So now
it runs just fine, but without file locking.

Things like this are pretty trivial to do, and if it reduces the number of
questions I get in my email every day, it's worth it.








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

Date: Wed, 24 Nov 1999 11:48:07 -0600
From: "Matt Kruse" <mkruse@rens.com>
Subject: Re: Test for eval() without using eval() ??
Message-Id: <81h84q$gac$1@ffx2nh3.news.uu.net>

Simon Cozens <simon@brecon.co.uk> wrote in message > >>  matt kruse's use of
ancient
> > I've never had a complaint.
> What do you call the above, then?

Nit-picking. If he was actually trying to use the script and it didn't work,
that would be different.





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

Date: 24 Nov 1999 12:01:27 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Test for eval() without using eval() ??
Message-Id: <slrn83oa5q.m2v.abigail@alexandra.delanet.com>

Simon Cozens (simon@brecon.co.uk) wrote on MMCCLXXVI September MCMXCIII
in <URL:news:slrn83o6oq.ram.simon@othersideofthe.earth.li>:
__ Matt Kruse (comp.lang.perl.misc):
__ >I've found that you cannot depend on CGI.pm being installed on a target web
__ >server. Also, CGI.pm is huge and non-intuitive, IMO. I don't like it. And
__ >no, I'm certainly not alone in this feeling. Don't even try to tell me that
__ >everyone likes and uses CGI.pm.
__ 
__ It's part of the core now, and has been for quite some time, I'm led to
__ believe.


You don't have to believe. Just download Perl and check for yourself.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Wed, 24 Nov 1999 12:24:03 -0600
From: "Matt Kruse" <mkruse@rens.com>
Subject: Re: Test for eval() without using eval() ??
Message-Id: <81ha86$hvs$1@ffx2nh3.news.uu.net>

Abigail <abigail@delanet.com> wrote
> Simon Cozens (simon@brecon.co.uk) wrote
> __ >I've found that you cannot depend on CGI.pm being installed on a
target web
> __ >server.
> __ It's part of the core now, and has been for quite some time, I'm led to
> __ believe.
> You don't have to believe. Just download Perl and check for yourself.

That does _NOT_ mean that everyone has it installed. Not everyone is using
the latest build. Hell, there are even ISP's who still link /usr/bin/perl to
Perl4.

It sounds like some of you have never written scripts to be used by the
general population. It would be nice if everyone had the latest version of
Perl installed with all the modules that are now part of the core, but
that's just not the case. Then factor in that you want to support scripts
running on Win9x, NT, and Mac without multiple versions. You either require
lots of things and limit your audience, or write scripts to be as general as
possible to work for the greatest number of people.

I find the second option to be more interesting, more challenging, and more
rewarding.






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

Date: Wed, 24 Nov 1999 18:58:29 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Test for eval() without using eval() ??
Message-Id: <s3odalqrrp34@corp.supernews.com>

Matt Kruse (mkruse@rens.com) wrote:
: For example, some people were trying to run the script on Win95/98 and found
: that it does not have flock. So, I put that in an eval. Easy enough. So now
: it runs just fine, but without file locking.

I'm curious how it can be that a script (algorithm) which requires locking
in any context can be said to "run just fine" without file locking.  Do
you simply let the underlying file race conditions presumably guarded by
the locking happen uncontrolled if flock isn't available?  This sounds
like saying that a car without brakes "works just fine" -- it does, until
you need to stop. :) 

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: 24 Nov 1999 18:28:35 GMT
From: Martin H. Sluka <martin@sluka.de>
Subject: Threads and memory leaks
Message-Id: <81haoj$2pu$1@fons.sluka.de>

As part of a larger project, I've written some long-running applica-
tions, which collect data primarily over sockets and put it into a
large database.

As it came to testing recently, we discovered that these applications
all seemed to have the same memory leak, consuming some MBs per day,
growing steadily.

At first I feared that the problem would be hard to track, as each of
my scripts uses more than a dozen of modules; however, one thing they
had in common was, that they used threads and especially that they
spawned a new one each 30 seconds (for handling a TCP connection).

To cut a long story short, I came down with the following test script:

		#!/usr/bin/perl

		use Thread;

		sub foo { 1 }

		while () {
		  my $bar = new Thread \&foo;
		  $bar->join
		}

Letting this script run (on a Sun; Solaris 5.7 I think, but this does
not seem to be the problem anyway, see below and Perl 5.005_03), I
could watch it eating the whole RAM within only a few minutes. :-( The
same test on a linux box (Intel, 2.2.7) gave the same appalling re-
sults. Even after compiling and running with the recent devel.tar.gz
(5.005_62), the basic problem remained, even if the leakage seemed to
have slowed down noticeably.

I am of course aware that threads are still concerned a beta feature,
and searching on <http://www.deja.com/>, I then indeed found some ar-
ticles that state there is indeed a memory leak in conjunction with
creating them. However, I really can't believe that if it's _that_
obvious, it wouldn't have been fixed long since.

So am I getting something completely wrong here?

As I'm afraid I don't, is there any workaround for this kind of prob-
lem apart from redisigning my applications not to periodically create
new threads?

Or can I rely on this bug being fixed with the next release?
(And when is this supposed to be?)

Somewhat frustrated,
Martin.

-- 
______________________________________________________________________
Martin H. Sluka / <mailto:martin@sluka.de> / <http://martin.sluka.de/>


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

Date: Wed, 24 Nov 1999 10:31:02 -0800
From: Helmut Messerer <helmut@cancon.com>
Subject: variable scoping
Message-Id: <383C2EE6.2B12@cancon.com>

Hi,

I'm using perl, version 5.005_02 built for sun4-solaris.
And I have the following problem:

  local $whatever;
  {
	my $i1;
	$i="i1";
	$$i='TEST';
	pint "i1=".$i1."/".${i1}."/".${'i1'}."/".${"i1"}."\n";
  }

prints:
i1=//TEST/TEST

if I remove the first 'local' declaration, it prints:
i1=TEST/TEST/TEST/TEST

is this supposed to be?

Thanks for any help,
Helmut


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

Date: Wed, 24 Nov 1999 18:22:27 GMT
From: bwb@acm.org
Subject: Re: What is a good book on Perl
Message-Id: <81hact$5q0$1@nnrp1.deja.com>

In article <814gi7$ptv$1@nntp2.atl.mindspring.net>,
  "Trulits" <trulits@hotmail.com> wrote:
> I am interested in learning Perl.
>
> What is a good book to learn?

Flat Hill Books has a nice set of Perl book reviews and recommendations:

  http://www.flathill.com/languages/perl/

-bwb


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


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

Date: Wed, 24 Nov 1999 10:11:22 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: win32 alarm workaround???
Message-Id: <383C2A4A.ABD1D013@mail.cor.epa.gov>

[comp.lang.perl is defunct.  comp.langp.perl.tk is no longer
relevant to this discussion.  Newsgroups accordingly trimmed.]

Sara wrote:
> Why perl for NT?  why not just use asp?  I thought people write perl in NT
> only so it can work on both unix and nt

Ummm, several points here.

[1] Perl for NT is not just for web-use.  You can't do much
NT admin without a language like Perl at your disposal [to name
one example].

[2] ASP is not a rival to Perl.  Perl is a programming language.
ASP is a proprietary APi which is a competitor to CGI in some
settings.

[3] People write in *Perl* so that it can be used on multiple
platforms.

[4] Please put your replies *after* the quoted text, so that
threads are easier to maintain.  TIA.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Wed, 24 Nov 1999 11:02:10 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: write(FILEHANDLE) ???
Message-Id: <x3yr9hf3mkd.fsf@tigre.matrox.com>


hmpeak8352@my-deja.com writes:

> When I use
> 
>   write(RPT1FILE);
> 
> where RPT1FILE is a file handle, I get the
> following error message :
> Undefined format "main::RPT1FILE" called ...
> I thought this was the right syntax to use for
> writing to a file.

What made you think so? 
Did you read it somewhere? 
If so, then where?

You should get yourself a copy of "Learning Perl".

--Ala



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

Date: Wed, 24 Nov 1999 11:05:16 -0500
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: write(FILEHANDLE) ???
Message-Id: <x3ypuwz3mf8.fsf@tigre.matrox.com>


[re-arranged]

"Robbert Zijp" <rzijp@dds.nl> writes:

> hmpeak8352@my-deja.com heeft geschreven in bericht
> <81ffbl$s3l$1@nnrp1.deja.com>...
> >When I use
> >
> >  write(RPT1FILE);
> >
> >where RPT1FILE is a file handle, I get the
> >following error message :
> >Undefined format "main::RPT1FILE" called ...
> >I thought this was the right syntax to use for
> >writing to a file.

> Well, it isn't.
> 
> open (RPT1FILE, ">Whateverthefileiscalled.maybeanextension");
> print RPTFILE "blablabla";
> 
> Robbert

Two mistakes in two lines of code:

1) You don't test the result of your open() which might fail, and you
   wouldn't know about it!

2) You misspelt RPT1FILE in your print() statement.

Please verify all your examples before posting.

--Ala

PS. Please don't include your message *before* the message you are
replying to. And, there is no need to quote the signature.



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

Date: Wed, 24 Nov 1999 18:12:57 +0100
From: Robbert Zijp <rzijp@dds.nl>
Subject: Re: write(FILEHANDLE) ???
Message-Id: <383C1C99.9459BBC3@dds.nl>



Ala Qumsieh wrote:

> > >When I use
> > >
> > >  write(RPT1FILE);
> > >
> > >where RPT1FILE is a file handle, I get the
> > >following error message :
> > >Undefined format "main::RPT1FILE" called ...
> > >I thought this was the right syntax to use for
> > >writing to a file.
>
> > Well, it isn't.
> >
> > open (RPT1FILE, ">Whateverthefileiscalled.maybeanextension");
> > print RPTFILE "blablabla";
> >
> > Robbert
>
> Two mistakes in two lines of code:
>
> 1) You don't test the result of your open() which might fail, and you
>    wouldn't know about it!
>
> 2) You misspelt RPT1FILE in your print() statement.
>
> Please verify all your examples before posting.
>

Oops, sorry. I'm just a newbie, so don't blame me. Thanks for the advice!

Robbert



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

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


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