[11376] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4976 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 26 11:37:37 1999

Date: Fri, 26 Feb 99 08:30:39 -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, 26 Feb 1999     Volume: 8 Number: 4976

Today's topics:
        Help w/ Regular Expressions <jalil@corp.home.net>
    Re: Help w/ Regular Expressions (Jordan I. K. McClure)
    Re: Help w/ Regular Expressions (Tad McClellan)
    Re: Help w/ Regular Expressions (Ronald J Kimball)
    Re: Help w/ Regular Expressions <Allan@Due.net>
    Re: Help w/ Regular Expressions (Randal L. Schwartz)
    Re: Help w/ Regular Expressions (Abigail)
    Re: Help w/ Regular Expressions <emschwar@mail.uccs.edu>
        help! can anyone spot an error in this code? <23_skidoo@geocities.com>
    Re: help! can anyone spot an error in this code? <jdf@pobox.com>
    Re: help! can anyone spot an error in this code? <23_skidoo@geocities.com>
    Re: help! can anyone spot an error in this code? <jdf@pobox.com>
    Re: help! can anyone spot an error in this code? (Matthew Bafford)
    Re: help! can anyone spot an error in this code? (Larry Rosler)
    Re: help! can anyone spot an error in this code? (Tad McClellan)
    Re: help! can anyone spot an error in this code? (Abigail)
        Help, stop memory leak NOSPAMjroy@Eng.Sun.COM
    Re: Help,,, (Apache server) <debot@xs4all.nl>
    Re: Help,,, (Apache server) johns@thetech.org
    Re: Help,,, (Apache server) (Larry Rosler)
    Re: Help,,, (Apache server) <Allan@Due.net>
    Re: HELP: CGI.pm/perlmod forgets data?!? (Petra Hauschke)
        HELP: getopt <iolea@tsai.es>
    Re: HELP: getopt (Clay Irving)
    Re: HELP: getopt (I R A Aggie)
    Re: HELP: getopt <gellyfish@btinternet.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 23 Feb 1999 23:07:04 GMT
From: "Jalil Feghhi" <jalil@corp.home.net>
Subject: Help w/ Regular Expressions
Message-Id: <919811224.274534@zeppelin.svr.home.net>

I have a multilined block of text. Somewhere in this text I have a pattern
like this:

some text  (number) some text (number) sometext

I would like to extract these two numbers out of my text. Could somebody let
me know what regular expression I should use to do this.

Thanks,

-Jalil





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

Date: 23 Feb 1999 23:29:06 GMT
From: jimcclur@ews.uiuc.edu (Jordan I. K. McClure)
Subject: Re: Help w/ Regular Expressions
Message-Id: <7avdk2$6r1$1@vixen.cso.uiuc.edu>

/.*?(\d*).*?(\d*).*?/m

The strings will be stored in $1 and $2

Jalil Feghhi (jalil@corp.home.net) wrote:
: I have a multilined block of text. Somewhere in this text I have a pattern
: like this:
: 
: some text  (number) some text (number) sometext
: 
: I would like to extract these two numbers out of my text. Could somebody let
: me know what regular expression I should use to do this.
: 
: Thanks,
: 
: -Jalil
: 
: 
: 

-- 
What is a committee?  A group of the unwilling, picked from the
unfit, to do the unnecessary.  -- Richard Harkness,


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

Date: Tue, 23 Feb 1999 14:03:47 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help w/ Regular Expressions
Message-Id: <j2uua7.gu5.ln@magna.metronet.com>

Jordan I. K. McClure (jimcclur@ews.uiuc.edu) wrote:

: /.*?(\d*).*?(\d*).*?/m
                       ^
                       ^

   That has absolutely no effect.

   So why is it there?

   m//m changes the interpretation of anchors (^ and $), but your
   pattern doesn't even _have_ any anchors.

   You should never use m//m unless there are anchors in your pattern.


   Perhaps you meant m//s instead?


