[15799] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3212 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 30 18:15:47 2000

Date: Tue, 30 May 2000 15:15:33 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959724932-v9-i3212@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 30 May 2000     Volume: 9 Number: 3212

Today's topics:
        Problem with wildcards (?,*) in Unix file handling! <chrknudsen@hotmail.com>
    Re: Problem with wildcards (?,*) in Unix file handling! <tina@streetmail.com>
    Re: Problem with wildcards (?,*) in Unix file handling! (Brandon Metcalf)
    Re: Problem with wildcards (?,*) in Unix file handling! <chrknudsen@hotmail.com>
    Re: Problem with wildcards (?,*) in Unix file handling! <chrknudsen@hotmail.com>
    Re: Problem with wildcards (?,*) in Unix file handling! <aqumsieh@hyperchip.com>
    Re: Problem with wildcards (?,*) in Unix file handling! <tina@streetmail.com>
    Re: Problem with wildcards (?,*) in Unix file handling! (Brandon Metcalf)
    Re: Programming Perl Realtime ChatRoom (Greg Bacon)
    Re: reading STDERR from a piped process file handle <aqumsieh@hyperchip.com>
    Re: Regex prime numbers (Was Re: seeking method to enco <nospam@devnull.com>
    Re: regexp question (Abigail)
        Regular expressions VISlONZ@webtv.net
    Re: Regular expressions <dave@dave.org.uk>
    Re: Regular expressions (Neil Kandalgaonkar)
        Running Perl containing CGI on both Netscape and Explor <cedron.johnson@bridge.bellsouth.com>
    Re: Running Perl containing CGI on both Netscape and Ex newsposter@cthulhu.demon.nl
    Re: runtime errors - Q how to do this <100115.1010@CompuServe.COM>
    Re: runtime errors - Q how to do this <100115.1010@CompuServe.COM>
        Secure (enough) dayta encryption and decryption <luisr@juanadiaz.org>
    Re: seeking method to encode email addresses in web pag <nospam@devnull.com>
    Re: seeking method to encode email addresses in web pag <nospam@devnull.com>
        Strategies for determining if there's a memory leak? <dwhaskin@earthlink.net>
        system using parameters with spaces (Chuck May)
        Thanks For The INC Array Help <skpurcell@hotmail.com>
        Thx to everybody <transpulse@hotmail.com>
    Re: Translate foreign characters to English (Abigail)
        UNIX path in a substitution <aaron.ginn@motorola.com>
    Re: UNIX path in a substitution <tina@streetmail.com>
    Re: UNIX path in a substitution <red_orc@my-deja.com>
        Use Win32::ODBC; <cedron.johnson@bridge.bellsouth.com>
    Re: Using DBM for simple database? (Kragen Sitaker)
    Re: Waxing Philosophical <Tbone@pimpdaddy.com>
    Re: which perl module for http perl script (Kragen Sitaker)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 30 May 2000 18:21:22 GMT
From: "Christian H. Knudsen" <chrknudsen@hotmail.com>
Subject: Problem with wildcards (?,*) in Unix file handling!
Message-Id: <3934065F.AFDF5B53@hotmail.com>

Hello fellow cgi'ers!

I have the following Perl cgi script that just doesn't seem to work. The

problem lies within the use of the wildcards, as I have tested the
script
without the wildcards and it works. What's the problem?

--- START SCRIPT ---

#!/usr/local/bin/perl

$forumdir = "[That will remain a secret! ;)]";

$filename = "1 ? 2";
system("rm \"$forumdir/$filename.*\"");

print "Content-type: text/html\n\n";
print "Files deleted!";

--- END SCRIPT ---

Any help would be deeply appreciated!

Thanks!

-- Christian H. Knudsen



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

Date: 30 May 2000 18:57:48 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Problem with wildcards (?,*) in Unix file handling!
Message-Id: <8h12vc$268tc$14@fu-berlin.de>

hi,

Christian H. Knudsen <chrknudsen@hotmail.com> wrote:

> problem lies within the use of the wildcards, as I have tested the
> script
> without the wildcards and it works. What's the problem?

> system("rm \"$forumdir/$filename.*\"");

what would you type in at the shell?

rm "file.*" 
would not work, but
rm file.*

so try just:
system("rm $forumdir/$filename.*");
and be careful :-)

