[12021] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5621 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 10 18:07:37 1999

Date: Mon, 10 May 99 15:00:18 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 10 May 1999     Volume: 8 Number: 5621

Today's topics:
    Re: Can Perl? <aqumsieh@matrox.com>
    Re: email attachment <gellyfish@gellyfish.com>
    Re: File Uploading <swarren@www.wwwdotorg.org>
    Re: File::Find non-functional when passing arguments to (Bart Lateur)
    Re: How much RAM for Perl from CGI??? <edatwork@REMSPAMinternethut.com>
    Re: how to setup cgi <emschwar@rmi.net>
    Re: how to setup cgi <gellyfish@gellyfish.com>
    Re: how to setup cgi <mark@RemoveThismtwells.demonRemove.co.uk>
    Re: how to setup cgi <mark@RemoveThismtwells.demonRemove.co.uk>
    Re: How to tie hash to file <jdporter@min.net>
    Re: Making executables from .pl files? <swarren@www.wwwdotorg.org>
        Module Dependancies and older Perl Releases (Text::Quer (Charles R. Thompson)
    Re: Need a little looping help <swarren@www.wwwdotorg.org>
    Re: Passing Args to script via web and command line <gellyfish@gellyfish.com>
    Re: PERL Searching Strings <swarren@www.wwwdotorg.org>
    Re: regular expression question <aqumsieh@matrox.com>
    Re: Searching a directory for certain HTML files. (Tad McClellan)
    Re: Warnings about uninintialised variables despite use <swarren@www.wwwdotorg.org>
    Re: why won't this cgi script work? (Tad McClellan)
    Re: why won't this cgi script work? <Care227@ibm.net>
    Re: why won't this cgi script work? (Bart Lateur)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 10 May 1999 16:27:56 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Can Perl?
Message-Id: <x3yr9oo8yb8.fsf@tigre.matrox.com>


sowmaster@juicepigs.com (Bob Trieger) writes:

> Uri Guttman <uri@sysarch.com> wrote:
> >>>>>> "DA" == David Allen <dallen@goldsboro.net> writes:
> >
> >  DA> Hey Folks, I know you can rerite Perl in the C language.  Can it
> >  DA> be done in anyway with Pascal?
> >
> >can you rewrite that in the english language?
> 
> I think he wants the perl kernel ritten[sic] in Pascal because he wants 
> to install it and has a Pascal compiler but no C compiler.

Perl doesn't have a kernel.

Ala



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

Date: 10 May 1999 19:33:20 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: email attachment
Message-Id: <7h7ca0$ft$1@gellyfish.btinternet.com>

On Mon, 10 May 1999 17:24:09 +0100 David Craig wrote:
>>MIME::Lite is available from CPAN the documentation that comes with it has
> 
> 
> Thanks for that, I found it and the documentation, I am having difficulty
> extracting the module.  The instructions for use I guess are on a UNIX
> machine - I'm running WIN32.  Do you have the module to hand that you could
> mail me?
> 

Er.  If you are using a recent ActiveState Perl then you will be able to
use PPM to install it which is by far the best thing to do ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.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: Mon, 10 May 1999 21:47:38 GMT
From: "Stephen Warren" <swarren@www.wwwdotorg.org>
Subject: Re: File Uploading
Message-Id: <_tIZ2.322$%j4.1079@news.rdc1.sfba.home.com>

Jukka Juslin <jtjuslin@spam.cc.hut.fi> wrote in message
news:37372D8D.CCD6FB3C@spam.cc.hut.fi...
> Alex wrote:
> >
> > Hi, please help,
>
> #!/usr/bin/perl
>
> $directory = "/home/httpd/html";
> $filename = "test.txt";
>
> open(OUTFILE,">$directory$filename") || &error($!);
>
> while($bytesread=read($fileorig,$buffer,$ENV{'CONTENT_LENGTH'})) {
>             binmode OUTFILE;
>             print OUTFILE $buffer;
>         }
> close(OUTFILE);

Um. This would be 'A Bad Thing' security-wise, I think...

BTW, Where does $fileorig come from?

--
Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
mailto:swarren@techhouse.com                http://www.techhouse.com/
mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
              MIME, S/MIME and HTML mail are acceptable





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

Date: Mon, 10 May 1999 21:05:36 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: File::Find non-functional when passing arguments to &wanted
Message-Id: <373848e1.506957@news.skynet.be>

Andrew Allen wrote:

>No, it's doing exactly what you want. How obvious would you need the
>syntax to be before the warning is squelched? Would \(&foo(3))
>suffice? Or would you insist upon \scalar(&foo(3))

	sub foo { shift };
	print \foo;     # undef
-> SCALAR(0x13b1e0)
	print \foo(3);  # 3
-> SCALAR(0x13b1e0)
	print \&foo(3); # 3
-> SCALAR(0x13b1e0)
	print \&foo;
-> CODE(0xffc12238)

Well there's a bizarre exception alright. "&foo" is the only syntax that
returns a code ref, WITHOUT excuting the sub. The others all return a
reference to the value returned by the sub call.

I think that's not right. I personally think that anything (dubious)
inbetween

	print \(&foo(3));
-> function call, reference to result

and

	print &foo;
-> no function call, but reference to sub

should give a warning. BTW these two do as I describe.

	Bart.


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

Date: Mon, 10 May 1999 16:37:25 -0400
From: Ed Eddington <edatwork@REMSPAMinternethut.com>
Subject: Re: How much RAM for Perl from CGI???
Message-Id: <37374385.5706FDA3@REMSPAMinternethut.com>

> If your Perl program does some kind of database interfacing, or other
> memory intensive stuff, then you could perhaps write a large daemon Perl
> program, with each of the CGI instances simply interfacing to the
> daemon?

It does in a way. The CGI opens a socket to another machine with a
running daemon. So, it is slow, but doesn't seem to be a burden on the
web server. 

The Perl script itself doesn't use any modules except for Socket. I am
trying to calculate how many simultaneous users it could handle based on
RAM utilization. 

I have scoured through documentation and FAQ's trying to find a "number"
of how much RAM the perl interpreter itself uses when called by CGI. I
remember seeing it somewhere.

Through some load testing I can see the Perl process on the web server
(handling ALL the CGI requests) grow from 1.2 Mb (with one CGI running)
to about 14 Mb, but I can't really tell how many simultaneous CGI's are
running at the time.

The web server is Apache on AIX Unix. Perl 5.004. 

Appreciate any tips. Thanks!

Ed


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

Date: 10 May 1999 14:11:58 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: how to setup cgi
Message-Id: <xkfaevcn0q9.fsf@valdemar.col.hp.com>

"Mark Twells" <mark@RemoveThismtwells.demonRemove.co.uk> writes:
> David Efflandt <efflandt@xnet.com> wrote:
> > This subject is unrelated to Perl.  It sounds like a webserver
> > configuation problem.  Please direct such questions to a newsgroup related
> > to your webserver
> 
> Ta.
> My ISP doesn't provide one.

Nu, we should answer your C questions, because your ISP doesn't provide
comp.lang.c?

Sheesh.

Ask your ISP to carry it.  If they won't (seems unlikely, given who they
are), then get a better ISP.  Or use DejaNews, which will let you post
for free.

