[8867] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2484 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 3 15:06:15 1998

Date: Sun, 3 May 98 12:01:42 -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           Sun, 3 May 1998     Volume: 8 Number: 2484

Today's topics:
        Perl script doesn't work <unk@webcom.com>
    Re: Perl script doesn't work (Hakan Hjelmstrom)
    Re: Perl script doesn't work <rootbeer@teleport.com>
    Re: Perl script doesn't work (Jonathan Stowe)
    Re: Randomly sorting an array (Mark-Jason Dominus)
    Re: regex help - Follow-up <rjk@coos.dartmouth.edu>
    Re: Serial port ... again <rootbeer@teleport.com>
        Simple Perl Databases <mike@emporium-antiques.co.uk>
    Re: Simple Perl Databases (Hakan Hjelmstrom)
        Thanks, guys <unk@webcom.com>
    Re: Use of Uninitialized Value rpearce@fastlane.net
    Re: Use of Uninitialized Value <rjk@coos.dartmouth.edu>
        Y2K and Perl (Mark Manning)
    Re: Y2K and Perl <webmaster@fccjmail.fccj.org>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 03 May 1998 09:44:21 -0700
From: Unk <unk@webcom.com>
Subject: Perl script doesn't work
Message-Id: <354C9EE5.52E@webcom.com>

I have a perl script on my server that doesn't work when run directly
from Netscape, it just spawns a message box that says "Document contains
no data".

Note that this script runs fine when run explicitly with perl5.  (The
first line in the script explicitly runs perl5).

The permissions of the script are as follows

% ls -l shredwrist.cgi
-rwxr-xr-x  1 bchapman  mosaic  342 May  2 22:40 shredwrist.cgi

Note that I have other scripts with identical permissions in the same
directory that run just fine from Netscape.
Note I am trying to run the thing as a different user than the owner or
group.  For some reason this works with other files with the same
permissions.

This script is at

    http://www.best.com/~bchapman/cgi/shredwrist.cgi

If you want to see the Perl source, I copied it to an identical file

    http://www.best.com/~bchapman/cgi/shredwrist.txt

so you can view it.

My return e-mail address here works: please cc it in your reply.

Thanks,
Unk


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

Date: Sun, 03 May 1998 18:27:33 GMT
From: hawk@algonet.se (Hakan Hjelmstrom)
Subject: Re: Perl script doesn't work
Message-Id: <354fb704.16419439@news.algonet.se>

On Sun, 03 May 1998 09:44:21 -0700, in comp.lang.perl.misc you wrote:
> I have a perl script on my server that doesn't work when run directly from 
> Netscape, it just spawns a message box that says "Document contains no data".
>     http://www.best.com/~bchapman/cgi/shredwrist.txt so you can view it.

You're missing a newline in the header.
Also, I can't seem to spot the closing BODY or HTML tags, 
but these usually are very rare in Perl :-)

Hekan Hjelmstrvm
hawk@algonet.se


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

Date: Sun, 03 May 1998 18:36:56 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Unk <unk@webcom.com>
Subject: Re: Perl script doesn't work
Message-Id: <Pine.GSO.3.96.980503113611.21603L-100000@user2.teleport.com>

On Sun, 3 May 1998, Unk wrote:

> I have a perl script on my server that doesn't work when run directly
> from Netscape, it just spawns a message box that says "Document contains
> no data".

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sat, 02 May 1998 07:59:45 GMT
From: Gellyfish@btinternet.com (Jonathan Stowe)
Subject: Re: Perl script doesn't work
Message-Id: <354ac095.20257273@news.btinternet.com>

On Sun, 03 May 1998 09:44:21 -0700, Unk wrote :

>I have a perl script on my server that doesn't work when run directly
>from Netscape, it just spawns a message box that says "Document contains
>no data".
>
>Note that this script runs fine when run explicitly with perl5.  (The
>first line in the script explicitly runs perl5).
>

Well I took a cursory grant at your code.  You should check out the
specifications for HTTP and CGI.  You should also be using CGI.pm
which comes with a wealth of excellent documentation  which would
prevent the mistake with the "Content-Type" header. 

When you have a problem with a CGI application and it works correctly
from the command line as yours would (the CGI module will help with
this) it is unlikely that it is a problem relating to Perl.  There is
a newsgroup that deals with CGI issues specifically.  However you
might want to check out the variety of resources available at:

<URL:http://reference.perl.com/query.cgi?cgi>