tina

-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception


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

Date: 30 May 2000 19:40:07 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: Problem with wildcards (?,*) in Unix file handling!
Message-Id: <8h15en$7j4$1@spinner.corpeast.baynetworks.com>

chrknudsen@hotmail.com writes:

 > $filename = "1 ? 2";
 > system("rm \"$forumdir/$filename.*\"");

Use the opendir and readdir functions.

Brandon


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

Date: Tue, 30 May 2000 20:03:01 GMT
From: "Christian H. Knudsen" <chrknudsen@hotmail.com>
Subject: Re: Problem with wildcards (?,*) in Unix file handling!
Message-Id: <39341E33.82680DF3@hotmail.com>

Thanks for the reply!

I believe that I have to use quotation marks because
the filename includes spaces (" "). If I run the program
without the wildcards (but still with the quotation marks)
it works, so the problem doesn't seem to lie
within the use of the quotation marks... :(

-- Christian H. Knudsen



Tina Mueller wrote:

> hi,
>
> Christian H. Knudsen <chrknudsen@hotmail.com> wrote:
>
> > problem lies within the use of the wildcards, as I have tested the
> > script
> > without the wildcards and it works. What's the problem?
>
> > system("rm \"$forumdir/$filename.*\"");
>
> what would you type in at the shell?
>
> rm "file.*"
> would not work, but
> rm file.*
>
> so try just:
> system("rm $forumdir/$filename.*");
> and be careful :-)
>
> tina
>
> --
> http://www.tinita.de \  enter__| |__the___ _ _ ___
> tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
> search & add comments  \    \ _,_\ __/\ __/_| /__/ perception



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

Date: Tue, 30 May 2000 20:03:54 GMT
From: "Christian H. Knudsen" <chrknudsen@hotmail.com>
Subject: Re: Problem with wildcards (?,*) in Unix file handling!
Message-Id: <39341E68.68EE3F51@hotmail.com>

Why?

-- Christian H. Knudsen



Brandon Metcalf wrote:

> chrknudsen@hotmail.com writes:
>
>  > $filename = "1 ? 2";
>  > system("rm \"$forumdir/$filename.*\"");
>
> Use the opendir and readdir functions.
>
> Brandon



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

Date: Tue, 30 May 2000 20:16:20 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Problem with wildcards (?,*) in Unix file handling!
Message-Id: <7aitvvyesr.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>


"Christian H. Knudsen" <chrknudsen@hotmail.com> writes:

> Hello fellow cgi'ers!

Not everybody uses Perl for CGI, you know :-)

> system("rm \"$forumdir/$filename.*\"");

Did you try unlink() ?

--Ala


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

Date: 30 May 2000 20:19:36 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Problem with wildcards (?,*) in Unix file handling!
Message-Id: <8h17oo$268tc$20@fu-berlin.de>

hi,

Christian H. Knudsen <chrknudsen@hotmail.com> wrote:

would you please try to quote just what you
are commenting on? thanks