-=Eric


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

Date: 10 May 1999 21:27:30 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to setup cgi
Message-Id: <7h7j02$1ii$1@gellyfish.btinternet.com>

On Mon, 10 May 1999 20:30:31 +0100 Mark Twells wrote:
> 
> Kent Perrier <kperrier@blkbox.com> wrote in message
> news:ysiogk8vhq4.fsf@blkbox.com...
>> mk@best.com (mk) writes:
>>
>> This is not a perl related question.  The is a cgi/server configuration
> related
>> question.
> Gee , thanks!
> 
> 
>> comp.infosystems.www.authoring.cgi
>> comp.infosystems.www.servers.*
> 
> Some of us don't get those ngs...and are left with the same problem.
> 

I cannot believe that Demon dont take groups in the comp.infosystems.*
hierarchy.  Out of some 40,000+ groups they dont take those, Hmm we'll
see.

> How do we configure perl to work with MS PWS - I've put entries in the
> registry which "look" correct, but the server hangs on these.
> Could some kind soul please EMAIL me (since it's not a perl question we
> MUSTn't clutter up this NG) the correct entries for the registry?
> 

I cant mail you because there appears to be something wrong with your
email address.

If you have a recent ActiveState Perl then you will have an ActivePerl
group in your Start Menu - this has a link to the HTML documentation
where there is a very comprehensive document regarding the configuration
of various Windows HTTP servers to work with Perl.  I know it has working
instructions for the configuration of PWS.

If you look at <http://www.btinternet.com/~gellyfish/docs/map.html> you
will find the relevant documentation from MS regarding configuring the
registry entries for a 'Script Map'.

Anyhow for being a troll and lying about your newsfeed :

*plonk*

/J\
-- 
Jonathan Stowe <jns@gellyfish.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: Mon, 10 May 1999 22:42:42 +0100
From: "Mark Twells" <mark@RemoveThismtwells.demonRemove.co.uk>
Subject: Re: how to setup cgi
Message-Id: <926372614.9186.0.nnrp-12.c3ad4005@news.demon.co.uk>


Eric The Read <emschwar@rmi.net> wrote in message
news:xkfaevcn0q9.fsf@valdemar.col.hp.com...
> Nu, we should answer your C questions, because your ISP doesn't provide
> comp.lang.c?

Thank you for your helpful reply.





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

Date: Mon, 10 May 1999 22:42:26 +0100
From: "Mark Twells" <mark@RemoveThismtwells.demonRemove.co.uk>
Subject: Re: how to setup cgi
Message-Id: <926372601.9173.0.nnrp-12.c3ad4005@news.demon.co.uk>


Charles R. Thompson <design@raincloud-studios.com> wrote in message
news:MPG.11a1016b1521f618989685@news...
> BTW.. as usual I find it hard to believe
> comp.infosystems.www.authoring.cgi is not available while this NG being a
> few steps up the information food chain is.

Thank you for your helpful posting and short sig.





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

Date: Mon, 10 May 1999 19:50:26 GMT
From: John Porter <jdporter@min.net>
Subject: Re: How to tie hash to file
Message-Id: <7h7da1$gaj$1@nnrp1.deja.com>

In article <002401be9b0c$19e60390$01454580@digity>,
  "Jason Vardzel" <jv25@andrew.cmu.edu> wrote:
> I am trying to understand how to take data from a text file (or any
other
> type of file) and load it into a hash. I then update the hash and save
it
> back to the file upon completion.  If the file did not previously
exist I
> create a new one and save a new hash to this file after it is updated.
>
> I am trying to do this via
> tie (%myHash, SomeClass, $myFile)
> or something similar.  As I understand it, this greatly simplifies
file
> updating and retrieval, etc.  The problem is that I am new to all of
this as
> cannot figure out how to get the tie to work right.  What module(s)
might
> you suggest to do this?  As I understand it, there are additional ones
> needed.  Any example code would be greatly appreciated.

You do not need to use any modules for this (although you do at least
need a package).  However, modules such as Tie::Hash and Tie::StdHash
can make your life easier.  Below is a simple module I wrote which
does what you're looking for.  Note, it does not update the file each
time you change a value in the hash; rather, it updates the file when
the hash is untied (which is when the variable goes out of scope, if
you don't call untie).


package PersistentHash;

use Tie::Hash;
@PersistentHash::ISA = qw( Tie::StdHash );

use Fcntl qw(:DEFAULT :flock);
use Data::Dumper;

# keep the filenames here, and maybe other stuff:
my %hash_params;

sub TIEHASH {
  my $pkg = shift;
  my $filename = shift;
  my $self = {};
  if ( sysopen F, $filename, O_RDONLY ) {
    local $/;
    my $s = <F>;
    close F;
    eval $s;
  }
  # fail silently if the file can't be opened for reading.
  bless $self, $pkg;
  $hash_params{$self} = {
    'filename' => $filename,
  };
  return $self;
}

sub DESTROY {
  my $self = shift;
  local *OUT;
  my $filename = $hash_params{$self}{'filename'};
  if ( sysopen OUT, $filename, O_WRONLY|O_CREAT|O_TRUNC, 0666 ) {
    flock OUT, LOCK_SH; # for writing
    local $Data::Dumper::Indent = 0;
    local $Data::Dumper::Purity = 1;
    print OUT Data::Dumper->Dump( [ $self ], [ 'self' ] );
    close OUT;
  }
  else {
    warn "open $filename for write: $!";
  }
}


Then you can do this:
{
  my %info;
  tie %info, 'PersistentHash', "$path/$file";
  # get and set elements of the hash
}
# %info goes out of scope, gets untied; data get written to file.



--
John Porter
Put it on a plate, son.  You'll enjoy it more.


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Mon, 10 May 1999 21:22:41 GMT
From: "Stephen Warren" <swarren@www.wwwdotorg.org>
Subject: Re: Making executables from .pl files?
Message-Id: <B6IZ2.320$%j4.1090@news.rdc1.sfba.home.com>

<smnayeem@my-dejanews.com> wrote in message
news:7h638m$l66$1@nnrp1.deja.com...
> In article <slrn7jcsp8.ms8.chris@holly.dyndns.org>,
>   chris@holly.dyndns.org (Chris Costello) wrote:
> >    Plus, of course, with perlcc, you can create your own binary
> > executable!
>
> hmm where can i find this perlcc? i checked the activeperl
> documentation, all it has is perl2exe but that never gave me the right
> exes, well it gives me an exe but i cant ever run it if i use any
> modules, it just says cant locate such and such modules and aborts.

Not that I've ever used it, but it sounds like you need to:

a) Use some other command-line options to get around it (read docs)
b) Distribute those modules with the .exe file (and probably setup the
'module path' correctly)