/J\
Jonathan Stowe
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>



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

Date: 3 May 1998 11:27:48 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Randomly sorting an array
Message-Id: <6ii2dk$72q$1@monet.op.net>
Keywords: adieu codebreak staple worthwhile

In article <6iff37$2ir$1@monet.op.net>, Mark-Jason Dominus <mjd@op.net> wrote:
>We found that this runs somewhat faster if you insert
>
>	next if $i == $j;

Now that I've said this, I can't figure out what the circumstances
were that made this benchmark faster than the version without, and I
can't find a version where adding this line seems to help.  That's
puzzling, because I remember that the speedup was significant.  But
I'd better withdraw my advice.






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

Date: Sun, 03 May 1998 14:35:40 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: regex help - Follow-up
Message-Id: <354CB8FD.5AD88F52@coos.dartmouth.edu>

Bill 'Sneex' Jones wrote:
> 
> Bill 'Sneex' Jones wrote:
> >
> > Ronald J Kimball wrote:
> >
> > > /(^|[^.])(identifier)/
> >
> > I found this this morning and played around with different strings.
> > Except for the start of a string, all matches return an extra
> > character.  Is this caused by the  [^.]   ?

[That message hasn't shown up on my news server yet, so I'll reply to it here.]

I'm not sure what you mean by "all matches return an extra character".

If you just want the substring matched by (identifier), use $2.  Or, if you're
doing the match in a list context and only want to get the substring matched
by (identfier), then change (^|[^.]) to (?:^|[^.]).

> It is.  But when I do
> my $strTest = 'This is a line. It is line 11.';
> 
> print $strTest =~ /(^|[^.][^.])(\.)/, " :  First Match\n";
> $strTest = $';
> print $strTest =~ /(^|[^.][^.])(\.)/, " : Second Match\n";

I have no idea what you are trying to show with that code.  It does exactly
what I would expect it to do.

> Is there a way to matched 'embedded' ##. strings?

I don't know what you mean by "'embedded' ##. strings".

> Regardless of where they appear in the string/glob?

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 03 May 1998 16:52:47 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Pablo Hortal <mcai3ph2@ist4.co.umist.ac.uk>
Subject: Re: Serial port ... again
Message-Id: <Pine.GSO.3.96.980503095214.21603H-100000@user2.teleport.com>

On 3 May 1998, Pablo Hortal wrote:

> There have been many messages about how to write to / read from a serial
> port ... but no one has actually provided any code that works ... or at
> least I haven't found it. 

If the code in the FAQ doesn't work, you should debug it and let the FAQ
maintainers know. Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 03 May 1998 17:08:18 -0700
From: Mike Brown <mike@emporium-antiques.co.uk>
Subject: Simple Perl Databases
Message-Id: <354D06F1.34EB2DB8@emporium-antiques.co.uk>

Has anybody successfully utilised the "Simple" Perl database, as
illustrated in the Perl Database Tutorial by James Brent Michalski
http://www.inlink.com/~perlguy/simple/
on a server running WindowsNT.

My programming skills are limited with some experience in dbase, and
this is driving me crazy. Have visited all the usual perl sites and
yesterday purchased $120 worth of perl ref books. But I think I'm trying
to run before I can walk.

I have installed the system and with some tweaking have managed to add
records to the database but am unable to get the search option working.

You can see my efforts on:
http://www.antiques-directory.co.uk/add.htm
and
http://www.antiques-directory.co.uk/search.htm

Any help would be appreciated.
--
Best regards,
Mike Brown
Emporium Antiques, Southwold
Email:  mike@emporium-antiques.co.uk
Web site: http://www.emporium-antiques.co.uk/




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

Date: Sun, 03 May 1998 18:15:55 GMT
From: hawk@algonet.se (Hakan Hjelmstrom)
Subject: Re: Simple Perl Databases
Message-Id: <354cb1bb.15067395@news.algonet.se>

On Sun, 03 May 1998 17:08:18 -0700, Mike Brown wrote:
> Has anybody successfully utilised the "Simple" Perl database, as
> illustrated in the Perl Database Tutorial by James Brent Michalski
> http://www.inlink.com/~perlguy/simple/ on a server running WindowsNT.

I've tried it on my NT4 Workstation and it worked out just fine. I
actually think I've run it using both the ActiveState and GS Perl
binaries.

> But I think I'm trying to run before I can walk.

Personally, I feel like I'm crawling at times...
Anyhow, what kind of errors do you get?

