[12588] in Perl-Users-Digest
Perl-Users Digest, Issue: 6188 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 1 07:07:24 1999
Date: Thu, 1 Jul 99 04:00:21 -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 Thu, 1 Jul 1999 Volume: 8 Number: 6188
Today's topics:
BrowseEntry, need help <gpasq@es-tls.sps.mot.com>
Re: Copying Lines to File (elephant)
Re: Copying Lines to File (John Caldwell)
Re: Copying Lines to File (Iain Chalmers)
Re: differentiate btw big-endian machine and small-endi <garethr@cre.canon.co.uk>
interger overflow like in C <ank@elcat.kg>
Re: make my day fix an array :-) <thomas@bibsyst.no>
Re: make my day fix an array :-) <pkg@studbox.uni-stuttgart.de>
Re: Making things go "BEEP!" (David Efflandt)
Re: MX record validation (David Efflandt)
Re: Net Use in Perl under NT <c4jgurney@my-deja.com>
Re: Net Use in Perl under NT <gellyfish@gellyfish.com>
Re: passing hash to subroutine <m.grimshaw@music.salford.ac.uk>
Re: Perl Problem with Netscape, but not lynx... (David Efflandt)
Re: perl, htaccess, authorization (David Efflandt)
Perl/CGI seems an inconsistant language... <thite@mindspring.com>
Re: Perl/CGI seems an inconsistant language... <martin@adoma.se>
Re: Picture doesn't appear <nospam.newton@gmx.net>
Re: Problem Installing Tk 8.000.14 - make => line too l <s.grififths@virgin.net>
Re: regex to match RCS string <Tim.Potter@anu.edu.au>
Re: Regular Pattern Matching <JFedor@datacom-css.com>
Re: Should I use fetchrow_hashref for this? <garethr@cre.canon.co.uk>
Re: Spell Checker <gellyfish@gellyfish.com>
use posix <ged@fortec.tuwien.ac.at>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 01 Jul 1999 10:32:25 +0200
From: Guillaume Pasquier <gpasq@es-tls.sps.mot.com>
Subject: BrowseEntry, need help
Message-Id: <377B2799.E61BC087@es-tls.sps.mot.com>
hi,
I'm a french newbie and have a question about the BrowseEntry :
How can i test and add a new entry if a user write a new entry instead
of chosing one in the liste ?
(is it with -Browsecmd ? )
if you have an exemple, thanks.
Guillaume PASQUIER
email : gpasq@es-tls.sps.mot.com
------------------------------
Date: Thu, 1 Jul 1999 18:00:35 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Copying Lines to File
Message-Id: <MPG.11e5cb2f2f43307b989ad2@news-server>
rt_daemon@my-deja.com writes ..
>I am a novice.
>I would like to know how could I possibly read a file and start copying
>lines to another file until a certain line. Here's an example.
>
>Text, Text
><!--Start-->
>....................
>....................
>....................
>....................
><!--End-->
>More Text
>
>Copy everything between Start and End to another file.
there might be a better way of doing this with one of the File:: modules
.. but I don't know .. here's how to do it with normal perl .. obviously
this will take as much memory as the file is large
#--begin
{
local $/;
undef $/;
open( IN, "<fileNameHere");
$blah = <IN>;
close( IN);
$blah =~ m/<!--Start-->(.*)<!--End-->/sg;
open( OUT, ">outFileNameHere");
print OUT $1;
close( OUT);
}
#--end
--
jason - remove all hyphens for email reply -
------------------------------
Date: 1 Jul 1999 01:33:02 -0700
From: jcald@gti.veedub.nu (John Caldwell)
Subject: Re: Copying Lines to File
Message-Id: <slrn7nma3c.5pn.jcald@gti.veedub.nu>
In article <MPG.11e5cb2f2f43307b989ad2@news-server>, elephant wrote:
>rt_daemon@my-deja.com writes ..
>>I am a novice.
>>I would like to know how could I possibly read a file and start copying
>>lines to another file until a certain line. Here's an example.
>>
>>Text, Text
>><!--Start-->
>>....................
>>....................
>>....................
>>....................
>><!--End-->
>>More Text
>>
>>Copy everything between Start and End to another file.
>
>there might be a better way of doing this with one of the File:: modules
>.. but I don't know .. here's how to do it with normal perl .. obviously
>this will take as much memory as the file is large
>
>#--begin
>{
> local $/;
> undef $/;
>
> open( IN, "<fileNameHere");
> $blah = <IN>;
> close( IN);
>
> $blah =~ m/<!--Start-->(.*)<!--End-->/sg;
>
> open( OUT, ">outFileNameHere");
> print OUT $1;
> close( OUT);
>}
>#--end
>
yeah, thats feasible if the ammount of data in between the start and end blocks
is small... nested loops seem to be the best way:
MAIN: while (<IN>) {
next if (!/<!--Start-->/);
while (<IN>) {
last MAIN if (/<!--End-->/);
print OUT $_; # who knows, might not even need the $_
}
}
note the label on the first while loop.. this is so you can break completely out
when you're in the nested loop. otherwise a 'last' will just get you out of the
inner loop.
--
----------------------
/ John Caldwell /
/ jcald@veedub.nu /
/ There is no spoon. /
----------------------
------------------------------
Date: Thu, 01 Jul 1999 18:42:19 +1000
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: Copying Lines to File
Message-Id: <bigiain-0107991842190001@bigman.mighty.aust.com>
In article <MPG.11e5cb2f2f43307b989ad2@news-server>,
e-lephant@b-igpond.com (elephant) wrote:
> rt_daemon@my-deja.com writes ..
> >I am a novice.
> >I would like to know how could I possibly read a file and start copying
> >lines to another file until a certain line. Here's an example.
> >
> >Text, Text
> ><!--Start-->
> >....................
> >....................
> >....................
> >....................
> ><!--End-->
> >More Text
> >
> >Copy everything between Start and End to another file.
>
> there might be a better way of doing this with one of the File:: modules
> .. but I don't know .. here's how to do it with normal perl .. obviously
> this will take as much memory as the file is large
>
> #--begin
> {
> local $/;
> undef $/;
>
> open( IN, "<fileNameHere");
> $blah = <IN>;
> close( IN);
>
> $blah =~ m/<!--Start-->(.*)<!--End-->/sg;
>
> open( OUT, ">outFileNameHere");
> print OUT $1;
> close( OUT);
> }
> #--end
eeeewww "local"? no checking results of open?
how about:
#!usr/perl -w
use strict;
my $mode=0;
open(IN,"filename")||die $!;
open(OUT,">newfilename")||die $!;
while(<IN>){
$mode=1 if /^<!--START-->/;
$mode=0 if /^<!--END-->/;
print OUT $_ if $mode;
}
doesn't need so much ram (for big files), and deals with multiple
instances of the delimiters...
big
------------------------------
Date: Thu, 1 Jul 1999 10:38:11 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
To: bennycc@pacific.net.sg
Subject: Re: differentiate btw big-endian machine and small-endian machine
Message-Id: <siaetgwt7w.fsf@cre.canon.co.uk>
bennycc@pacific.net.sg wrote:
> How can I differentiate between big and small endian machines in my
> code?
The documentation for `pack' in the `perlfunc' manpage says:
$foo = pack("s2",1,2);
# "\1\0\2\0" on little-endian
# "\0\1\0\2" on big-endian
--
Gareth Rees
------------------------------
Date: 30 Jun 1999 07:14:37 GMT
From: Andrey Kolotev <ank@elcat.kg>
Subject: interger overflow like in C
Message-Id: <7lcg4t$5td$1@alpha.elcat.kg>
Dear Friends!
Can you explain, how can I get the same behavior of interger arithmetics in
perl as I have in "C"; I mean that when I add 2 big numbers (for example
0xfffffff1 + 0xff) in perl I get ffffffff for operation 'printf "%x",
0xfffffff1 + 0xff)' or 4294967536 for 'printf "%s", 0xfffffff1 + 0xff)', but
in "C" i get 000000f0.
I can't find it in perlfaq or in others documents.
Thanks.
--
Andrey Kolotev
------------------------------
Date: Thu, 01 Jul 1999 10:43:35 +0200
From: Thomas Weholt <thomas@bibsyst.no>
To: Uri Guttman <uri@sysarch.com>
Subject: Re: make my day fix an array :-)
Message-Id: <377B2A37.6921EE8A@bibsyst.no>
>
> duh!!
>
Can`t you answer one posting without being an a**h**e? I`ve read almost every
reply you have given and they all contain some stupid, non-constructive remarks.
I don`t understand why you have the strange need to behave like such an arrogant
know-it-all in every thing you do in this group. You are most probably a great
perl-hacker, but a supportive tutor-like, guru-could-be you`re most definitly
not.
Yours truly
--
-------------------------------------------------
| Thomas Weholt |_.|._| |
| Email : thomas@bibsyst.no <-|-> |
-------------------------------------------------
------------------------------
Date: Thu, 01 Jul 1999 12:50:31 +0200
From: Pete Gilbert <pkg@studbox.uni-stuttgart.de>
Subject: Re: make my day fix an array :-)
Message-Id: <377B47F7.57ED6539@studbox.uni-stuttgart.de>
"Mr. Dave" wrote:
>
> This is a snippet of a data file that my script will work on
>
> =casper64= Jun 10 00:45:42, dane
> =maddog= Jun 10 00:54:15, dane
> =casper64= Jun 10 00:56:12, jamesgr
>
> Any one know an efficiant way to eliminate lines that have the same
> =user= and are within one minute of each other? Keep in mind the array
> might me as large as 800 or more elements! If I sort the array (=user=
> will be in ABC order) I have a subroutine that can eliminate entries
> within a minute of each other. But I need the entries in chronological
> order....
not sure about efficiency, but an idea:
- sort on a function that, sorts by name first, then by date if the
names are the same. producing:
=casper64= Jun 10 00:45:42, dane
=casper64= Jun 10 00:56:12, jamesgr
=maddog= Jun 10 00:54:15, dane
- shift or otherwise remove all entries from one user, pass them through
your sub, and push
the cleaned up result onto another array. if you destroy the original a
piece at a time, you shouldn't gobble to much memory unnecessarily.
--
Pete Gilbert *** email: pkg@studbox.uni-stuttgart.de
------------------------------
Date: 1 Jul 1999 10:03:13 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Making things go "BEEP!"
Message-Id: <slrn7nmf2k.l7.efflandt@efflandt.xnet.com>
On Thu, 01 Jul 1999 15:05:50 +1000, Iain Chalmers
<bigiain@mightymedia.com.au> wrote:
>
>> How would one go about making a script produce an audible signal like the bell
>> of a PC speaker. I have several needs for this. My most urgent is a small
>> network monitoring script that I would like to put in CRON and when port X is
>> not responding my server will produce an audible alert.
>
>have you triedthis:
>
>print chr(7);
>
>I didn't really expect it to work on my mac under macperl, but it does!
>
>Also works under mklinux too, the only other handy test machine i have.
That works from the Linux console, but not in xterm and unlikely from
cron since there is no terminal there.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: 1 Jul 1999 09:38:59 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: MX record validation
Message-Id: <slrn7nmdl5.l7.efflandt@efflandt.xnet.com>
On Mon, 28 Jun 1999 05:33:15 +0000, David L. Nicol <david@kasey.umkc.edu> wrote:
>
>This issue is not dealt with at
>
>http://language.perl.com/newdocs/pod/perlfaq9.html#How_do_I_send_mail_
>
>Who has a good method for validating an e-mail domain exists?
>
>I'm looking for something tighter than
>
>sub GoodMXp($){my $hostname=shift;
> my $digreply=`(dig +pfmin $hostname; dig MX +pfmin $hostname)|grep -v
>^\;\;`;
> $digireply =~ m/\S/s and return 1;
> return 0;
>};
>
>________________________________________________________________________
> David Nicol 816.235.1187 UMKC Network Operations david@news.umkc.edu
> "multiple valid approaches exist"
This may not be tighter and is slightly un-perl related (using sendmail),
but verifies an e-mail address using sendmail and if opening sendmail
fails, at least checks if the domain exists using gethostbyname(). This
is part of a subroutine that also checks other fields from a submitted
form using CGI.pm (function-oriented). $errmsg is null if all is well:
if ($reqd eq "email") {
$errmsg = "Localhost not allowed here'
if lc($reqd) =~ /[@]localhost/;
my $success = param($reqd).'... deliverable';
if (open(MAIL,"$sendmail -bv ".param($reqd)." 2>&1 |")) {
my $result = <MAIL>;
close MAIL; # probably should check $? too
$errmsg = $result unless $result =~ /$success/;
} elsif (param($reqd) =~ /^([^@]+)[@](\w[^\.]*\..+)$/) {
scalar(gethostbyname $2)
|| $errmsg = 'Invalid email domain';
} else {
$errmsg = 'Invalid email address';
}
}
However, in at least one case when sendmail got a response from the
destination that it was "deliverable", actual e-mail bounced with "mail
loops back to itself" (they have a DNS problem with their domain so I was
trying an alternate name for that IP that did resolve). So the only true
way to tell is to send e-mail and see if it bounces.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: Thu, 01 Jul 1999 08:21:10 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: Net Use in Perl under NT
Message-Id: <7lf8dg$80v$1@nnrp1.deja.com>
In article <377A41C3.427A1EE3@Image.dk>,
Peter Skyttegaard Andreasen <Peter.Skyttegaard@Image.dk> wrote:
> I'm writing a small Perl script to collect data from a number of
servers
> in an NT network.
<snip>
> Usually I would map the drive using a System call on the NT NetBios
> command:
>
> net use k: \\server\share
>
Is there anything stopping you from accessing the file directly using
//$server/share/filename ?
Jeremy Gurney
SAS Programmer | Proteus Molecular Design Ltd.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 1 Jul 1999 10:08:57 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Net Use in Perl under NT
Message-Id: <377b3029@newsread3.dircon.co.uk>
Peter Skyttegaard Andreasen <Peter.Skyttegaard@Image.dk> wrote:
> I'm writing a small Perl script to collect data from a number of servers
> in an NT network.
> The data to be collected will be stored in a shared directory having the
> same name on all servers - in this case share.
> The list of servers will be stored in a seperate file servers.txt and
> the perl script will go though a loop for each line (server) in this
> list. Sofar no problem.
> Usually I would map the drive using a System call on the NT NetBios
> command:
>
> net use k: \\server\share
>
You might want to consider using the module Win32::NetResource to add
the connection rather than shell out to the external command.
/J\
--
"Conservatives have called on Sports Minister, Tony Banks, to resign
after calling William Hague a foetus" - BBC News Website
------------------------------
Date: Thu, 01 Jul 1999 10:12:23 +0100
From: Mark Grimshaw <m.grimshaw@music.salford.ac.uk>
Subject: Re: passing hash to subroutine
Message-Id: <377B30F7.55B8E439@music.salford.ac.uk>
That's done it Ian - thanks very much.
"I.J. Garlick" wrote:
> In article <3779E1D8.9D6EDF91@music.salford.ac.uk>,
> Mark Grimshaw <m.grimshaw@music.salford.ac.uk> writes:
> > Dear all,
> >
> > sub getdata
> > {
> > $db = '/music/studio/jobs/jobsdb';
> > if(!tiedb(\%DB, $db, O_RDONLY, 0444))
> ^^^^
> [snipped]
> > sub tiedb
> > {
> > my(%D, $dbb, $modea, $modeb) = @_;
> ^^
> Shouldn't that be a scalar since your passing a reference?
>
> my($D, $dbb, $modea, $modeb) = @_;
>
> >
> > if(!tie(%D, DB_File, $dbb, $modea, $modeb))
> ^^
> which would make this
>
> if(!tie(%{$D}, DB_File, $dbb, $modea, $modeb))
>
> I think. (I haven't tried this but according to everything I have read
> that should be how to dereference a ref to a hash).
>
> > {
> > return 0;
> > }
> > return 1;
> > }
> >
> > exit;
>
> Also you might want to try writing the sub like this
>
> sub tiedb
> {
> my($D, $dbb, $modea, $modeb) = @_;
>
> (tie(%{$D}, DB_File, $dbb, $modea, $modeb)) || return;
> return 1;
> }
>
> Most find it more readable. (agian untried, probably get told off for this
> :-) )
>
> --
> Ian J. Garlick
> ijg@csc.liv.ac.uk
>
> The seven deadly sins ... Food, clothing, firing, rent, taxes,
> respectability and children. Nothing can lift those seven milestones
> from man's neck but money; and the spirit cannot soar until the
> milestones are lifted.
> -- George Bernard Shaw
------------------------------
Date: 1 Jul 1999 10:39:07 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Perl Problem with Netscape, but not lynx...
Message-Id: <slrn7nmh5t.l7.efflandt@efflandt.xnet.com>
On Thu, 01 Jul 1999 05:59:00 GMT, illiath@my-deja.com
<illiath@my-deja.com> wrote:
>I'm just starting to learn perl/cgi programming, and I've got a small
>problem here.
>
>I have written a small script (it doesn't do all it's supposed to do but
>that's not important really), and it displays fine (when using lynx),
>but netscape refuses to display it at all.
>
>Everything else seems to be saying it is fine, If I ask netscape to
>display the source of the page (the output from the script), it displays
>the source code properly.
This is likely an html problem, not a Perl problem. Are you using CGI.pm?
Does anything blink at you when you view source in Netscape? You likely
forgot to escape a quote or other special character or are missing an end
tag for some element (like </table> or </form>). Post a URL to the script
on a suitable newsgroup (not this one).
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: 1 Jul 1999 10:17:57 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: perl, htaccess, authorization
Message-Id: <slrn7nmfu3.l7.efflandt@efflandt.xnet.com>
On Tue, 22 Jun 1999 18:50:13 GMT, pweck@ixc.net <pweck@ixc.net> wrote:
>Hi,
>
>I have just added .htaccess and .htpasswd to certain directories that i
>want to protect. When a user runs a script from these protected
>directories, they are presented with a box to enter username and
>password. My original purpose for protection was so that the scripts
>would be safe from being copied etc...not to restrict access to using
>the scripts.
>
>What do i need to do to keep the directories password protected, but at
>the same time allow the scripts in those directories to be accessed? Is
>there something that i can add to the scripts and/or html documents that
>can do this?
This has nothing to do with Perl. The source of a CGI cannot be read from
the web unless you make it available (either as a mistake or by making it
alternately by linking or copying the source to a filetype that your
webserver considers to be plain text). So there is no need to password
protect a directory to protect source scripts.
Of course if your webserver is run as 'nobody' and your scripts are not
suid (cgiwrap or apache suexec option) then local users can probably still
access the source of your scripts, if not directly from the shell (755
permission), then from their own CGI (if 705 permission).
Direct any further questions on this issue to a suitable newsgroup for
cgi or your webserver.
--
David Efflandt efflandt@xnet.com http://www.xnet.com/~efflandt/
http://www.de-srv.com/ http://cgi-help.virtualave.net/
------------------------------
Date: Thu, 01 Jul 1999 02:07:13 -0700
From: T Hite <thite@mindspring.com>
Subject: Perl/CGI seems an inconsistant language...
Message-Id: <377B2FC1.5EBB844@mindspring.com>
--------------97CDBD6C62299DB5CF081BD0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hi all,
A coworker said that perl was great and that I should use it.
But I'm finding what seems to be a number of inconsistancies
in the language. Here is an example:
An HTML file in Linux/Apache in the folder - /usr/httpd/html
that is called "sayit.html":
<html>
<body>
<form method="POST" action="/cgi-bin/sayit">
<input type="submit" value="OK! run /cgi-bin/sayit">
</form>
</body>
</html>
All this does is run the sayit perl script in the cgi-bin.
This is the perl script that works differently, depending on
whether you are running it from the console or running it
thru CGI. Here is the 1st file called "sayit".
#!/usr/bin/perl
$datenow = `date`;
$sayit2 = `sayit2`; // our 2nd perl script that never gets
called thru CGI
// but IS called when run under
the console.
$headers = "Content-type: text/html\n\n\n";
$printout = "$headers $datenow $sayit2";
print "$printout";
print "$sayit2";
A 2nd perl script called by the above:
#!/usr/bin/perl
$newdate = `date`;
print "\n<br>$newdate";
If I invoke the /cgi-bin/sayit command from Linux I would get
the following print out:
[root@localhost cgi-bin]# sayit
Content-type: text/html
Thu Jul 1 00:58:06 PDT 1999
<br>Thu Jul 1 00:58:06 PDT 1999
<br>Thu Jul 1 00:58:06 PDT 1999
[root@localhost cgi-bin]#
This is exactly what would be expected. However, if I run
the HTML file above thru the Apache 1.3 web server running
under RedHat Linux 5.2, then I get different results:
By going to my webbrowser at "http://localhost/sayit.html",
I get the form button that says, "OK! run /cgi-bin/sayit".
If I click that button, I don't get the expected printout of
several dates as in the console session. Instead,
I only get 1 date. The call to another Perl module looks
like it was never called.
What is going on in Perl's little head? Why would a cgi-bin
work differently than working from the console?
Many thanks for any help understanding this problems.
Tom Hite
thite@mindspring.com
--------------97CDBD6C62299DB5CF081BD0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hi all,
<p>A coworker said that perl was great and that I should use it.
<br>But I'm finding what seems to be a number of inconsistancies
<br>in the language. Here is an example:
<p>An HTML file in Linux/Apache in the folder - /usr/httpd/html
<br>that is called "sayit.html":
<blockquote><html>
<br><body>
<br><form method="POST" action="/cgi-bin/sayit">
<br><input type="submit" value="OK! run /cgi-bin/sayit">
<br></form>
<br></body>
<br></html></blockquote>
All this does is run the sayit perl script in the cgi-bin.
<p>This is the perl script that works differently, depending on
<br>whether you are running it from the console or running it
<br>thru CGI. Here is the 1st file called "sayit".
<blockquote>#!/usr/bin/perl
<br>$datenow = `date`;
<br>$sayit2 = `sayit2`; // our 2nd perl script that never gets called
thru CGI
<br>
// but IS called when run under the console.
<br>$headers = "Content-type: text/html\n\n\n";
<br>$printout = "$headers $datenow $sayit2";
<br>print "$printout";
<br>print "$sayit2";</blockquote>
A 2nd perl script called by the above:
<blockquote>#!/usr/bin/perl
<br>$newdate = `date`;
<br>print "\n<br>$newdate";</blockquote>
If I invoke the /cgi-bin/sayit command from Linux I would get
<br>the following print out:
<ul>[root@localhost cgi-bin]# sayit
<br>Content-type: text/html
<p> Thu Jul 1 00:58:06 PDT 1999
<p><br>Thu Jul 1 00:58:06 PDT 1999
<p><br>Thu Jul 1 00:58:06 PDT 1999
<br>[root@localhost cgi-bin]#</ul>
This is exactly what would be expected. However, if I run
<br>the HTML file above thru the Apache 1.3 web server running
<br>under RedHat Linux 5.2, then I get different results:
<p>By going to my webbrowser at "<A HREF="http://localhost/sayit.html">http://localhost/sayit.html</A>",
<br>I get the form button that says, "OK! run /cgi-bin/sayit".
<p>If I click that button, I don't get the expected printout of
<br>several dates as in the console session. Instead,
<br>I only get 1 date. The call to another Perl module looks
<br>like it was never called.
<p>What is going on in Perl's little head? Why would a cgi-bin
<br>work differently than working from the console?
<p>Many thanks for any help understanding this problems.
<p>Tom Hite
<br>thite@mindspring.com
<br>
<br>
<ul>
<br> </ul>
<br>
<br>
<br>
<br>
<br>
<br> </html>
--------------97CDBD6C62299DB5CF081BD0--
------------------------------
Date: Thu, 01 Jul 1999 12:20:12 +0100
From: Martin Quensel <martin@adoma.se>
Subject: Re: Perl/CGI seems an inconsistant language...
Message-Id: <377B4EEC.EC4C7CB4@adoma.se>
[cut...]
>
> If I invoke the /cgi-bin/sayit command from Linux I would get
> the following print out:
>
> [root@localhost cgi-bin]# sayit
> Content-type: text/html
>
> Thu Jul 1 00:58:06 PDT 1999
>
> <br>Thu Jul 1 00:58:06 PDT 1999
>
> <br>Thu Jul 1 00:58:06 PDT 1999
> [root@localhost cgi-bin]#
>
> This is exactly what would be expected. However, if I run
> the HTML file above thru the Apache 1.3 web server running
> under RedHat Linux 5.2, then I get different results:
well, in the first script you print the name of the second script
when run from the console...where does this get printed??
on your command console (screen, whatever)
when called from your web browser, where do you think it gets printed,
it gets printed in your webbrowser.
It would be very odd indeed if you where sitting at your webserver, and
everytime someone klicked a link going to your script, a lot of text
would flash by on your screen..but the person requesting info in his
webbrowser, wouldent get anything.
when run as a CGI your STDOUT, gets redirected to the browser.
maybee you should look at pipes, rather than printing programnames on
STDOUT.
I havent looked at the code above very much, but maybee you should also
try to learn perl, if your above code really works (thinking of the
c++/java comments) without generating a syntax error...then wooohoooo.
besides your problem has nothing to do with perl. same thing would have
happend if you did the same thing in C or C++ or whatever language.
The problem above is due to a poor understanding of CGI...
well now you know...whenever you print something (print "something";)
and run it through a webbrowser, it doesent get printed on your
webservers console, but redirected to whoever asked for it.
Best regards
Martin Quensel
------------------------------
Date: Thu, 01 Jul 1999 11:57:41 +0200
From: "Philip 'Yes, that's my address' Newton" <nospam.newton@gmx.net>
Subject: Re: Picture doesn't appear
Message-Id: <377B3B95.8C12A4FC@gmx.net>
Ronald J Kimball wrote:
>
> That's not valid HTML. You're missing <HTML>, <HEAD>, and <BODY>.
Not to mention <!DOCTYPE....> if he's really going for the "valid"
thingy.
Cheers,
Philip
------------------------------
Date: Thu, 01 Jul 1999 09:36:58 +0100
From: Simon griffiths <s.grififths@virgin.net>
Subject: Re: Problem Installing Tk 8.000.14 - make => line too long
Message-Id: <377B28AA.DF3590CB@virgin.net>
> I had the same problem with VC++ under Windows.
> But if you use ActivePerl, I'd suggest to load the binaries from
> http://www.activestate.com/packages/zips/
> This worked for me.
>
> Andreas
Thanks for this - I've got ActiveState Tk8 on NT4 working fine too !
I'm getting the problem on Dynix/ptx.
But since you had the same problem compiling with VC++, maybe this
is a problem with MakeMaker ! I had thought that maybe the version of
make that comes with Dynix was a bit restricted, but since you've had the
problem as well, then its clearly not platform specific.
I'll raise another thread suggesting that this may be a MakeMaker problem !
Thanks.
Simon.
------------------------------
Date: 01 Jul 1999 18:48:33 +1000
From: Tim Potter <Tim.Potter@anu.edu.au>
Subject: Re: regex to match RCS string
Message-Id: <6yn1xg7o2m.fsf@acronym.anu.edu.au>
abigail@delanet.com (Abigail) writes:
> `` /^(@((@@)|([^@]))*@)$/
> ``
> `` This regex works fine for small strings but for large strings (900
> `` lines at ~40KB) perl crashes with a segmentation fault. Does anyone
> `` have any hints for rewriting this so it actually works? )-:
>
> Which version of Perl is that? Perl shouldn't segfault.
acronym$ perl -v
This is perl, version 5.005_03 built for i386-linux
acsys$ perl -v
This is perl, version 5.005_03 built for sun4-solaris
I've moved my example into a script which I suppose I should mail off
to perl-bugs or something like that.
> I would write it as:
>
> /^@(?:[^@]+|@@)*@$/
>
> which doesn't set a gazillion $DIGITS variables.
I did think of using ?: to avoid the above situation but it didn't
seem to make any difference.
Your regex, however, works and doesn't crash. Thanks muchly!
Tim.
> Abigail
> --
> srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
> //=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
--
Tim Potter, System Admin/Programmer "Disco Stu doesn't advertise"
Advanced Computational Systems CRC, RSISE Bldg Australian National University,
Canberra 0200, AUSTRALIA Ph: +61 2 62798813 Fax: +61 2 62798602
------------------------------
Date: Thu, 1 Jul 1999 05:17:47 -0400
From: "Jody Fedor" <JFedor@datacom-css.com>
Subject: Re: Regular Pattern Matching
Message-Id: <7lf9t2$6pj$1@plonk.apk.net>
Tom Christiansen wrote in message <3779f199@cs.colorado.edu>...
>What's wrong with just using the straight-forward
>
> $value =~ s/.*_//;
>
>--tom
iiiii
Tom, you're so cool! [-oo-]
\ -/
Simplicity at it's finest.
------------------------------
Date: Thu, 1 Jul 1999 10:51:24 GMT
From: Gareth Rees <garethr@cre.canon.co.uk>
Subject: Re: Should I use fetchrow_hashref for this?
Message-Id: <si7lokwslv.fsf@cre.canon.co.uk>
GJohn <gjohn@crossland.com.au> wrote:
> [The DBI] documentation suggests fetchrow_hashref "is currently not
> portable between databases because different databases return field
> names with different letter cases".
The `fetchrow_hashref' method builds a hash whose keys are the column
names. Some database systems have case-sensitive column names, others
have case-insensitive column names. This means that you may write some
code like
$record = $sth->fetchrow_hashref;
if ($record->{city} eq 'London') { ... }
that works fine using database A but fails when the program is ported to
run on database B because the key you need is now 'CITY'.
If you don't plan to port your software between multiple database
systems, or if you don't use literal column names in your code, then
`fetchrow_hashref' is appropriate.
> Also, it says "currently a new hash reference is returned for each
> row. This is likely to change so don't rely on it".
If you want to store the hash for future use, just take a copy. For
example:
while (my $record = $sth->fetchrow_hashref) {
# Take a copy of the record and save it in the @records array.
push @records, { %$record };
}
> I would like to see some example code where all rows are collected
> in hash/array etc, then processed, then printed, ideally using column
> names for access, such as hashref.
http://www.deja.com/getdoc.xp?AN=482428376&fmt=text
--
Gareth Rees
------------------------------
Date: 1 Jul 1999 09:36:19 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Spell Checker
Message-Id: <377b2883@newsread3.dircon.co.uk>
pyammine@my-deja.com wrote:
> Has anybody ever seen or worked with a spell checker with Perl.
> Something that would spell check a users input before saving the data.
>
You could use the module Search::Dict that is part of the standard Perl
distribution.
See <http://www.deja.com/[ST_rn=ps]/getdoc.xp?AN=452749326&fmt=text>
/J\
--
"Philippa Forrester, presenter and would-be Smurf" - Howard Stableford,
Tomorrow's World
------------------------------
Date: Thu, 01 Jul 1999 12:07:29 +0200
From: Georg Edelmayer <ged@fortec.tuwien.ac.at>
Subject: use posix
Message-Id: <377B3DE1.F67E8003@fortec.tuwien.ac.at>
Hi,
I wanted to use the ceil() fnkt in a script and therefore tried to use
POSIX;
Unfortunately perl tells me that the module cannot be found.
Strange enough, as the faq and such tells that posix should be in the
standard distributions.
I'm using the CPAN-port for WIN32 perl 5.004_02
Any help/hints?
Thank you in advance
Georg
------------------------------
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 6188
**************************************