--
Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
mailto:swarren@techhouse.com                http://www.techhouse.com/
mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
              MIME, S/MIME and HTML mail are acceptable





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

Date: Mon, 10 May 1999 20:54:29 GMT
From: design@raincloud-studios.com (Charles R. Thompson)
Subject: Module Dependancies and older Perl Releases (Text::Query::Advanced example)
Message-Id: <MPG.11a11241937655b4989686@news>

This is a two-parter.

1) Is it common practice to *say* that a Module requires a certain 
version of Perl because the author just happens to be using that 
particular version when they release/write it?

I've found that CGI.pm for 5.004 works perfectly fine on a 5.003_02 
release as far as file uploads and form decoding. There may be something 
in there that breaks.. I haven't encountered it in the six months I've 
been flipping about with it. Ditto for CGI_Lite. Very few modules I've 
tried have bombed on me.

I'm using 5.004_004 with 1 registered patch, but many of my target 
machines are 5.003_02 with 2 security patches or similar. Quite a few of 
the hosting providers I encounter seem to settle on a version that they 
can get stable and secure for them and only upgrade after a rather long 
tire-kicking test by the Inet community. So meanwhile I have to find ways 
to put square pegs in round holes (often deleteing the require statement 
and just steamrolling along).

2) Eric Bohlman? Do you mind popping into this? Instead of reinventing 
the wheel, I'd much rather use your Text::Query::Advanced module for my 
search script. What limitations are really there for this module on an 
older release? The newest says the requirement is 5.005. Is that *really* 
true, or does it fall in the range of question 1?