: The strings will be stored in $1 and $2

: Jalil Feghhi (jalil@corp.home.net) wrote:
: : I have a multilined block of text. Somewhere in this text I have a pattern
: : like this:
: : 
: : some text  (number) some text (number) sometext
: : 
: : I would like to extract these two numbers out of my text. Could somebody let
: : me know what regular expression I should use to do this.

--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 23 Feb 1999 21:47:11 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Help w/ Regular Expressions
Message-Id: <1dnp7oi.522a00adpnoeN@bay1-193.quincy.ziplink.net>

Jalil Feghhi <jalil@corp.home.net> wrote:

> some text  (number) some text (number) sometext
> 
> I would like to extract these two numbers out of my text. Could somebody let
> me know what regular expression I should use to do this.

For natural numbers:

@numbers = /(\d+)/g;

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
perl -e'$_="\012534`!./4(%2`\cp%2,`(!#+%2j";s/./"\"\\c$&\""/gees;print'


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

Date: Tue, 23 Feb 1999 21:57:36 -0500
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: Help w/ Regular Expressions
Message-Id: <4VJA2.608$986.11601@nntp1.nac.net>

Jordan I. K. McClure wrote in message <7avdk2$6r1$1@vixen.cso.uiuc.edu>...
:/.*?(\d*).*?(\d*).*?/m
:The strings will be stored in $1 and $2


Let's think about this.  First we start by matching the smallest of 0 or more
of any characters, so that is the beginning of the line.  Then we match 0 or
more digits, which is nothing, then the smallest number of 0 or more
characters, 0 or more digits, then a last non-greedy 0 or more characters.
Still no progress.  We meet all of the conditions of the match at the
beginning of the line.  Yikes.  Something has to matter <g>.

For example,
$string = 'some text 12345 some text 67890 sometext';
$string =~ /(.*?)(\d*)(.*?)(\d*)(.*?)(.)/;
print "1->$1,2->$2,3->$3,4->$4,5->$5,6->$6\n";
gives
1->,2->,3->,4->,5->,6->s

In your example $1 and $2 are the 0 or more digit matches which contain
nothing.  If the goal is to match some group of digits, followed by some
non-digits followed by another group of digits.  One way might be to
/(\d+)\D+(\d+)/

But of course, TIMTOWTDI

HTH

AmD
--
$email{'Allan M. Due'} =' Allan@Due.net '
--random quote--
The beginning of wisdom is the definitions of terms.
  Socrates





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

Date: 24 Feb 1999 08:08:54 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Help w/ Regular Expressions
Message-Id: <m1678r942x.fsf@halfdome.holdit.com>

>>>>> "Ronald" == Ronald J Kimball <rjk@linguist.dartmouth.edu> writes:

Ronald> Jalil Feghhi <jalil@corp.home.net> wrote:
>> some text  (number) some text (number) sometext
>> 
>> I would like to extract these two numbers out of my text. Could somebody let
>> me know what regular expression I should use to do this.

Ronald> For natural numbers:

Ronald> @numbers = /(\d+)/g;

Since it includes "0", wouldn't that be "whole numbers"?

Or did I get that backwards?  It's been 24 years since I last used
those terms. :)

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 24 Feb 1999 17:14:23 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Help w/ Regular Expressions
Message-Id: <7b1c1f$jie$2@client2.news.psi.net>

Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMIII September
MCMXCIII in <URL:news:m1678r942x.fsf@halfdome.holdit.com>:
,, >>>>> "Ronald" == Ronald J Kimball <rjk@linguist.dartmouth.edu> writes:
,, 
,, Ronald> Jalil Feghhi <jalil@corp.home.net> wrote:
,, >> some text  (number) some text (number) sometext
,, >> 
,, >> I would like to extract these two numbers out of my text. Could somebody let
,, >> me know what regular expression I should use to do this.
,, 
,, Ronald> For natural numbers:
,, 
,, Ronald> @numbers = /(\d+)/g;
,, 
,, Since it includes "0", wouldn't that be "whole numbers"?
,, 
,, Or did I get that backwards?  It's been 24 years since I last used
,, those terms. :)