> I believe that I have to use quotation marks because
> the filename includes spaces (" "). If I run the program
> without the wildcards (but still with the quotation marks)
> it works, so the problem doesn't seem to lie
> within the use of the quotation marks... :(

of course, because you can type in
rm "testfile"
and testfile will be deleted. the problem is,
that when you include "*" into the quotes, the
shell won't use it as a wildcard.

again, what would you type into the shell
if the filename contains whitespaces? e.g. "test file"

rm "test file"

ok, now you want to remove all files beginning with "test ",
e.g.
test 1
test 2
test 42

you would type:
rm test\ *

or
rm "test "*

you see the problem?
if you *want* to use the quotation marks, try:
system(qq{rm "$forumdir/$filename."*});
and look at
perldoc perlop for the meaning of qq{}

tina



-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception


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

Date: 30 May 2000 20:40:07 GMT
From: bmetcalf@baynetworks.com (Brandon Metcalf)
Subject: Re: Problem with wildcards (?,*) in Unix file handling!
Message-Id: <8h18v7$94l$1@spinner.corpeast.baynetworks.com>

chrknudsen@hotmail.com writes:

 > Why?
 > 
 > -- Christian H. Knudsen
 > 
 > 
 > 
 > Brandon Metcalf wrote:
 > 
 > > chrknudsen@hotmail.com writes:
 > >
 > >  > $filename = "1 ? 2";
 > >  > system("rm \"$forumdir/$filename.*\"");
 > >
 > > Use the opendir and readdir functions.

Because they are more portable than using an os specific system() call.
You should use them along with the unlink() function.

If you are going to write something in Perl, you might as well do it all
the way.

Brandon


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

Date: Tue, 30 May 2000 21:14:30 GMT
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Programming Perl Realtime ChatRoom
Message-Id: <sj8bpmiu5pj94@corp.supernews.com>

In article <01d04948.ee51cc45@usw-ex0106-046.remarq.com>,
Chung Derek  <dchk_78NOdcSPAM@yahoo.com.invalid> wrote:

: i am interested in a Perl real-time chatroom.

It's not web based, but check out

    <URL:http://www.cs.uah.edu/~gbacon/perl/pserv/>

The code's ugly, and I haven't touched it in a very long time.  Consider
yourself warned. :-)

: most of the example i see in the Internet uses the meta tage
: refresh, which is very unsightly. I also don't want to use java.

You may want to check out PerlMUD: <URL:http://www.boutell.com/perlmud/>.

Greg
-- 
Give a man a fish and he will eat for a day. Teach him how to fish,
and he will sit in a boat and drink beer all day.
    -- George Carlin


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

Date: Tue, 30 May 2000 18:20:51 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: reading STDERR from a piped process file handle
Message-Id: <7aog5nyk58.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>


rudy@tigger.mt.lucent.com (vener) writes:

>                                              Is there a way to 
> redirect the password program's standard error to the parent 
> process? Should I be using something other than open() ? 

You should be reading the FAQs, before even thinking about posting.

	% perl -q STDERR
	=head1 Found in /usr/lib/perl5/5.00503/pod/perlfaq8.pod

	=head2 How can I capture STDERR from an external command? 

--Ala


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

Date: 30 May 2000 21:54:53 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Regex prime numbers (Was Re: seeking method to encode email addresses in web page forms)
Message-Id: <8h1dbd$7h8$2@216.155.32.165>

In article 
<Pine.GSO.4.21.0005262143230.3759-100000@dataserv.libs.uga.edu>, Brad 
Baxter <bmb@dataserv.libs.uga.edu> wrote:

 | On Sat, 27 May 2000, Gwyn Judd wrote:
 | > I was shocked! How could Larry Rosler <lr@hpl.hp.com>
 | > say such a terrible thing:
 | > 
 | > <snip>
 | > 
 | > >Reading the source of a Perl program, compiling it, and executing the 
 | > >I/O to print a result -- all these will of course dominate one line 
 | > >of 
 | > >computation, no matter how poorly it performs (within limits -- I'm 
 | > >sure 
 | > >things like Abigail's regex prime-number generator would contradict 
 | > >that 
 | > >generalization).
 | > 
 | > Okay that's got me curious. What is this regex prime number generator?
 | 
 | Do you mean this one?
 | 
 | perl -wle '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_ ++'


owie. neat, but it seems to have some sort of problem on my machine :/ 
crashes and hangs somewhere around 5000 

I even tried flushing the buffer on each print with $|=1 to no avail.

I look at this and look at this and still don't really grok it. anyone 
got a link to a nice explanation of this for the serious newbies like 
myself? :)

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 30 May 2000 21:40:27 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: regexp question
Message-Id: <8h1cgb$59q$2@news.panix.com>

On Sat, 27 May 2000 20:12:09 +0200,
Oliver Sick <sick@styx.math.uni-bonn.de> wrote:
++ Hi
++ 
++ I've a problem finding the correct regular expression  for matching  a
++ string of FIXED length (lets =L) which contains a specific letter
++ EXACTLY ONE time !
++ 
++ Example:  If the length of the string is L=6 and the specific letter is
++ the "s",
++ then  the strings  "supper"  and  "nights"   should match but  the
++ string "assert"  shouldn't.