Side Note:
Personally, if a module ran on previous releases, I think it would be 
rather helpful to have the versions listed in the module docs with a 
brief synopsis on backwards compatibility. 

For instance...

Compatible with 
5.005
5.004
5.003_2 - blah method will be non-functional with this release.
5.002 and under - What are you? A caveman? Forget about it.
-- 
Charles R. Thompson
RainCloud Studios
"That? That's no script. That's your attempt at a rather complex README 
file."


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

Date: Mon, 10 May 1999 21:20:55 GMT
From: "Stephen Warren" <swarren@www.wwwdotorg.org>
Subject: Re: Need a little looping help
Message-Id: <X4IZ2.318$%j4.1099@news.rdc1.sfba.home.com>

Dave Evans <devans@radius-retail.kom> wrote in message
news:7h72sf$2s9m2@news.gomontana.com...
> Jeez, if you can't be bothered to respond to a particular query, then
don't!
> At least rebuff nicely.

But why - the original poster basically said:

paraphrased:
>>>I need help.
>>>Here's some partially-random code that probably isn't quite what I need
help with.

It was sufficiently complicated code that it required a little though as to
what the actual intention was, hence making spotting even simple errors that
much harder. A better request would have included a description of the
requirements too so people could think up good ways of doing it, rather than
having to reverse-engineer them...