I would like to point you to Eric's treasure trove of mathematics,
but that has turned commercial and the letters 'N' and 'W' are
unavailable today.



Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))


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

Date: 24 Feb 1999 10:46:59 -0700
From: Eric The Read <emschwar@mail.uccs.edu>
Subject: Re: Help w/ Regular Expressions
Message-Id: <xkf3e3vk830.fsf@valdemar.col.hp.com>

merlyn@stonehenge.com (Randal L. Schwartz) writes:
> >>>>> "Ronald" == Ronald J Kimball <rjk@linguist.dartmouth.edu> writes:
> Ronald> For natural numbers:
> Ronald> @numbers = /(\d+)/g;
> 
> Since it includes "0", wouldn't that be "whole numbers"?
> 
> Or did I get that backwards?  It's been 24 years since I last used
> those terms. :)

It entirely depends on whose religion you follow.  Some professors say N
includes 0, some will lynch you if you claim it does, and some just say,
"As long as you define which version of N you're using beforehand, I
don't care."

-=Eric


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

Date: Wed, 24 Feb 1999 14:10:27 +0000
From: 23_skidoo <23_skidoo@geocities.com>
Subject: help! can anyone spot an error in this code?
Message-Id: <36D40847.7D87@geocities.com>

hi,

i'm having a problem with cgi script, perhaps someone can look at this
and spot any errors that i can't see.

here's what i've observed:

if i don't enter a name, it calls &error(no_name) as it should
if i enter name but no subject, it calls &error(no_subject) as it should
if i enter a name and a subject, the script hangs and times out whether
or not i enter an email address or a body. 
all the inputs on the web page are text boxes aside from body which is a
textarea, i don't think that should make any difference though, the
problem seems to be in the perl, not in the html. 

i didn't write all of this code but it seemed to work fine until
recently, nothing here was changed but this seems to be where the
problem starts.

if anyone can see where this might go wrong, thanks for helping me out,
if i've not given enough to go on, let me know and i'll post more code,
it seems to be around these conditions that the problem occurs. i don't
have access to the error logs on the server which is a total pain. is
there a way i can get an error 500 to tell me something more productive?
(reference to a module plenty if such a thing exists).

thanks & here's the code

-23

   if ($FORM{'name'}) {
      $name = "$FORM{'name'}";
      $name =~ s/"//g;
      $name =~ s/<//g;
      $name =~ s/>//g;
      $name =~ s/\&//g;
   	  $codecheck = substr ($name, 0, $codelength); 
	  if ($codecheck eq $passcode)	{
   	  	$name = substr ($name, $codelength);
   	  }
   }
   else {
      &error(no_name);
   }

	if ($FORM{'email'} =~ /.+\@.+\..+/) {
		$email = "$FORM{'email'}";
	} else {
		&error(bad_email);
	}


   if ($FORM{'subject'}) {
      $subject = "$FORM{'subject'}";
      $subject =~ s/\&/\&amp\;/g;
      $subject =~ s/"/\&quot\;/g;
   }
   else {
      &error(no_subject);
   }

   if ($FORM{'body'}) {
      $body = "$FORM{'body'}";
      $body =~ s/\cM//g;
      $body =~ s/\n\n/<p>/g;
      $body =~ s/\n/<br>/g;

      $body =~ s/\&lt;/</g; 
      $body =~ s/\&gt;/>/g; 
      $body =~ s/\&quot;/"/g;
   }
   else {
      &error(no_body);
   }


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

Date: 24 Feb 1999 12:29:21 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: 23_skidoo@geocities.com
Subject: Re: help! can anyone spot an error in this code?
Message-Id: <m3d82zn21a.fsf@joshua.panix.com>

