[7452] in Perl-Users-Digest
Perl-Users Digest, Issue: 1077 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 25 10:18:29 1997
Date: Thu, 25 Sep 97 07:00:56 -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, 25 Sep 1997 Volume: 8 Number: 1077
Today's topics:
"exp1 ? exp2 : exp" same as " if (exp1) { exp2; } else <rpedro@pga.pt>
Re: Array or Hash? (Martien Verbruggen)
Re: Assigning Arguments to Script (Bob Wilkinson)
Re: cgi data <creede@worldnet.att.net>
Re: cgi data <rootbeer@teleport.com>
CGI.pm question <eedalf@eed.ericsson.se>
Re: CGI/Perl: Appending Two Associative Arrays <merlyn@stonehenge.com>
Re: Determining if a method is defined for an object (Malcolm Beattie)
Re: dir symlinks don't work? <rootbeer@teleport.com>
Dummy variable - can you avoid it (Helmut Jarausch)
Re: Ellipses in formats <rootbeer@teleport.com>
Re: Foolish Question About Saving Gifs (Bart Lateur)
Re: get DOS perl to ignore EOF/SUB chars (Mike Heins)
Re: Help - Countdown Script Hack. <rootbeer@teleport.com>
Re: incrementing array names <jefpin@bergen.org>
Re: IO::Select and formatted read <gbarr@ti.com>
Perl and html problem <robbert@bicho.eui.upm.es>
Perl crashing RS600 box <mccrann_michael@jpmorgan.com>
Re: Perl crashing RS600 box (Mike Heins)
Q: ctree / perl5 module does it exist? <jurgen@ittpub.nl>
Q: Script to build index of HTML files BY KEYWORD? (LCJ Jacobson)
Re: Question: Finding rgexp list in a second list <rootbeer@teleport.com>
Re: Text::English <rootbeer@teleport.com>
Using sockets with WI N95 <giorgio@lii.unitn.it>
Re: What does the . operator do? <jefpin@bergen.org>
Re: Where is HTTP::Request::Common ? <merlyn@stonehenge.com>
Re: why localize vars in foreach? <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 25 Sep 1997 12:38:45 +0100
From: "Rui S. Pedro" <rpedro@pga.pt>
Subject: "exp1 ? exp2 : exp" same as " if (exp1) { exp2; } else { exp3; }"?
Message-Id: <60dlnr$q16@duke.telepac.pt>
I've started some perl programming two weeks ago and I cannot see what is
causing this problem. I whould appreciate some help.
These two scripts get different outputs:
script1:
1 ? $true+=100 : $false+=100; print "$true\n";
output:
200
script1:
1 ? $true+=100 : ($false+=100); print "$true\n";
output:
100
I'm using version 5.002
Rui S. Pedro
------------------------------
Date: 24 Sep 1997 04:33:20 GMT
From: mgjv@mali.comdyn.com.au (Martien Verbruggen)
Subject: Re: Array or Hash?
Message-Id: <60a56g$ggh$1@comdyn.comdyn.com.au>
In article <Pine.LNX.3.96.970923214123.337A-100000@drews.drews.net>,
Andy Smith <asmith@hsonline.net> writes:
> Why is perl trying to make a hash out of @services? Is there something i
> need to do to make it see the variable as an array instead?
#!/usr/local/bin/perl -w
use strict;
# The above two are always a good idea.
> @services={"witha","smile","anda","one","two",};
This is not an array, but a reference to an anonymous hash.
did you want
my @services = ( 'witha', 'smile', 'anda', 'one', 'two' );
or even
my @services = qw( witha smile anda one two );
?
> open(AFILE ">afile")
open(AFILE, ">afile") or die "Cannot open file afile for writing: $!";
> $n=0;
my $n = 0;
> while($n<5)
> {print AFILE {$services[$n]};
> ++$n
while ( $n < 5 ) # $n < $#services might be what you really want
{
print AFILE $services[$n];
++$n;
}
or even:
foreach (@services)
{
print AFILE $_;
}
if you want them to have spaces or newlines between them, include them
in the print statement;
Apart from all that, your code had a bunch of syntax errors in it, and
unmatched brackets.
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: Thu, 25 Sep 1997 12:11:06 +0100
From: b.wilkinson@pindar.com (Bob Wilkinson)
Subject: Re: Assigning Arguments to Script
Message-Id: <b.wilkinson-2509971211060001@ip57-york.pindar.co.uk>
In article <6065md$sek@agate.berkeley.edu>, dizzy@soda.CSUA.Berkeley.EDU
(David Zeng) wrote:
> Hi, there,
>
> I have a question on how to assign arguments to a Perl script. I understand
> that using <STDIN> is one way for the script to prompt for arguments.
> What if I want to give the script arguments as if it's a built-in shell
> command? For example, I have a script called "foo," and foo takes 2
> arguments "duh" and "blah." I would like to be able to type in
> foo duh blah OR ./foo duh blah
> from the shell and start "foo" with those two arguments. Is there any
> way to design the Perl script to accept this type of arguments. With
> <STDIN>, I only know how to accept arguments by typing "./foo," <enter>,
> then type in the arguments on a new line.
>
> Thanks for any hints and help.
>
> David Zeng
@ARGV holds this list of parameters. The first can be used by referring to
$ARGV[0], and the second by referring to $ARGV[1].
Bob
--
.sig file on holiday
------------------------------
Date: 25 Sep 1997 13:24:40 GMT
From: "Creede Lambard" <creede@worldnet.att.net>
Subject: Re: cgi data
Message-Id: <60domo$sve@bgtnsc02.worldnet.att.net>
Oops. Right you are. That should read:
if ($s =~ /$id/) { . . . code to execute if ID matches . . . }
If that's the biggest mistake I make all day, I'll be happy. :D
brian d foy <comdog@computerdog.com> wrote in article
<comdog-ya02408000R2409971738220001@news.panix.com>...
> In article <60bmsv$ifc@news.microsoft.com>, "Creede Lambard"
<fearless@io.com> wrote:
>
> >Try this ($id is the ID number you're checking for):
> >
> >open (DATA,"data.txt");
> >read (DATA,$s,(-s DATA));
> >close DATA;
> >
> >if ($id =~ /$s/) { . . . code to execute if ID matches . . . }
> >
> >$s contains your entire data file, newlines and all, so if your ID is
> >1234567890, you won't get a match on the off chance you have ID numbers
like
> >this:
>
>
> surely you didn't mean to put the *entire* file into the regex
(especially
> without quoting metacharacters!) remember that whatever you have bound
> to that pattern must match the entire pattern (i.e. if the bound
> thingy, $id in this case, is not long enough to match a minimal pattern,
> then the match will fail. you have the big thingy in the regex and
> the little thingy trying to match it. it is bound to fail. )
>
> --
> brian d foy <comdog@computerdog.com>
> NY.pm - New York Perl M((o|u)ngers|aniacs)* <URL:http://ny.pm.org/>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
>
------------------------------
Date: Thu, 25 Sep 1997 06:23:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Creede Lambard <fearless@io.com>
Subject: Re: cgi data
Message-Id: <Pine.GSO.3.96.970925061549.19041E-100000@usertest.teleport.com>
On Wed, 24 Sep 1997, Creede Lambard wrote:
> Try this ($id is the ID number you're checking for):
>
> open (DATA,"data.txt");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check of the return value after opening a
file.
> read (DATA,$s,(-s DATA));
> close DATA;
>
> if ($id =~ /$s/) { . . . code to execute if ID matches . . . }
Was that file one giant regular expression? I don't think so. Maybe you
meant to do that the other way around, but that's still wrong unless $id
is a regular expression. I think you wanted to capture the return value of
index(), although it might be better to check one line at a time, if the
file is large.
Better luck next time! :-)
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 25 Sep 1997 15:44:29 +0200
From: Alexander Farber <eedalf@eed.ericsson.se>
Subject: CGI.pm question
Message-Id: <342A6ABD.C7B6D6DD@eed.ericsson.se>
Hi,
i am failing to use the -w switch with
my CGI-script. Here is the error message:
Ambiguous use of title => resolved to "title" => at ./absence-public.pl
line 64.
Ambiguous use of style => resolved to "style" => at ./absence-public.pl
line 65.
And here are those lines:
print start_html(-bgcolor => 'white', -title => 'ABSENCE PLAN - PUBLIC
HOLIDAYS',
-author => 'eedalf@eed.ericsson.se', -script => $JAVASCRIPT, -style =>
$CSS);
Does anyone have an idea? TIA!
/Alex
PS: (I am using CGI.pm 2.36 on Solaris/Sparc).
------------------------------
Date: 25 Sep 1997 05:54:42 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: byron@teleport.com
Subject: Re: CGI/Perl: Appending Two Associative Arrays
Message-Id: <8c3emtd04t.fsf@gadget.cscaper.com>
>>>>> "Byron" == Byron Stuart <byron@teleport.com> writes:
Byron> Why do you have to use PERL to generate the second form? Why
Byron> not use JavaScript (or some other client side scripting
Byron> language) to pass the data from the first form to a second
Byron> form, generated by a function called by onSubmit?
Maybe they don't want to be tied into a non-standard browser like
Netscape's browser-of-the-month or MSIE?
Maybe they'd rather use the Web as it was intended?
Maybe they want to ensure that *I* can use their page? Because for
security reasons, I *never* visit a site with Java *or* Javascript
enabled, like many others...
Maybe because it *can* be done trivially with CGI.pm?
I dunno. Just maybe. :-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 341 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
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@ora.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: 25 Sep 1997 10:51:16 GMT
From: mbeattie@sable.ox.ac.uk (Malcolm Beattie)
Subject: Re: Determining if a method is defined for an object
Message-Id: <60dfn4$8s4$1@news.ox.ac.uk>
In article <r8202fmk5i.fsf@asc.sps.mot.com>,
Martin Gregory <mgregory@asc.sps.mot.com> wrote:
>
>Suppose you have (a reference to) and object in $obj and the name of a
>method in $method.
>
>I'm interested in how you could determine whether the method is
>defined for the object. I'm especially interested if it can be done
>without symbolic references.
print "yes it can\n" if $obj->can($method);
The "can" method is inherited from the UNIVSERSAL class. I can't
remember how recently UNIVERSAL::can was introduced though, so if
you're not running 5.004 you may need to upgrade.
--Malcolm
--
Malcolm Beattie <mbeattie@sable.ox.ac.uk>
Oxford University Computing Services
"I permitted that as a demonstration of futility" --Grey Roger
------------------------------
Date: Thu, 25 Sep 1997 06:31:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Michel Bartolone <michel.bartolone@med.ge.com>
Subject: Re: dir symlinks don't work?
Message-Id: <Pine.GSO.3.96.970925062547.19041F-100000@usertest.teleport.com>
On Wed, 24 Sep 1997, Michel Bartolone wrote:
> Using perl 5.003 with EMBED on an origin 200 (sgi IRIX64)
> server, using the command:
>
> symlink("$dir","$link");
Those double quotes are merely misleading. And, especially if this seems
to be failing, it's not a bad idea to check the return value.
symlink $dir, $link
or warn "Making symlink from '$dir' to '$link' failed: $!";
> with the $dir and $link variables set properly doesn't seem to work! (I
> could still be misunderstanding something here.)
That happens... :-)
> This call does create a symlink, or at least a directory
> entry that LOOKS like a symlink, but if you attempt to cd to
> the symlink, it fails.
Sounds as if it makes the symlink, but your system does something wrong
with it. But I could still be misunderstanding something here. :-)
> At first I thought I was doing something
> wrong, but when I changed my script to use:
>
> system('ln','-s',"$dir","$link");
>
> I was able to cd into the symlink and I was in the proper directory.
Well, those should both work (or both fail) AFAIK.
> To test it use this code:
>
> #! /usr/local/bin/perl # <or whatever your perl path is>
>
> mkdir("test.dir",0777);
> symlink('test.dir','symlink,dir');
You know you have a comma instead of a period there, right?
> system('ln','-s','test.dir','systemln.dir');
Well, that code you posted works fine for me, and I can cd to symlink,dir
without any trouble. Try installing the latest Perl and see whether that
solves the problem. Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: 25 Sep 1997 12:22:49 GMT
From: jarausch@numa1.igpm.rwth-aachen.de (Helmut Jarausch)
Subject: Dummy variable - can you avoid it
Message-Id: <60dl2p$nej$1@news.rwth-aachen.de>
Hi,
I often have the situation where I want to feed a string to a 'sub'
after modification.
How can one get rid of $DUMMY and the do {} block in the following
very ugly code
sub foo;
$s= "....."; # please don't modify me !
foo( do {(my $DUMMY = $s) =~ s/abc/aBc/g;$DUMMY} );
Sorry for this esotheric question - I am just looking for that famous
'there is a more elegant way to do it'.
Thanks,
Helmut.
--
Helmut Jarausch
Lehrstuhl f. Numerische Mathematik
Institute of Technology, RWTH Aachen
D 52056 Aachen, Germany
------------------------------
Date: Thu, 25 Sep 1997 05:42:51 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Allen Choy <achoy@us.oracle.com>
Subject: Re: Ellipses in formats
Message-Id: <Pine.GSO.3.96.970925053918.19041C-100000@usertest.teleport.com>
On Wed, 24 Sep 1997, Allen Choy wrote:
> The Camel book mentioned that the $: variable is used to do
> ellipses in formats but it doesn't say how.
Are you using the old Camel? The new (blue) one has it listed in the
index, but the old one doesn't seem to. In any case, the perlvar(1)
manpage says essentially the same thing the new Camel does:
=item $:
The current set of characters after which a string may be broken to
fill continuation fields (starting with ^) in a format. Default is
S<" \n-">, to break on whitespace or hyphens. (Mnemonic: a "colon"
in poetry is a part of a line.)
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 25 Sep 1997 12:17:45 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Foolish Question About Saving Gifs
Message-Id: <342a5295.9286828@news.tornado.be>
annerose@geocities.com wrote:
>The problem I'm having is saving gif files created by MacPerl and
>gd.pm (as he's going to be running perl with Win95 and uses
>different graphics software than I do, I do need to save them as gifs)
>
>So far, everything I've tried has resulted in a screenful of misc.
>characters accompanied by endless repetitions of the alert
>sound on my Mac.
Let's see:
1) Ordinary GIF files on your Mac server get transmitted correctly,
i.e. they appear as an image?
2) The GIF's created by your Perl program are ok, if you copy them to a
non-Mac computer?
In this case I can imagine only one thing: the file type. That is a
4-character string that specifies what kind of file it is, e.g. for
plain text files it is TEXT. In addition, in case you didn't know,
there's also a file creator, a 4-char string with the signature of the
program to open the file with.
My guess is that the file type is still "TEXT". For GIF files, change
this to "GIFf". Use the command &MacPerl::SetFileInfo(CREATOR,TYPE,FILE)
for this. FILE is the path to your file (or a list of paths), CREATOR is
the 4-character signature of a program (e.g. "8BIM" for Photoshop,
"JVWR" for Jpeg Viewer), and TYPE is, as said, the string "GIFf".
If you're curious about what it was, use &MacPerl::GetFileInfo(FILE).
HTH,
Bart.
------------------------------
Date: 25 Sep 1997 13:15:47 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: get DOS perl to ignore EOF/SUB chars
Message-Id: <60do63$p8v$1@vixen.cso.uiuc.edu>
Peter Prymmer (pvhp@forte.com) wrote:
: Eric Pement wrote:
: >
: > I'm using the MS-DOS port of perl v 4.0M4 and 5.003, and have discovered
: > that perl stops processing when it finds an EOF char (SUB, Ctrl-Z, 0x1A)
: > embedded in a textfile. I would like perl to ignore the EOF/SUB character
: > and not stop when it encounters it. Any ideas of how to do this with
: > perl? I'm using 4DOS v5.52 if it means anything. A reply by e-mail, in
: > addition to a post to this newsgroup, would be appreciated.
: >
: > --
: > Eric Pement <epement@jpusa.chi.il.us>
:
:
: Did you try either of these?:
:
: read FILEHANDLE,SCALAR,LENGTH,OFFSET
: read FILEHANDLE,SCALAR,LENGTH
:
: you might also try the sysopen(), sysread(), sysseek() functions - but
: they
: may not be implemented in your DOS port.
And most likely you might want
binmode FILEHANDLE
as well.
--
Regards,
Mike Heins
This post reflects the
opinion of my employer.
------------------------------
Date: Thu, 25 Sep 1997 06:35:17 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Thomas Parker <muse@datasync.com>
Subject: Re: Help - Countdown Script Hack.
Message-Id: <Pine.GSO.3.96.970925063330.19041G-100000@usertest.teleport.com>
On Wed, 24 Sep 1997, Thomas Parker wrote:
> Found the following script and have been trying to figure out how to
> make it count more than one year. Right now it only counts 365 days
> regardless of the year... unless I am missing something. I basically
> want to be able to count down to a date that occurs on Feb 10 1999.
Maybe you'll want to re-write the script to have the capabilities you
want. Here's a method to use: Calculate the days between the current date
and the target date, and display that. There are some modules on CPAN
which can be useful for date calculations.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 25 Sep 1997 07:46:53 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
To: Gary Richardson <gary@econ.Berkeley.EDU>
Subject: Re: incrementing array names
Message-Id: <Pine.SGI.3.95.970925074418.6860B-100000@vangogh.bergen.org>
>The following works for one line
>@output1 = split(/\s/,@input[1]) ;
^ should be a $
for entire arrays, use @... for SINGLE elements of arrays, use $
>I am hoping that a command like
>
>for $i (0..1000) {@output$i = split(/\s/,@input[$i])} ;
>
>would work for all 1000 lines.
Better to do this:
for $i (0..1000){ @{"output$i"} = split(/\s/,$input[$i]); }
Hope it works for you...
----------------
| "I am just so full of it!"
| - Josh Ludzki
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
** I can be found on #perl on irc.ais.net as jpinyan **
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
------------------------------
Date: Thu, 25 Sep 1997 08:19:16 -0500
From: Graham Barr <gbarr@ti.com>
To: jdavie2@umbc.edu
Subject: Re: IO::Select and formatted read
Message-Id: <342A64D4.C5B9B76B@ti.com>
Jim Davies wrote:
>
> Help,
>
> I have a question about using the can_read function (from the
> IO::Select module) with formatted I/O. I know that this is a very bad
> combination. I was wondering how the formatted I/O decided where to
> stop (is it using the sysread()?).
> I have written a program using the can_read function (which works fine),
> but then
> I was using the $fileHandle->getline(). This is a bad idea (as noted in
> the select call in Camel book). I tried the $fileHandle->sysread() and
> the program was just
> hanging there. What's happening?
Maybe there was not enough data for the size you required.
> All that I really want to do is to monitor the pipe and read in the
> full contents of the pipe before returning to the MainLoop. This is
> very important for efficiency (I am monitoring several active pipes and
> a change could result in a costly state change for my GUI - we would
> like to be able to clear the pipe first:>). Any ideas?
select will only tell you that there is something waiting to be read,
it cannot tell you how much data is there.
Therefore when select returns to say that there is data ready the
only thing you can be sure of is that there is at least one byte.
sysread() will try to read as many bytes as you tell it to. If the
filehandle is a pipe, as opposed to a socket or a file, then
sysread will hang until it has read the requested nuber of bytes
or until EOF is encountered.
So the only reliable way to do what you want is
$buf = "";
while($sel->can_read(0)) {
$filehandle->sysread($buf,1,length($buf));
}
This will read everything character-by-character until the pipe
is empty.
There is one other alternative, which is to use non-blocking I/O
which will be supported in the next IO release.
Graham.
--
The road to success is lined with many tempting parking spaces.
------------------------------
Date: Tue, 23 Sep 1997 17:39:10 +0200
From: Robbert Uittenbosch <robbert@bicho.eui.upm.es>
Subject: Perl and html problem
Message-Id: <Pine.SUN.3.96.970923172858.8132A-100000@bicho.eui.upm.es>
Hi,
At this moment I'm developing an internet site which uses perl as cgi.
Everytime I open the site I get the following errormessage :
500 internal server error.
Or I get the contents of the perlscript.
I have tried everything that I could think of, but it still fails.
I know that on my server the perlfiles have te be in the cgi-bin
directory, and I do that. So that can't be the problem.
Who out there can help me with this problem, the perl and htmlfiles are
at the end of this message.
Any help is welcome.
Robbert
Email :robbert@bicho.eui.upm.es
-------------------------------------------------------------------------
HTML FILE TO OPEN.....
<HTML>
<head>
<TITLE>The Kalandrakie Environment</TITLE>
<frameset cols=25%,* border=0>
<frameset rows=15%,*>
<frame name=logo scrolling=no noresize src="mall_logo.html">
<frame name=menu scrolling=auto noresize src="../../cgi-bin/mall.pl">
</frameset>
<frameset rows=15%,*>
<frame name=title scrolling=no noresize src="mall_title.html">
<frame name=main scrolling=auto noresize src="mall_welcome.html">
</frameset>
</frameset>
</head>
</HTML>
PERL FILE........
#!/usr/local/bin/perl
require 'shop-lib.fnc';
require 'mall.cfg';
&print_header;
$page = &readHTMLpage("../mall/html/mall_menu.html");
------
some actions
------
&printHTMLpage($page);
(readHTMLpage just reads the contents of the mall_menu.html is a string.
printHTLpage just outputs it to the browers. It has to be done this way,
because I have to change several things in the page during runtime)
------------------------------
Date: Thu, 25 Sep 1997 12:29:03 +0100
From: Michael McCrann <mccrann_michael@jpmorgan.com>
Subject: Perl crashing RS600 box
Message-Id: <342A4AFF.6282@jpmorgan.com>
A perl script I was running on my RS6000 AIX3.2 server caused the server
to crash. Can anyone tell me how I can report this bug and find out if it
can be fixed.
Regards
Michael McCrann
------------------------------
Date: 25 Sep 1997 13:20:05 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: Perl crashing RS600 box
Message-Id: <60doe5$p8v$2@vixen.cso.uiuc.edu>
Michael McCrann (mccrann_michael@jpmorgan.com) wrote:
: A perl script I was running on my RS6000 AIX3.2 server caused the server
: to crash. Can anyone tell me how I can report this bug and find out if it
: can be fixed.
:
If a perl script can cause your OS and server to crash, it is a
definite bug in your OS and only possibly a bug in Perl.
Of course, in the case of AIX, if you are root and are
modifying some of their control structures (I forget what they
call them, but it is like NT's registry) then all bets are off,
and it is likely a bug in your code.
--
Regards,
Mike Heins
This post reflects the
opinion of my employer.
------------------------------
Date: Thu, 25 Sep 1997 13:22:21 GMT
From: "Jurgen Hildebrand" <jurgen@ittpub.nl>
Subject: Q: ctree / perl5 module does it exist?
Message-Id: <EH2G7q.B7L@ittpub.nl>
I searched dejanews, CPAN and other places for a CTREE ISAM database/Perl5
module, the only thing I found was ctreeperl for the good old perl4. I
wonder if there is a module for perl5?
Please cc your reply to jurgen @ ittpub . nl (remove nospam spaces)
------------------------------
Date: 25 Sep 1997 13:13:14 GMT
From: jacobson@gte.net (LCJ Jacobson)
Subject: Q: Script to build index of HTML files BY KEYWORD?
Message-Id: <60do1a$8bj$1@gte1.gte.net>
Keywords: perl, html, index, find, string, menu, automation
Many of you have perhaps used such scripts as htmltoc or makemenu to
build menu pages of HTML files. Does anyone know of a PERL script that will
search a directory of HTML files and build a menu based on a user-
defined keyword? For example, one would specify the string 'banana', and
the script would search all specified HTML files and build a new HTML file
with links to all of the files containing the word 'banana'. (Ranking in the
index based on keyword frequency and/or presence in headings would be nice,
but I'll take what I can find.)
I've got a directory of hundreds of HTML files generated from a database dump
-- these files will probably be distributed on a CD. I'd like to pre-build a
number of indices based on some keywords that I'm pretty sure will be
of interest to the target audience. I'm working on Win NT, if that makes any
difference.
Answer by posting or mail to me at <jacobson@gte.net>. If I get any off-line
responses, I'll summarize them for the group. Thanks in advance.
-jake
------------------------------
Date: Thu, 25 Sep 1997 06:14:35 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Drew Dowling <dowling@netcom.com>
Subject: Re: Question: Finding rgexp list in a second list
Message-Id: <Pine.GSO.3.96.970925054543.19041D-100000@usertest.teleport.com>
On Tue, 23 Sep 1997, Drew Dowling wrote:
> What I was wondering about is if there is a quick easy way to test for
> each member of one list as if it were a rgexp rather than as a whole?
Yes, for suitibly lax definitions of "quick" and "easy". :-)
> I want to do two additional things besides finding exact matches from
> file1 in file 2. I'd like to be able to determine that "Byko, Susana"
> does actualy include "Byko, Susan" and "Carr, Thomas" contains "Carr,
> Tom".
That's asking a lot of a regular expression - or of code in general. How
can the code know that a "Tom" and a "Thomas" are interchangeable (in your
application)? Is "Elizabeth" the same as "Liz", "Lisa", "Liza", "Lizzy",
"Beth", "Betty", "Zabeth", "Eliza", "Lyssa", "Lissie", and "Elsbeth"? :-)
If you have a list of interchangeable names, it wouldn't be hard to make a
hash whose keys are the names. The values for equivalent names would be
the same, so $names{Tom} would be the same as $names{Thomas}, but neither
would be the same as $names{Lisa}.
> As well as showing me that "Carmen, Joel" matches most of both "Carmen,
> John" and "Carmen, Jason" from a last name to first initial standpoint.
That's a little easier to do. I'd make a hash in which the keys are a last
name, a comma, a space, and a first initial.
If you have a list of regular expressions, you could use code like this to
make quick a test routine without recompiling each regexp each time
through the loop, which would be slow and wasteful.
#!/usr/bin/perl -w
use strict;
sub make_matcher {
# Given a list of regular expressions, returns code which can be
# used to check all of them at once.
my @regexps = @_;
my $code =
"sub {\n" .
join("\n" ,
map(' return 1 if /$regexps[' . $_ . ']/o;',
0..$#regexps) ) .
"\n return\n}\n";
print "The code is :\n$code\n";
my $coderef = eval $code;
die if $@; # Complain about any error
$coderef; # return value
}
# This makes a tester for three regexps
my $tester = make_matcher qw( foo\s*bar foo\d+bar (?i)foobar );
print "Enter some lines; ctrl-D at end:\n";
while (<>) {
if ( &$tester ) {
print "Match: $_";
} else {
print "No match: $_";
}
}
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 25 Sep 1997 06:40:43 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Gene Hsu <gene@moreinfo.com>
Subject: Re: Text::English
Message-Id: <Pine.GSO.3.96.970925063949.19041I-100000@usertest.teleport.com>
On Wed, 24 Sep 1997, Gene Hsu wrote:
> Can anyone show me where to find it/send me a copy?
Maybe it doesn't exist yet, because it's waiting for someone to adopt the
project and write the module. That someone may be you. :-) Good luck!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
Date: Thu, 25 Sep 1997 13:30:52 +0200
From: Giorgio Ingrassia <giorgio@lii.unitn.it>
Subject: Using sockets with WI N95
Message-Id: <342A4B6C.41B9@lii.unitn.it>
Hi everyone,
looking for a little help.
I've been writing a set of PERL scritps under UNIX using
sockets to open a connection to a WEB server, send a request
and manage the reply.
Everything's OK so far.
When I try to use them under WIN95 the connection won't open
and PERL doesn't tell me much about the reason.
I've been told that sockets work fine under NT4.0.
Is this a WIN95 problem?
Anyone under the sun who came across such a problem?
I'm using PERL for WIN32 version 5.003_07 Build 310.
Thank in advance.
Giorgio
------------------------------
Date: Thu, 25 Sep 1997 07:54:32 -0400
From: TechMaster Pinyan <jefpin@bergen.org>
Subject: Re: What does the . operator do?
Message-Id: <Pine.SGI.3.95.970925075350.6860C-100000@vangogh.bergen.org>
>what exactly does the . operator do.. for instance:
>
> $data{'new_item'} .="; " if $data{'new_item'};
Simply put, it appends to a variable.
Perl uses the + operator for math, rather than for overall "addition".
Perl uses the . operator for concatenation, or appending to something.
$add = 10 + 20; # $add now equals 30
$cat = 10 . 20; # $add now equals 1020
Now, if you wanted to append "bar" to a variable named $foo, do this:
$foo .= "bar";
that ACTUALLY means
$foo = $foo . "bar";
I hope this helps...
----------------
| "WYSIWYG? More like WUSSIWYG... Text Editors Rule!!!"
| - Jeff Pinyan
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
** I can be found on #perl on irc.ais.net as jpinyan **
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
----------------
| "I'm not laughing at you, I'm laughing with you...
| You're just not laughing."
| - Jeff Pinyan
----------------
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
webXS - the new eZine for WebProgrammers! TechMaster@bergen.org
Visit us @ http://users.bergen.org/~jefpin/webXS
** I can be found on #perl on irc.ais.net as jpinyan **
- geek code -
GCS/IT d- s>+: a--- C+>++ UAIS+>$ P+++$>++++ L E--->---- W++$
N++ !o K--? w>+ !O M>- V-- PS PE+ !Y !PGP t+ !5 X+ R tv+ b>+
DI+++ D+>++ G>++ e- h- r y?
------------------------------
Date: 25 Sep 1997 05:47:53 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: byron@teleport.com
Subject: Re: Where is HTTP::Request::Common ?
Message-Id: <8c67rpd0g6.fsf@gadget.cscaper.com>
>>>>> "Byron" == Byron Stuart <byron@teleport.com> writes:
Byron> This isn't a CGI script yet, but I'm working up to it. I
Byron> modified an example script from lwpcook (pointed out to me by
Byron> Gisle Aas). I've used LWP::Simple, and that works. I've used
Byron> LWP::UserAgent, and that works. But for this script, I need to
Byron> use the POST method to send a "form" to a CGI application on
Byron> another web site, so I need to use HTTP::Request::Common. I'm
Byron> trying to test it using Seattle Times web site, but every time I
Byron> try to execute, I get this error:
Byron> Can't locate HTTP/Request/Common.pm in @INC at wwwtest.pl line
Byron> 8.
Byron> BEGIN failed--compilation aborted at wwwtest.pl line 8.
Byron> Where is HTTP::Request::Common ? What am I doing wrong? Any
Byron> help/debuging would be great.
It probably means the latest LWP isn't installed at Teleport.
HTTP::Request::Common is a recent addition. As in, the last few
months.
If Teleport is using CPAN.pm (which rocks!), it's just one line to get
it fetched, tested, and installed:
# perl -MCPAN -e'install "LWP"'
If not, it's a bit more work.
--
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@ora.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: Thu, 25 Sep 1997 06:39:02 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: psj@cgmlarson.com
Subject: Re: why localize vars in foreach?
Message-Id: <Pine.GSO.3.96.970925063537.19041H-100000@usertest.teleport.com>
On 24 Sep 1997 psj@cgmlarson.com wrote:
> I've just got a quick question here. Why is it that a variable is
> localized inside a foreach loop?
For convenience, so that you don't have to save and restore it yourself.
Also, the control variable is actually an alias for the actual list
element, so it's somewhat magical - if it weren't localized, that variable
would need to be magical in the rest of its scope as well. You can always
choose a different name for the control variable. Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
Ask me about Perl trainings!
------------------------------
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 1077
**************************************