I wouldn't use a regex for that.

    if (length ($str) == 6 && 1 == $str =~ y/s//) {
        ...  # Ok
    }
    else {
        ...  # Not ok
    }



Abigail


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

Date: Tue, 30 May 2000 13:49:11 -0400 (EDT)
From: VISlONZ@webtv.net
Subject: Regular expressions
Message-Id: <7738-3933FF17-16@storefull-145.iap.bryant.webtv.net>

I am learning reg expressions and I made the email validator
below...obviously it has its faults:

if($z =~/^\w+@\w+\.\w+$/)    
{print "OK";}
else
 {print "Gotta use realistic email addy";}

Using this,an addy can only have one period after the @ and also since
the underscore is included in \w,the addy "_@_._" would work. I could
take the VERY long route to compromise this,but its not feasible. Any
reg-expression examples to get me on the right track  would be greatly
appreciated. Please post...no emails. Thanks alot. :-)



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

Date: Tue, 30 May 2000 19:33:51 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: Regular expressions
Message-Id: <fb28jskq32u5qdv9m1l6d2ofdsi51gf3lt@4ax.com>

On Tue, 30 May 2000 13:49:11 -0400 (EDT), VISlONZ@webtv.net wrote:

>I am learning reg expressions and I made the email validator
>below...obviously it has its faults:
>
>if($z =~/^\w+@\w+\.\w+$/)    
>{print "OK";}
>else
> {print "Gotta use realistic email addy";}
>
>Using this,an addy can only have one period after the @ and also since
>the underscore is included in \w,the addy "_@_._" would work. I could
>take the VERY long route to compromise this,but its not feasible. Any
>reg-expression examples to get me on the right track  would be greatly
>appreciated. Please post...no emails. Thanks alot. :-)


Perhaps the answer to the question "How do I check a valid mail
address?" in perlfaq9 might be of some interest to you.

hth,

Dave...

-- 
<http://www.dave.org.uk>  SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>

"There ain't half been some clever bastards" - Ian Dury [RIP]


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

Date: 30 May 2000 18:47:15 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: Regular expressions
Message-Id: <8h12bj$cdq$1@newsflash.concordia.ca>

In article <7738-3933FF17-16@storefull-145.iap.bryant.webtv.net>,
 <VISlONZ@webtv.net> wrote:
>I am learning reg expressions and I made the email validator
>below...obviously it has its faults:

[...]
>
> Any
>reg-expression examples to get me on the right track  would be greatly
>appreciated. 


We just had a long thread about this. See recent usenet archives for 
'valid email address' if you're interested.

Basically we covered the same ground as perlfaq9, question 16: "How do I 
check a valid mail address?" However the faq is slightly out of date in
that we now have Abigail's Parse::RecDescent-based RFC::RFC822::Address 
module and an unnamed script using regexes that was posted to this group.

-- 
Neil Kandalgaonkar
neil@brevity.org


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

Date: Tue, 30 May 2000 15:12:42 -0400
From: Cedron Johnson <cedron.johnson@bridge.bellsouth.com>
Subject: Running Perl containing CGI on both Netscape and Explorer
Message-Id: <393412AA.A54D20E4@bridge.bellsouth.com>

I have been trying to run examples of using the popup menu function but
have had trouble getting the code to work using Netscape 4.07.  The
examples work  fine under Internet Explorer.  Does any one know where I
can find resources for getting aroud caveats with both Netscape and
IE.4.0?  Thanks

Cedron



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

Date: 30 May 2000 19:43:13 GMT
From: newsposter@cthulhu.demon.nl
Subject: Re: Running Perl containing CGI on both Netscape and Explorer
Message-Id: <8h15kh$s87$1@internal-news.uu.net>

Cedron Johnson <cedron.johnson@bridge.bellsouth.com> wrote:
> I have been trying to run examples of using the popup menu function but
> have had trouble getting the code to work using Netscape 4.07.  The
> examples work  fine under Internet Explorer.  Does any one know where I
> can find resources for getting aroud caveats with both Netscape and
> IE.4.0?  Thanks

  It looks like you're not having a problem with Perl, but with JavaScript.