23_skidoo <23_skidoo@geocities.com> writes:

> i don't have access to the error logs on the server which is a total
> pain.

It's more than a pain, it's an impossible situation.  Change ISPs.

In the meantime...

> is there a way i can get an error 500 to tell me something more
> productive?  (reference to a module plenty if such a thing exists).

   perldoc CGI::Carp

   use CGI::Carp 'fatalsToBrowser';

>    if ($FORM{'name'}) {
>       $name = "$FORM{'name'}";

Why are you copying $FORM{name} into $name?  You don't seem to be
using $FORM{name} for anything else.  Why are there pops around
'name'?  Why are there quotes around "$FORM{name}"?

>       $name =~ s/"//g;
>       $name =~ s/<//g;
>       $name =~ s/>//g;
>       $name =~ s/\&//g;

   $name =~ tr/<>"&//d;  # much faster, much less typing!

>    	  $codecheck = substr ($name, 0, $codelength); 
> 	  if ($codecheck eq $passcode)	{
>    	  	$name = substr ($name, $codelength);
>    	  }

   $codecheck = $name =~ s/^$passcode//; 

>       $subject =~ s/\&/\&amp\;/g;
>       $subject =~ s/"/\&quot\;/g;

Those backwhacks are superstitious.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Thu, 25 Feb 1999 14:44:39 +0000
From: 23_skidoo <23_skidoo@geocities.com>
Subject: Re: help! can anyone spot an error in this code?
Message-Id: <36D561D5.62E@geocities.com>

Jonathan Feinberg wrote:
> 
> 23_skidoo <23_skidoo@geocities.com> writes:
> 
> > i don't have access to the error logs on the server which is a total
> > pain.
> 
> It's more than a pain, it's an impossible situation.  Change ISPs.

on my isp i have access, this is a client's, they're too cheap to spring
for a proper isp (and they wonder why i don't use my real name in here
:)

> > is there a way i can get an error 500 to tell me something more
> > productive?  (reference to a module plenty if such a thing exists).
> 
>    perldoc CGI::Carp
> 
>    use CGI::Carp 'fatalsToBrowser';

thanks, i'll go read up on that

> >    if ($FORM{'name'}) {
> >       $name = "$FORM{'name'}";
> 
> Why are you copying $FORM{name} into $name?  You don't seem to be
> using $FORM{name} for anything else.  Why are there pops around
> 'name'?  Why are there quotes around "$FORM{name}"?

copying into $name because it's used a lot elsewhere in the script and
it was easier to type. as for the rest, bad habits from using someone
else's code. i think the 's around name were from cutting and pasting
from a print statement. is there any circumstance with hashes where
you'd need either "s or 's around the key?

> 
> >       $name =~ s/"//g;
> >       $name =~ s/<//g;
> >       $name =~ s/>//g;
> >       $name =~ s/\&//g;
> 
>    $name =~ tr/<>"&//d;  # much faster, much less typing!

since reading your post i have looked up tr and found it in Learning
Perl, in your example above, is it doing the same as 

$name =~ /[<>"&]//g;

> 
> >         $codecheck = substr ($name, 0, $codelength);
> >         if ($codecheck eq $passcode)  {
> >               $name = substr ($name, $codelength);
> >         }
> 
>    $codecheck = $name =~ s/^$passcode//;

good point, i wrote that bit but before i knew much about regexs.

> 
> >       $subject =~ s/\&/\&amp\;/g;
> >       $subject =~ s/"/\&quot\;/g;
> 
> Those backwhacks are superstitious.

yeah, i see that now, it's nasty going over scripts you wrote or
modified a few months ago, especially when you're new to perl - those
months make quite a difference :) thanks for your help. 

-23


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

Date: 25 Feb 1999 12:22:10 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: 23_skidoo@geocities.com
Subject: Re: help! can anyone spot an error in this code?
Message-Id: <m3lnhml7p9.fsf@joshua.panix.com>

23_skidoo <23_skidoo@geocities.com> writes:

> is there any circumstance with hashes where you'd need either "s or
> 's around the key?

Yes, if you're using a string literal with spaces in it.

   $h{'key with spaces'} = 'value';

> since reading your post i have looked up tr and found it in Learning
> Perl, in your example above, is it doing the same as 
> 
> $name =~ /[<>"&]//g;

ITYM s/[<>"&]//g and yes, it's "doing the same thing", but tr//d is
quicker.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Thu, 25 Feb 1999 17:52:09 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: help! can anyone spot an error in this code?
Message-Id: <slrn7db2cd.nr4.dragons@Server.Network>

Thu, 25 Feb 1999 14:44:39 +0000 -- 23_skidoo <23_skidoo@geocities.com>:
[snip]
->                          is there any circumstance with hashes where
-> you'd need either "s or 's around the key?

% perl -w-
$a{sin(1)} = "Foo";
$a{'sin(1)'} = "Bar";

for ( keys %a ) {
    print "$_ :: $a{$_}\n";
}
__END__
sin(1) :: Bar
0.841470984807897 :: Foo
%

[snip]
-> since reading your post i have looked up tr and found it in Learning
-> Perl, in your example above, is it doing the same as 
-> 
-> $name =~ /[<>"&]//g;

$name =~ s/[<>"&]//g;

[snip]

Hope This Helps! 

--Matthew


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

Date: Thu, 25 Feb 1999 10:40:12 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: help! can anyone spot an error in this code?
Message-Id: <MPG.113f38e3f0fc96a798968a@nntp.hpl.hp.com>

In article <m3lnhml7p9.fsf@joshua.panix.com> on 25 Feb 1999 12:22:10 -
0500, Jonathan Feinberg <jdf@pobox.com> says...
> 23_skidoo <23_skidoo@geocities.com> writes:
> 
> > is there any circumstance with hashes where you'd need either "s or
> > 's around the key?
> 
> Yes, if you're using a string literal with spaces in it.
> 
>    $h{'key with spaces'} = 'value';

Or, in most cases, any characters that are not alphanumerics.

     $h{foo.bar}

gets errors about barewords if 'use strict;' is in effect (as it should 
be).  This is a concatenation of strings, while 'foo.bar' is a string.  
On the other hand,

     $h{1.0}

works OK (the floating-point number 1.0 gets converted to the string 
'1'.)  The perl DWIMmer does the best it can for you.

> > since reading your post i have looked up tr and found it in Learning
> > Perl, in your example above, is it doing the same as 
> > 
> > $name =~ /[<>"&]//g;
> 
> ITYM s/[<>"&]//g and yes, it's "doing the same thing", but tr//d is
> quicker.

*Much* quicker!

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


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

Date: Thu, 25 Feb 1999 14:59:18 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: help! can anyone spot an error in this code?
Message-Id: <m2a4b7.hu2.ln@magna.metronet.com>

Jonathan Feinberg (jdf@pobox.com) wrote:
: 23_skidoo <23_skidoo@geocities.com> writes:

: > is there any circumstance with hashes where you'd need either "s or
: > 's around the key?

: Yes, if you're using a string literal with spaces in it.

:    $h{'key with spaces'} = 'value';


   That (containing spaces) is one of the bazillion circumstances
   where you need to quote a hash key.

   I think the rule is if it "looks like a (Perl) name", then the
   quotes are optional. ( "name" is described in the first several
   paragraphs of perldata.pod )


   So, these also need quoting even though they contain no spaces:

      $h{'key-with-hyphens'} = 'value';

      $h{'2a'} = 'value';




   I learned something by answering this question!

   In reading perldata.pod, I saw this that I don't remember
   seeing before:

      "Names that start with a digit may contain only more digits."


   So, '23' "looks like" a name, and does not require quoting:

      $h{23} = 'value';


   Cool!


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 26 Feb 1999 03:39:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: help! can anyone spot an error in this code?
Message-Id: <7b550t$73r$1@client2.news.psi.net>

Tad McClellan (tadmc@metronet.com) wrote on MMIV September MCMXCIII in
<URL:news:m2a4b7.hu2.ln@magna.metronet.com>:
?? Jonathan Feinberg (jdf@pobox.com) wrote:
?? : 23_skidoo <23_skidoo@geocities.com> writes:
?? 
?? : > is there any circumstance with hashes where you'd need either "s or
?? : > 's around the key?
?? 
?? : Yes, if you're using a string literal with spaces in it.
?? 
?? :    $h{'key with spaces'} = 'value';
?? 
?? 
??    That (containing spaces) is one of the bazillion circumstances
??    where you need to quote a hash key.
?? 
??    I think the rule is if it "looks like a (Perl) name", then the
??    quotes are optional. ( "name" is described in the first several
??    paragraphs of perldata.pod )


Leaving out the quotes is very convenient, but it can have some pitfalls
as well. Some time ago, I had some code mysteriously failing. I had
written:

         if (!exists $hash {id}) {
             ....
         }

which is valid Perl code, and won't trigger any compile or runtime
warnings or errors. However, that code should have been:

         if (!exists $hash {$id}) {
             ....
         }




Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


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

Date: 26 Feb 1999 01:26:55 GMT
From: NOSPAMjroy@Eng.Sun.COM
Subject: Help, stop memory leak
Message-Id: <7b4t8v$rs7$1@engnews2.Eng.Sun.COM>
Keywords: perl, nt4.0 sql6.5


Hi,

	I hope someone out there can help me. I'm running a
	200Mhz pc, 128MB ram with the following software:
	
	windows nt4 service pack 1a
	sql server 6.5
	internet information server 2.0
	activestate's perl 507 distribution
	
	I'm running into what appears to be a memory leak
	problem. I'm using perl scripts to access and
	manipulate data in an mssql database through the
	web. After about a day's activity of access, the
	process "inetinfo" use up >50% of system memory.
	At this point, I can no longer access my web page,
	let alone the data in the database.
	
	When I reboot the system and inetinfo memory usage
	is back down to 6M, everything is ok again. Until
	it uses up the memory again. Upon further inspection,
	I notice that each time I run my perl script through
	CGI, the number of handles used by inetinfo jumps
	by 3-4 and never goes back down. Subsequently each
	time I access the perl script the number of handles
	inreases. Eventually, inetinfo will use up several
	thousand handles and all heck breaks loose.
	
	My question is this is: Is this normal? If not,
	how do I force IIS to release the handles? Can 
	this be done through perl? Or am I looking at
	this incorrectly?
	
	Thanks in advance.

regards,
roy

	ps, to reply directly remove the NOSPAM text in the
	email address.




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

Date: Sun, 21 Feb 1999 20:59:42 +0100
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: Help,,, (Apache server)
Message-Id: <36D065AE.7847F47D@xs4all.nl>

I think I know what you've done wrong.
I think you always set the location of perl this way: #!/usr/bin/perl
If you are working with Win95. That must different. Then it must be:
#!c:\path\to\perl.exe


Bababozorg wrote:

> hi
> i installed apache web server in my comp but i cant make it read the cgi or
> perl scripts it just give me 500 Internal Server Error every time i run the
> scripts.
> i think i have to write the address or perl.exe somewhere but i dont know where
> to write that
> can you help me please
> thanks
> hamed



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

Date: Tue, 23 Feb 1999 19:42:09 GMT
From: johns@thetech.org
Subject: Re: Help,,, (Apache server)
Message-Id: <7av0af$srr$1@nnrp1.dejanews.com>

Try putting the perl executable in your path.  Then you can refer to it as
#! perl

(I have also heard that you can avoid the shebang line altogether on Win32
platforms, but I have never tried it.)


I have used this extensively on Win95 and NT platforms.  Also, as others have
mentioned, be sure that you have the cgi directory and alias properly set in
the httpd.conf file. ex:

#
ScriptAlias /cgi-bin/ "c:/apache/cgi-bin/"

#
# "c:/apache/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "c:/apache/cgi-bin">
    AllowOverride None
    Options None
</Directory>


-- Good luck, and I hope this helps!





In article <MPG.113a541060db8099989a69@nntp.hpl.hp.com>,
  lr@hpl.hp.com (Larry Rosler) wrote:
> In article <36D065AE.7847F47D@xs4all.nl> on Sun, 21 Feb 1999 20:59:42
> +0100, Frank de Bot <debot@xs4all.nl> says...
> > I think I know what you've done wrong.
> > I think you always set the location of perl this way: #!/usr/bin/perl
> > If you are working with Win95. That must different. Then it must be:
> > #!c:\path\to\perl.exe
>
> No, that cannot be the problem, because this path is not used in the
> Windows/DOS environment.  All that is honored from that line are the
> execution flags (such as '-w'), if any.
>
> > Bababozorg wrote:
> >
> > > i installed apache web server in my comp but i cant make it read the cgi
or
> > > perl scripts it just give me 500 Internal Server Error every time i run
the
> > > scripts.
> > > i think i have to write the address or perl.exe somewhere but i dont know
where
> > > to write that
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Company
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>

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


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

Date: Sun, 21 Feb 1999 17:34:47 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help,,, (Apache server)
Message-Id: <MPG.113a541060db8099989a69@nntp.hpl.hp.com>

In article <36D065AE.7847F47D@xs4all.nl> on Sun, 21 Feb 1999 20:59:42 
+0100, Frank de Bot <debot@xs4all.nl> says...
> I think I know what you've done wrong.
> I think you always set the location of perl this way: #!/usr/bin/perl
> If you are working with Win95. That must different. Then it must be:
> #!c:\path\to\perl.exe

No, that cannot be the problem, because this path is not used in the 
Windows/DOS environment.  All that is honored from that line are the 
execution flags (such as '-w'), if any.

> Bababozorg wrote:
> 
> > i installed apache web server in my comp but i cant make it read the cgi or
> > perl scripts it just give me 500 Internal Server Error every time i run the
> > scripts.
> > i think i have to write the address or perl.exe somewhere but i dont know where
> > to write that

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


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

Date: Sun, 21 Feb 1999 22:23:40 -0500
From: "Allan M. Due" <Allan@Due.net>
Subject: Re: Help,,, (Apache server)
Message-Id: <k54A2.436$986.6218@nntp1.nac.net>

Larry Rosler wrote in message ...
:In article <36D065AE.7847F47D@xs4all.nl> on Sun, 21 Feb 1999 20:59:42
:+0100, Frank de Bot <debot@xs4all.nl> says...
:> I think I know what you've done wrong.
:> I think you always set the location of perl this way: #!/usr/bin/perl
:> If you are working with Win95. That must different. Then it must be:
:> #!c:\path\to\perl.exe
:
:No, that cannot be the problem, because this path is not used in the
:Windows/DOS environment.  All that is honored from that line are the
:execution flags (such as '-w'), if any.


    Oddly enough it is used in this instance.  Frankly I know why, but Apache
requires the correct path to perl in the #! line or it won't execute the perl
script.  It is a common place to stub your toe because you get so used to it
not being required in the Windoze environment.
    In the above post the c:\ is not require if Apache and perl are on the
same drive and the lean of the \ is not important, and the .exe extension is
not important but the correct directory must be specified.

AmD
[posted and emailed]





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

Date: Thu, 25 Feb 1999 12:38:02 +0100
From: Hauschke@t-online.de (Petra Hauschke)
Subject: Re: HELP: CGI.pm/perlmod forgets data?!?
Message-Id: <36D5361A.7055B11D@t-online.de>

Rudolf Potucek schrieb:
> 
> Hi!
> 
> I have a pretty complex script that uses apache/perlmod and CGI.pm (as
> included in RH5.2) and exploits the fact that global data will be retained.
> The problem  is that on one of the subsequent calls the
> 
>  $myobj = new(CGI)
> 
> just looses some of the data that it should get from the calling form.
> The odd part is, it seems to be loosing only some checkboxes ...
> 
> Any suggestions
> 
>  a) what the problem might be or
>  b) how to conveniently trace what is REALLY passed to the script?
> 
> Thx,
> 
>   Rudolf
> 
> --
Hi.
I am far from a Perl expert, but what may be happening is that, under
perlmod/CGI.pm, what are normally "global" variables are in fact not so
(that's a weak explanation).
If there are several copies of your script running (likely under
Apache), then somehow 1 copy of the script accesses the "global" vars
of the other, and that's making life interesting...
Suggestion : instead of using global vars, define your global vars in a
"Package", and reference them as $Package::variable instead of just
$variable.
Example (check the syntax)

Beginning of CGI scripts
 ...
{ # curly brace to start package block
Package X;  # to declare "global" vars
my $Var1;
my $Var2;
} # curly brace ends package

$X::Var1 = "something";  # instead of just $Var1

etc...

Another suggestion : read carefully the documentation of perlmod, it
explains this much better than I can.


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

Date: Tue, 23 Feb 1999 09:40:36 +0100
From: Ismael Olea <iolea@tsai.es>
Subject: HELP: getopt
Message-Id: <36D26984.262049DF@tsai.es>


        Hi!

        I'm very new to perl. I've order nmy Camel Book for this week
but I
need to work now. How can I get command line options? If you give me the
name of the command I can read about it at online docs.

        Thanks in advance.
-- =


	Ismael Olea
	TSAI, =C1rea Sistemas, Unix tlf. 91-7548748

	iolea@tsai.es	olea@iname.com


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

Date: 23 Feb 1999 08:37:54 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: HELP: getopt
Message-Id: <slrn7d5bph.n9e.clay@panix.com>

On Tue, 23 Feb 1999 09:40:36 +0100, Ismael Olea <iolea@tsai.es> wrote:

>
>        I'm very new to perl. I've order nmy Camel Book for this week
>but I
>need to work now. How can I get command line options? If you give me the
>name of the command I can read about it at online docs.

@ARGV

-- 
Clay Irving <clay@panix.com>
Don't confuse the water with the pump. 
- Tom Wolfe 



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

Date: 23 Feb 1999 16:24:27 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: HELP: getopt
Message-Id: <slrn7d5lml.t50.fl_aggie@enso.coaps.fsu.edu>

On Tue, 23 Feb 1999 09:40:36 +0100, Ismael Olea <iolea@tsai.es> wrote:

+ need to work now. How can I get command line options? If you give me the
+ name of the command I can read about it at online docs.

Gosh, it wouldn't happen to be something like, oh, say, getopts? ;)

perldoc Getopt::Std
perldoc Getopt::Long

I think they're included in the standard distribution. If not, then
consult:

perldoc CPAN

James


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

Date: 23 Feb 1999 21:12:39 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: HELP: getopt
Message-Id: <7av5k7$k3$1@gellyfish.btinternet.com>

On Tue, 23 Feb 1999 09:40:36 +0100 Ismael Olea wrote:
> 
>         Hi!
> 
>         I'm very new to perl. I've order nmy Camel Book for this week
> but I
> need to work now. How can I get command line options? If you give me the
> name of the command I can read about it at online docs.
> 

Getopt::Std

/J\
-- 
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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