--
Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
mailto:swarren@techhouse.com                http://www.techhouse.com/
mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
              MIME, S/MIME and HTML mail are acceptable





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

Date: 10 May 1999 20:15:34 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Passing Args to script via web and command line
Message-Id: <7h7ep6$i3$1@gellyfish.btinternet.com>

On Mon, 10 May 1999 22:00:01 +0300 Jukka Juslin wrote:
> Derek Boss wrote:
>> 
>> Can a perl cgi script, which gets it data from a webpage, also be set up
>> to accept input from a command line??
>> 
> 
> While running the script in offline mode from command line you can for
> sure give arguments and the press ctrl+d.
> 

That does rather assume he is using CGI.pm - which is of course what most
people recommend.

/J\
-- 
Jonathan Stowe <jns@gellyfish.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: Mon, 10 May 1999 21:59:45 GMT
From: "Stephen Warren" <swarren@www.wwwdotorg.org>
Subject: Re: PERL Searching Strings
Message-Id: <lFIZ2.323$%j4.1009@news.rdc1.sfba.home.com>

Mike Gibson <mgibson@newbridge.com> wrote in message
news:37370CD7.76CFBFF7@newbridge.com...
> if(($a{'managername'} eq $in{'manager'}) || ($a{'managername'} =~
> /^$in{'manager'}/i))
>
> The above line is what I am using to search my manager name field for
> the string entered in my form text box.  It works fine by searching by
> firstname.  My managername field contains the firstname then a space and
> then the lastname.  Is there any way that I could change this line so
> that it will search the lastname part of the managername instead of the
> first part.  Thanks.

Yes. You'd do well to read 'perldoc perlre'.

Something like the following:

if ( ( $a{'managername'} eq $in{'manager'}     ) ||
     ( $a{'managername'} =~ /^$in{'manager'}/i ) ||
     ( $a{'managername'} =~ /$in{'manager'}$/i )    # This line
   )

Some possible problems with your code:

If the user enters 'abc' and $a{'managername'} contains 'abcdef', it will
still match. This may be what you want.

A problem with my code:

If the user enters 'abc' and $a{'managername'} contains 'defabc', it will
still match. This probably isn't what you want.

To fix either of these, you need to anchor your regexes a little more, by
putting space ('\w') into your //.

Do you really want a general substring search? Maybe you should just do:

if ( $a{'managername'} =~ m/$in{'manager'}/ )

Then it will find whatever the user entered anywhere...

--
Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
mailto:swarren@techhouse.com                http://www.techhouse.com/
mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
              MIME, S/MIME and HTML mail are acceptable





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

Date: Mon, 10 May 1999 16:32:07 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
To: Rafe Colburn <rafeco@rc3.org>
Subject: Re: regular expression question
Message-Id: <x3ypv488y48.fsf@tigre.matrox.com>


Rafe Colburn <rafeco@rc3.org> writes:

>  I'm using this regular expression to parse some code (specifically to
> extract variable names and types):
>  
> code =~ /(procedure\s+(\w+)\s*\(.*\))/gi
>  
>  it matches this:
>  
> procedure register(name in varchar2)
>  
> but not this:
>  
> procedure waitone(name in varchar2, 
>                   message out varchar2, 
>                   status out integer,
>                   timeout in number default maxwait)
>  
>   The code is all in one huge string.  Do I have to tell it something
> special to get it to cross line feeds?  I thought that the .* would
> just do it.

No ... the dot, by default, does not match newline characters in a
string. You must override this behaviour using the /s modifier. 

	/(procedure\s+(\w+)\s*\(.*\))/sig;

Of course, this solution was right in front of you the whole time,
sitting very close to the top of the perlre documentation. Have a look
at it.

HTH,
Ala



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

Date: Mon, 10 May 1999 11:18:56 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Searching a directory for certain HTML files.
Message-Id: <0dt6h7.cqc.ln@magna.metronet.com>

Donny Simonton (donsimon@bellsouth.net) wrote:
: I'm trying to search a directory for only certain HTML files with the name
: Image in them.  So for example I want to list Image1.html, but not
: index.html.

: I know I can use this to list all of the files.