So you probably should look for websites/newsgroups about javascript.
comp.lang.javascript perhaps?

Erik



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

Date: 30 May 2000 21:25:32 GMT
From: Dick Nickalls dicknickallscompuservecom <100115.1010@CompuServe.COM>
Subject: Re: runtime errors - Q how to do this
Message-Id: <8h1bkc$7ha$1@sshuraac-i-1.production.compuserve.com>

Thanks Tony, 
but as far as I can see using eval() I will have to
use it for every calculation where I might accidentally be
dividing by zero..fine in a small prog, but not here.

I am reading in line-by-line an input file with parameters,
so if one of the parameters is accidentally not a valid number
etc, then I will likely get a runtime error.
I want to do  IF error --> next line etc
and just pick up the errormessage and print it to the screen.
Surely there must be a way without having to resourt to eval??

I have already written the program in BASIC, and in the 
process of translating it to PERL.

cheers,
Dick

-- 
Dick Nickalls
dicknickalls@compuserve.com
Department of Anaesthesia, City Hospital, Nottingham, UK.


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

Date: 30 May 2000 21:26:49 GMT
From: Dick Nickalls dicknickallscompuservecom <100115.1010@CompuServe.COM>
Subject: Re: runtime errors - Q how to do this
Message-Id: <8h1bmp$7ha$2@sshuraac-i-1.production.compuserve.com>

Thanks Ala, I will checkout your reference on trapping.

cheers,
Dick

-- 
Dick Nickalls
dicknickalls@compuserve.com
Department of Anaesthesia, City Hospital, Nottingham, UK.


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

Date: Tue, 30 May 2000 17:04:14 -0300
From: "Luis E. Rodriguez" <luisr@juanadiaz.org>
Subject: Secure (enough) dayta encryption and decryption
Message-Id: <sj8b8vmn5pj140@corp.supernews.com>


I am looking for a reasonably secure way to store encrytped data so that it
can be decrytped back to its original form when needed.  The data to be
encrypted will be credit card numbers.

Is there any Perl script or module or whatever that can do this job?  I know
there is a "crypt" function in Perl but it only works one way.  I use it for
password authentication but is not quite what I need to store credit card
numbers securely.

Thanks for any suggestions.





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

Date: 30 May 2000 21:46:42 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <8h1cs2$7h8$0@216.155.32.165>

In article <3933D820.95E06CF1@stomp.stomp.tokyo>, "Godzilla!" 
<godzilla@stomp.stomp.tokyo> wrote:

 | The WebDragon wrote:
 | 
 | > hmm.. let's see.. I make some helpful suggestions and 
 | > you turn around and insult me...
 | 
 | No, you made tactless unwarranted comments pertaining
 | to notions which are simply none of your business.
 | Your comments are exceptionally insulting. Use social
 | grace with me or I will blast you each time for your
 | intentional poorly veiled rudeness and insulting
 | commentary. 

your tone is rude and insulting, considering that my original message 
was helpful, nice, suggestive (not commanding), made NO tactless 
comments (however YOUR reply, you call me Adolf, which is EXTREMELY 
tactless, and more than exceptionally insulting considering you don't 
even know what RACE of HUMAN I am)

I dunno folks, would you call the paragraph above mine, "Poorly veiled" 
or what? :D heehee

 | Play it straight with me and you won't have problems.
 | Play games and I will match you move-for-move and,
 | in the final end, call a checkmate along with taking
 | both your King and Queen, my old friend.

I tried playing it straight with you and 
    got likened to Adolf Hitler
    insulted
    browbeaten
    and can I also whinge that you took a snotty tone with me ? 

I don't call that playing straight. that's neither check, nor mate, nor 
anything resembling a troubling chess situation. 

That's not even a come-back, particularly considering there was nothing 
to come-back **TO** to begin with. 

Paranoid maybe, Psychotic maybe.. certainly not 'playing strtaight'.

You also seem to have mistaken me for someone else.. I've only been here 
a month, though I've been on USENET in general off-and-on for many many 
moons. 

 | Practice social grace with me. I have dignity and
 | pride within an environment lacking these qualities.