Hekan Hjelmstrvm
hawk@algonet.se


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

Date: Sun, 03 May 1998 11:45:12 -0700
From: Unk <unk@webcom.com>
Subject: Thanks, guys
Message-Id: <354CBB38.4895@webcom.com>

As per your advice, I put

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

instead of

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

and that did the trick.

Thank you very much!

Unk


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

Date: Sun, 03 May 1998 10:28:15 -0600
From: rpearce@fastlane.net
Subject: Re: Use of Uninitialized Value
Message-Id: <6ii2eg$qpg$1@nnrp1.dejanews.com>

That was it.  The upper subscript for the array was one less than the total
count of entries ($SIZE).  The <= operator tried to read upto $SIZE, which was
null, so it saw that as an udefined value.  Cool.  I also added an exit html
output...it seemed to want that.

Thanks Tad,

Rick...


In article <i71hi6.7bf.ln@localhost>#1/1,
  tadmc@flash.net (Tad McClellan) wrote:

>
> : open(FILE,"$directory") || die "Can't Open $directory: $!\n";
> : @LINES=<FILE>;				#open input file and read
lines
> : close(FILE);				# into an array.
> : $SIZE=@LINES;      			#number of lines in file
>
> So, if there where 20 lines, then $SIZE (ack! UPPERCASE is, well, just
yucky)
> will have the value '20' in it.
>
> @LINES has 20 values in it. Subscripted from 0-19...
>
> : $c=0;     				#initialize email-found counter
>
> : for ($i=0;$i<=$SIZE;$i++) {         #read each line of the input file
>                ^
>                ^
> Danger Will Robinson. You have one too many characters in your
> program. I hate it when that happens.
>
> Take that one out, and all will be well.
>
> You're walking past the end of the 20 elements...
>
> :  $_ = $LINES[$i];
> :   if(/mailto:(.*)"/i) {            	#grab text between 'mailto:' and a "
>
> --
>     Tad McClellan                          SGML Consulting
>     tadmc@metronet.com                     Perl programming
>     Fort Worth, Texas
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 03 May 1998 14:47:40 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: rpearce@fastlane.net
Subject: Re: Use of Uninitialized Value
Message-Id: <354CBBCD.1694DC99@coos.dartmouth.edu>

[posted and mailed]

rpearce@fastlane.net wrote:
> 
> $SIZE=@LINES;                           #number of lines in file
> 
> for ($i=0;$i<=$SIZE;$i++) {         #read each line of the input file
>  $_ = $LINES[$i];
>  if(/mailto:(.*)"/i) {                 #grab text between 'mailto:' and a "

$SIZE contains the number of elements in @LINES, which is one greater than the
index of the last element.  Thus, when $i equals $SIZE, then $LINES[$i] is
past the end of the array.  So, you are attempting to do a pattern match on an
undefined value.

Note that the line
  if(/mailto:(.*)"/i) {
does not contain any use of $1, and thus the unitialized value warning cannot
be referring to that variable.  The only variable being used in that line is $_.

Change $i<=$SIZE to $i<$SIZE in the for loop, and your code will work.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Sun, 03 May 1998 10:23:52 -0600
From: markem@flash.net (Mark Manning)
Subject: Y2K and Perl
Message-Id: <markem-0305981023520001@houasc4-182.flash.net>

I posted this to the MacPerl list but Matthias did not let it through. 
(Which is ok by me - it's his list.  :-) )

Anyway, I've been doing a lot of reading about the Year 2000 (Y2K) problem
and I was wondering if anyone who may be working on this problem has also
been using Perl to find the problem spots.  Just interested is all - not
doing any kind of research or anything.  TIA!  :-)


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

Date: Sun, 03 May 1998 18:26:49 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: Y2K and Perl
Message-Id: <354CB52F.5447857F@fccjmail.fccj.org>

Mark Manning wrote:
> 
> I posted this to the MacPerl list but Matthias did not let it through.
> (Which is ok by me - it's his list.  :-) )
> 
> Anyway, I've been doing a lot of reading about the Year 2000 (Y2K) problem
> and I was wondering if anyone who may be working on this problem has also
> been using Perl to find the problem spots.  Just interested is all - not
> doing any kind of research or anything.  TIA!  :-)

Yes.  I have been using Perl to find 'problem spots' in other
peoples COBOL code.  Which is where MOST of the Y2k issues lay.

Those blasted 'packed' data elements keep getting in the way...

:-)
-Sneex- 
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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

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