: opendir(DIR, "$serverpath/$docpath");
: @htmlFiles = grep(/\.html$/,readdir(DIR));
: closedir(DIR);

: Any ideas on just specific file names?


   If you want files that contain "Image" AND end with ".html",
   they you write a pattern for grep that matches when the
   filename contains "Image" AND ends with ".html".


      @htmlFiles = grep(/Image.*\.html$/,readdir(DIR))


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


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

Date: Mon, 10 May 1999 21:35:07 GMT
From: "Stephen Warren" <swarren@www.wwwdotorg.org>
Subject: Re: Warnings about uninintialised variables despite use strict
Message-Id: <fiIZ2.321$%j4.1082@news.rdc1.sfba.home.com>

<tertullian@my-dejanews.com> wrote in message
news:7h6gr8$tlb$1@nnrp1.deja.com...
> Hi all, I have a program (sub004.cgi) beginning ...
>
> #!/usr/bin/perl  -dw
> use strict;
>
> ...(snip)
>
> Actually I'm confused anyway because by saying "use strict;" aren't I
> being forced to declare all variables using "my"?

Declare, possibly, but not *initialize*:

----cut
#!/usr/local/bin/perl -w

use strict ;

my $x ;

print $x . "\n" ;
----cut

See what happens when you run the above, v.s. the below:

----cut
#!/usr/local/bin/perl -w

use strict ;

my $x = 1 ;

print $x . "\n" ;
----cut

--
Stephen Warren, Snr Systems Engineer, Technology House, San Francisco
mailto:swarren@techhouse.com                http://www.techhouse.com/
mailto:swarren@wwwdotorg.org                http://www.wwwdotorg.org/
              MIME, S/MIME and HTML mail are acceptable





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

Date: Mon, 10 May 1999 11:25:47 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: why won't this cgi script work?
Message-Id: <rpt6h7.cqc.ln@magna.metronet.com>

Justin S. (kidjustino@chesco.com) wrote:
: i've been working on this counter script, but i can't get it to work, why?


   I'm pressing my forehead against my CRT...

   ...

   ... it's just not coming through.

   What does "i can't get it to work" mean to you?


   Won't compile?

   Won't execute?

   Doesn't increment the value in the file?

   Increments the value in the file too much?

   Increments the value in the file too little?

   Sometimes "resets" itself?

   Doesn't count right.

   Locks up, never returns.

   Returns right away but doesn't do anything.

   ... a few dozen others...

   

: #!/usr/bin/perl

   You should always enable warnings.

   Let perl help you find common mistakes.

       #!/usr/bin/perl -w



: open(COUNT, "count.dat");

   You should always check the return value from open() calls.

   You should not _ask_ for variable interpolation and backslash
   escapes (by using double quotes) unless you are going to _use_
   variable interpolation or backslash escapes.


      open(COUNT, 'count.dat') || die "could not open 'count.dat'  $!";



: $count = <COUNT>;
: close (COUNT);
: open(COUNT, "> count.dat");

   You should always check the return value from open() calls.

      open(COUNT, '> count.dat') || die "could not open 'count.dat'  $!";

: $count += 1;
: print COUNT "$count";
: close (COUNT);

: print "$count";
        ^      ^
        ^      ^

   Those double quotes serve no purpose.


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


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

Date: Mon, 10 May 1999 17:15:56 -0400
From: Drew Simonis <Care227@ibm.net>
Subject: Re: why won't this cgi script work?
Message-Id: <37374C8C.F0C6F383@ibm.net>

I bet he get's an error 500 from the browser...

You need to print the HTTP Header and a newline BEFORE anything else.  


And, while I'm here, why are you reading a file into a scalar?


-Drew


Bart Lateur wrote:
> 
> Justin S. wrote:
> 
> >i've been working on this counter script, but i can't get it to work, why?
> 
> Is this intended as a CGI? It doesn't print a http header.
> 
>         Bart.


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

Date: Mon, 10 May 1999 21:41:07 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: why won't this cgi script work?
Message-Id: <37375256.148077@news.skynet.be>

Drew Simonis wrote:

>And, while I'm here, why are you reading a file into a scalar?

Surely, the file contains just a number...

	Bart.


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

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

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