An environment you created for yourself when *you* started with the 
insults, tackiness, poorly veiled threats, and general surliness to a 
completely innocently suggestive(as opposed to commanding) article. 

Back down, you already lost this argument. If you don't think so, tell 
it to your sysadmin.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: 30 May 2000 21:51:16 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <8h1d4k$7h8$1@216.155.32.165>

In article <392FD474.36988CCC@stomp.stomp.tokyo>, "Godzilla!" 
<godzilla@stomp.stomp.tokyo> wrote:

 | Neil Kandalgaonkar wrote:
 |  
 | > In article <392F25A5.71033160@stomp.stomp.tokyo>,
 | > Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
 | 
 | > Personally, I've tried to be patient with you, 
 | > but it appears you are incapable of acting like 
 | > a rational and humane person. Instead, you treat 
 | > this newsgroup as your personal shitting ground.
 | 
 | 
 | Oh my, now aren't you just the patron saint
 | of mule manure. Want some cheese with your
 | whine little boy?
 | 
 | Godzilla!

pardon me for interrupting, but didn't you just get dnoe telling me that 
you play it straight with people and don't get involved in this sort of 
pointless tacky insulting disparating senseless whinging behaviour? 

$pot = $kettle = $black

[S]tandard Complaint. Fish-->Barrel-->TacNuke.

-- 
send mail to mactech (at) webdragon (dot) net instead of the above address. 
this is to prevent spamming. e-mail reply-to's have been altered 
to prevent scan software from extracting my address for the purpose 
of spamming me, which I hate with a passion bordering on obsession.  


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

Date: Tue, 30 May 2000 20:36:24 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Strategies for determining if there's a memory leak?
Message-Id: <393425BE.224BA7D1@earthlink.net>

[I posted this earlier and then cancelled because I found at least part
of my problem.  But it's still leaking, although not as badly.  I think
the questions still applies.  TIA.]

Environment: Perl 5.6, compiled with -DDEBUGGING, on Solaris 2.6.

I have a server process (not a web server, although it does communicate
with clients over TCP/IP) that I suspect has a memory leak.  I'm looking
for suggestions as to how I would best go about investigating this and
(hopefully) correcting it, assuming the leak isn't in some external
module I'm using.

The reason I think I have a leak is that, after almost every request to
the server, both the resident set size (rss) and the virtual size (vss)
go up by about 400K.  I would not expect this to happen, and needless to
say, if the growth continues (multiple servers are running) the system
will exhaust memory.

The server is designed very object-orientedly and uses quite a number of
existing modules (see below).  I use a lot of local-scoped variables
(and I have 'use strict' turned on), including locally-scoped objects
(which I am assuming get correctly unreferenced when they go out of
scope).

As I indicated above, I tried compiling with -DDEBUGGING and running it
with -Dm, but once the thread of execution goes into one of my (own)
packages, the malloc/free messages stop appearing.  Hmm.

I'm currently investigating the Devel::Leak and Devel::Symdump modules,
but it's not yet clear to me whether/how these would identify memory
that isn't getting correctly freed (and I actually haven't built
Devel::Symdump on this box yet and I've seen at least one post of
someone who had trouble building it on 5.6 (although that was Linux)).

I wonder if PERL_DESTRUCT_LEVEL might help, but (as others have already
observed) there's very little doc (or discussion) on what exactly that
does.  I guess it's time to dive into the C code.

I've done lots of newsgroup searching and checked the perldbug db, and
there are some indications that perhaps some of the modules I'm using
(e.g. MLDBM) may have leaks.  Agh!  But again, how would I best use the
tools I've mentioned above (or others?) to determine this for certain?

Apologies for a sort of vague posting, but much thanks in advance for
any tips/pointers anyone can provide.

dwh

Modules I'm using:
use Carp;
use DB_File;
use Date::Manip;
use Digest::MD5 qw(md5_hex);
use File::Basename;
use FileHandle;
use HTTP::Date;
use HTTP::Request::Common;
use IO::Select;
use IO::Socket;
use LWP::UserAgent;
use MLDBM qw(GDBM_File Storable);
use POSIX;
use Storable qw(nfreeze thaw);
use Time::HiRes
use Time::Local;
use URI::Escape;
use XML::DOM;
use utf8;


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

Date: 30 May 2000 18:59:36 GMT
From: may@ims.nci.nih.gov (Chuck May)
Subject: system using parameters with spaces
Message-Id: <8F449C7DAmayimsncinihgov@207.192.128.41>

I am trying to use a system call, but one of my parameters has a space in 
it.  Here is what I cam doing:

# run the java command to check user
@args = ("program", $port, $db, $user, $password, $rpt, $search);
system(@args) == 0 or print "program failed: $?";

The $rpt and $system variables contain spaces, and when the program gets 
the arguement, they are parsed out into multiple arguements.  I've tried 
using single or double quotes to surround the argument, but it doesn't 
help.  Does anyone know if this can be done?  Otherwise the only thing I 
can think of is to replace the spaces with some special character and 
convert it back on the other side.  

Thanks for any help.

-- 
Chuck May
IMS, Inc.
may@ims.nci.nih.gov


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

Date: Tue, 30 May 2000 16:49:32 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: Thanks For The INC Array Help
Message-Id: <39343771$0$12865@wodc7nh1.news.uu.net>






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

Date: Tue, 30 May 2000 23:33:28 +0200
From: transpulse <transpulse@hotmail.com>
Subject: Thx to everybody
Message-Id: <393433A8.905EC52D@hotmail.com>






transpulse@hotail.com wrote:
> 
> hi there,
> 
> i need help with reqex.
> i want to check a certain string for illegal charaters. (legel charaters
> are a-z A-Z 0-9 - . /). How can i do this with regex.
> 
> Thx for your help
> 
> daniel


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

Date: 30 May 2000 20:37:42 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Translate foreign characters to English
Message-Id: <8h18qm$4di$1@news.panix.com>

On Tue, 30 May 2000 12:49:23 GMT, Lou Hevly <lou@visca.com> wrote:
++ 
++ Good point. I actually use this sub for Latin languages, but I figured
++ as long as I was doing it I might as well do it for all the chars up
++ to 255. My main purpose was to create files names from user input.


Well, assuming you are using Unix, the only characters you need to escape
are '/' and "\x00", as all other characters are valid in filenames.

Of course, when creating filenames from user input, translating accented
letters should be the least of your worries.



Abigail


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

Date: 30 May 2000 11:12:21 -0700
From: Aaron Ginn <aaron.ginn@motorola.com>
Subject: UNIX path in a substitution
Message-Id: <snn1l76h6i.fsf@motorola.com>


I'm having some difficulty performing a substitution with a UNIX
path stored in a variable.  Here is the problem portion of my
code:

   while (<READFILE>) {
      $line = $_;

      $line =~ s/GDSFILENAME/\Q$gdsfile\E/;

      print WRITEFILE $line;
   }

The variable $gdsfile holds a UNIX path to a file.  I want to
substitute the word 'GDSFILENAME' with the contents of $gdsfile.
The problem is that when I print to a file, perl is treating the
characters '/' and '.' as metacharacters that need to have an
escape character placed before them.  So instead of printing
out a line like this:

 INDISK      = /home/ginn/tsmc18_drc_allcells.gds

I get the following:

  INDISK      = \/home\/ginns\/tsmc18_drc_allcells\.gds

Obviously, this is wrong, but I can't get around this.  I
suspect that the \Q\E in the substitution is doing something
that I don't want it to do, but I don't know what.

Can anyone lend me a hand?

Thanks,
Aaron Ginn


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

Date: 30 May 2000 19:02:44 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: UNIX path in a substitution
Message-Id: <8h138k$268tc$15@fu-berlin.de>

hi,

Aaron Ginn <aaron.ginn@motorola.com> wrote:

> I'm having some difficulty performing a substitution with a UNIX
> path stored in a variable.  Here is the problem portion of my
> code:

>    while (<READFILE>) {
>       $line = $_;
>       $line =~ s/GDSFILENAME/\Q$gdsfile\E/;
>       print WRITEFILE $line;
>    }

just try this:
$line =~ s/GDSFILENAME/$gdsfile/;

tina

-- 
http://www.tinita.de \  enter__| |__the___ _ _ ___
tina's moviedatabase  \     / _` / _ \/ _ \ '_(_-< of
search & add comments  \    \ _,_\ __/\ __/_| /__/ perception


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

Date: Tue, 30 May 2000 19:45:11 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: UNIX path in a substitution
Message-Id: <8h15o1$pj5$1@nnrp1.deja.com>

In article <snn1l76h6i.fsf@motorola.com>,
  Aaron Ginn <aaron.ginn@motorola.com> wrote:
>
>       $line =~ s/GDSFILENAME/\Q$gdsfile\E/;
>

if i understand your question, you don't need the \Q\E there:

#!/usr/local/bin/perl -w
use strict;

my $one = '/usr/local/GDSFILENAME/corn.tst';
my $gdsfile = 'gork';

print "$one ";
$one =~ s/GDSFILENAME/$gdsfile/;
print "becomes $one\n\n";

====================
/usr/local/GDSFILENAME/corn.tst becomes /usr/local/gork/corn.tst



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


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

Date: Tue, 30 May 2000 15:05:04 -0400
From: Cedron Johnson <cedron.johnson@bridge.bellsouth.com>
Subject: Use Win32::ODBC;
Message-Id: <393410E0.46076958@bridge.bellsouth.com>

I have installed the Win32::ODBC module but when I add the following
code:

Use Win32::ODBC;

to my script I receive the following error:

The dynamic link library PerlCRT.dll could not be found in the specified
path...
This dll does not live on my hard drive at this time.  Can any one tell
me what I have missed?  Thanks.

Cedron



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

Date: Tue, 30 May 2000 18:16:22 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Using DBM for simple database?
Message-Id: <WzTY4.127226$681.2401271@news-east.usenetserver.com>

In article <392d5320.1674773@news.skynet.be>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Kragen Sitaker wrote:
>>DBM files store strings.  So you can encode your thing as a string:
>>
>>$books{$unique_id} = join ',', $title, $author, $whatever;
>># . . . 
>>my ($title, $author, $whatever) = split /,/, $books{$another_unique_id};
>
>Sniff... sniff...  I smell Perl4!

I recall hearing that people did things like this in Perl 4, but you'd
at least have to get rid of the 'my'.


-- 
<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>
The power didn't go out on 2000-01-01 either.  :)


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

Date: 30 May 2000 18:56:31 GMT
From: Intergalactic Denizen of Mystery <Tbone@pimpdaddy.com>
Subject: Re: Waxing Philosophical
Message-Id: <8h12sv$28bp$1@news.enteract.com>

jerome.oneil@activeindexing.com writes:
>[...]
>If this is the case, as opposed to the troll being mentaly unbalanced
>and truly incapable of understanding (what I belive, FWIW), then it's
>motive isn't ignorance, but malice, and therefore opposition should
>be even more rigorus. 

That's not being questioned. The nature of the opposition is. You
personally like a shootout. In a way so do I. But it doesn't work.
All this "we tried ignoring" is a bunch of hooey. Nobody "tried
ignoring" in any sense of the term; it has been obsessive geeks
posting corrections one after the other. Perhaps *you* tried
ignoring and it "didn't work". But look at the big picture,



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

Date: Tue, 30 May 2000 19:44:59 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: which perl module for http perl script
Message-Id: <%SUY4.128821$681.2417742@news-east.usenetserver.com>

In article <u9d7m4565j.fsf@wcl-l.bham.ac.uk>,  <nobull@mail.com> wrote:
>Note: some web sites redirect page-not-found errors to a "friendly"
>error page that returns with "OK" status.  They do this because a
>certain well known HTTP client doesn't (by default) display error
>pages that return with the proper status.

Said HTTP client is MSIE 5, for those not yet hip to this stuff.
Actually, if your error pages are long enough, it will display them
always.

>There's no way for a robot to identify a bad link to a page on such a site.

Well, you can look to see if the page has changed a great deal.  This
requires knowledge of the previous contents of the page.
-- 
<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>
The power didn't go out on 2000-01-01 either.  :)


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

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


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