[13586] in Perl-Users-Digest
Perl-Users Digest, Issue: 996 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 5 22:05:36 1999
Date: Tue, 5 Oct 1999 19:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939175516-v9-i996@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 5 Oct 1999 Volume: 9 Number: 996
Today's topics:
array for network simulator (Pat Trainor)
Re: array for network simulator <jb4mt@verbatims.com>
Re: C style was Re: Random Numbers (Larry Rosler)
Re: C style was Re: Random Numbers <uri@sysarch.com>
Re: Calling functions between PerlScript and J*Script <smiths@tiac.net>
Re: CGI Date Datebase? <jb4mt@verbatims.com>
Re: converting to Linux from NT but need a hand. <makkulka@cisco.com>
Exporting ENViroment variables back to the shell <dwb1@home.com>
Re: Exporting ENViroment variables back to the shell (Sam Holden)
Re: how does her butt taste? (Martien Verbruggen)
Re: how does her butt taste? <jb4mt@verbatims.com>
Re: HTML to ASCII (David H. Adler)
Re: Need help with input verifier (Larry Rosler)
Re: newbie help, module for changing date/time fromat t <cmd@maths.uq.edu.au>
Re: NEWBIE: how do I pull out second or third words fro <makkulka@cisco.com>
Re: NEWBIE: how do I pull out second or third words fro (Larry Rosler)
Re: Perl Debugger (Ilya Zakharevich)
Perl Error as CGI under Apache/2 reedjd@bitsmart.com
Re: Perl Error as CGI under Apache/2 (Ilya Zakharevich)
print (join ':',@y)," missing\n" (Was: bug or feature?) <johnlin@chttl.com.tw>
Re: print (join ':',@y)," missing\n" (Was: bug or featu (Sam Holden)
Re: Seperating records in a text file: just getting eve <makkulka@cisco.com>
Re: Simple - yet won't work! (Matthew Bafford)
Re: Simple - yet won't work! (Martien Verbruggen)
Re: To Abigail re: reading current threads (Martien Verbruggen)
Re: To Abigail re: reading current threads <jb4mt@verbatims.com>
Re: To Abigail re: reading current threads <elaine@chaos.wustl.edu>
using strict, no soft references!! now what? <cLive@direct2u.co.uk>
Why the $#%! can I not make a HTML link named $#%!.html <m.roles@spore.ca.boeing.com>
Re: why use references - in laymans terms? <laurensmith@sprynet.com>
Re: why use references - in laymans terms? <laurensmith@sprynet.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 06 Oct 1999 00:41:58 GMT
From: root@lisa.title14.com (Pat Trainor)
Subject: array for network simulator
Message-Id: <slrn7vl6qt.hl.root@lisa.title14.com>
Here's an interesting (to me) problem. I'd enjoy your thoughts not only on
how to solve it, but also how arrays should be implemented to make it
happen. I'm trying to learn how to apply 2d and maybe 3d arrays to this.
This is for recreation, and not some homework assignment :)
I'm looking to use perl to simulate, extremely simply, the load on networks
of varying sizes and architectures. To begin with a simple situation..
consider an array of routers assembled in 2d in a 10x10 grid. Each is
connected to each other to form a football-pool looking grid forming 81
'squares'.
Ideally, each router and each interconnecting 'lan' between them should
have their/its own characteristics which can be calculated based on
whatever is introduced into the scenario. For now, each node has as few as
2 and as many as 4 neighbors.
What approaches could I use to not only represent the routers and the
connecting networks between them, but also to have an empty set of
characteristics to update based on whatever formulas, or changes in design?
Obviously, I have to define each neighbor's relationship to each other by
assignment, as well as which network is connecting the 2.
The end result should be a small simulator that would permit someone to
describe the network, as well as the interconnecting bits. There would be
no limit on the number of networks connected to each node, or their
possible 'speeds'. Packet traffic could then be 'added' by siimply defining
a source and destination 'node' and the simulator should simply load up the
path it took (based on future formulae), but thats a bit ahead for now..
So, should a hash be created for each node? Optimally a BW assignment for
each leg should be possible, as well as characteristics at the time such as
load. I'm not looking for the final product, just thoughts on which way the
first step might go, knowing the end result.
Thanks!
Pat
:)
------------------------------
Date: Wed, 06 Oct 1999 01:32:03 GMT
From: "George Jempty" <jb4mt@verbatims.com>
Subject: Re: array for network simulator
Message-Id: <nExK3.803$ry3.8366@news.rdc1.ne.home.com>
I think you should pick up Mastering Algorithms with Perl -- just out
Pat Trainor <root@lisa.title14.com> wrote in message
news:slrn7vl6qt.hl.root@lisa.title14.com...
> Here's an interesting (to me) problem. I'd enjoy your thoughts not only on
> how to solve it, but also how arrays should be implemented to make it
> happen. I'm trying to learn how to apply 2d and maybe 3d arrays to this.
> This is for recreation, and not some homework assignment :)
>
> I'm looking to use perl to simulate, extremely simply, the load on
networks
> of varying sizes and architectures. To begin with a simple situation..
> consider an array of routers assembled in 2d in a 10x10 grid. Each is
> connected to each other to form a football-pool looking grid forming 81
> 'squares'.
>
> Ideally, each router and each interconnecting 'lan' between them should
> have their/its own characteristics which can be calculated based on
> whatever is introduced into the scenario. For now, each node has as few as
> 2 and as many as 4 neighbors.
>
> What approaches could I use to not only represent the routers and the
> connecting networks between them, but also to have an empty set of
> characteristics to update based on whatever formulas, or changes in
design?
>
> Obviously, I have to define each neighbor's relationship to each other by
> assignment, as well as which network is connecting the 2.
>
> The end result should be a small simulator that would permit someone to
> describe the network, as well as the interconnecting bits. There would be
> no limit on the number of networks connected to each node, or their
> possible 'speeds'. Packet traffic could then be 'added' by siimply
defining
> a source and destination 'node' and the simulator should simply load up
the
> path it took (based on future formulae), but thats a bit ahead for now..
>
> So, should a hash be created for each node? Optimally a BW assignment for
> each leg should be possible, as well as characteristics at the time such
as
> load. I'm not looking for the final product, just thoughts on which way
the
> first step might go, knowing the end result.
>
> Thanks!
>
> Pat
> :)
------------------------------
Date: Tue, 5 Oct 1999 17:26:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: C style was Re: Random Numbers
Message-Id: <MPG.126436f2999c272098a03f@nntp.hpl.hp.com>
In article <7tdtpu$i0q$1@rguxd.viasystems.com> on 5 Oct 1999 22:23:58
GMT, lt lindley <ltl@rgsun5.viasystems.com> says...
...
> What's the matter with the simplicty of just using 2 arrays and
> sharing the index? Or is that a false simplicity?
If two independent arrays exist, walking the indexes is probably simpler
and more efficient than copying the arrays into a two-dimensional data
structure.
But if the arrays are being created, then putting them into the data
structure and using the array of references saves a lot of addressing
computation caused by the indexes, so is probably faster.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 05 Oct 1999 20:33:54 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: C style was Re: Random Numbers
Message-Id: <x7hfk5s4y5.fsf@home.sysarch.com>
>>>>> "ll" == lt lindley <ltl@rgsun5.viasystems.com> writes:
dear redmond conflict:
ll> When I write C code for most of the day, then switch to writing Perl,
ll> my Perl looks like C. Oh the shame, the shame. ;-)
for your pennance, you must write 200 lines of code in cobol or python.
ll> It may just be a vestigal habit, but I still find myself using
ll> C-style for loops at times. Although Perl allows for nice data
ll> structures to represent relationships in the data, sometimes for
ll> simple data it seems easier to use multiple arrays that share the
ll> same index instead.
ll> What's the matter with the simplicty of just using 2 arrays and
ll> sharing the index? Or is that a false simplicity?
traversing parallel arrays is one of the few places in perl where using
c style for loops can be a win. if you don't mind destroying one of the
arrays, then this looks better:
while( @array1 ) {
$a = shift @array1 ;
$b = shift @array2 ;
blah blah
}
it is actually less the issue of the c loop than using simple array
indexing that sticks in my craw. random access in an array is fine but
sequential access is better done with foreach loops.
the stylish perl doctor.
BTW i always read your name as if you were an officer!
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Tue, 05 Oct 1999 21:45:00 -0400
From: "Richard M. Smith" <smiths@tiac.net>
To: djearthling@my-deja.com
Subject: Re: Calling functions between PerlScript and J*Script
Message-Id: <37FAA99C.46CEDD05@tiac.net>
Hi,
I've had no problem of a JavaScript function calling a PerlScript function.
Just make the call and it works. Example:
<script language=PerlScript>
sub PerlFunc() ...
</script>
<script language=JavaScript>
alert("PerlFunc() returns " + PerlFunc());
</script>
However calling the other direction
is problematic. ActivePerl appears to be buggy in this area. The
only thing I found that works, is to use the JavaScript eval function
from PerlScript:
$result = $window->eval("JSFunc()");
Passing data between JavaScript and PerlScript gets pretty hairy
however. Numbers and strings work fine. But JavaScript
arrays and objects are complicated. ActivePerl appears
to get confused when JavaScript arrays and objects are passed as
arguments into a Perl function. However, JavaScript arrays
and objects seem to work okay when they are placed in global
JavaScript variables.
Bottom line: JavaScript and PerlScript can be used together
on the same page, but the interface isn't as clean as it really
should be.
Richard
djearthling@my-deja.com wrote:
> Hello all,
>
> Is it possible to have a server-side script that uses PerlScript and
> either JScript or JavaScript , such that the PerlScript can call
> J*Script functions, and vice-versa ?
>
> I've done a script that had VBScript using a JScript function, like
> this:
>
> <%@ LANGUAGE=VBSCRIPT %>
> <HTML>
> <HEAD>
> <SCRIPT LANGUAGE="jscript" RUNAT="server">
>
> function uncodeproblem(problemtext) {
> return unescape(problemtext)
> }
> </SCRIPT>
> ...
> <%
> ...
> if ( isgood(temptext) ) then
> temptext = uncodeproblem(temptext)
> end if
>
> ----
>
> Trying to do the same thing with PerlScript doesn't work. The error
> message I get says "Undefined subroutine &main::uncodeproblem called."
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Wed, 06 Oct 1999 00:50:52 GMT
From: "George Jempty" <jb4mt@verbatims.com>
Subject: Re: CGI Date Datebase?
Message-Id: <M1xK3.799$ry3.8291@news.rdc1.ne.home.com>
Have your main page be dynamically generated by a CGI script, and then your
idea of storing the events in a text file is on track, except that you won't
have to run a seperate "mini-program" every night to update the sidebar --
such a mini-program, the CGI script, will run everytime the page loads and
will print the event for the appropriate days event, as well as all the
other html which I'm assuming will remain unchanged for the time being.
Hope this helps. If you need more assistance, absolutely feel free to email
directly
George Jempty
Ryan Greenberg <rgrnbrg@xmission.com> wrote in message
news:7te3bv$hta$1@news.xmission.com...
> Hello All,
>
> I've been doing basic HTML and graphic design for some time, but I
> recently undertook my largest project to date that requires me to move
> ahead. Unfortunately, I am uncertain where to begin.
> I am in charge of a page that has a sidebar which contains information
> updated daily. The sidebar has the long date (e.g. Monday, October 4,
1999)
> followed by a list of events from that day. Thus far, I have been manually
> entering the list of events into a small .ssi file which I call
"today.ssi".
> Every evening, I upload the today.ssi file for the next day. I have only
> been doing this for a few days now, and already it has become a tedious
> chore.
> I have begun to learn Perl in hopes that it will allow me to overcome
> this problem. Really, though, I have no idea where to begin. I thought
> perhaps it would be possible to store all the events in a text file on my
> remote server and have a mini-program run automatically every evening at
> midnight to change the today.ssi file, or even the index.html file that
> includes the today file.
> I am running this site on a UNIX server, and changing to an NT server
is
> not an option. Could anyone offer advice on how to begin this task? I
> realize this is a very broad question and there are probably a number of
> ways to approach it, but I would greatly appreciate any help.
>
> Thanks,
> Ryan
>
> (If anyone is interested in seeing the case in point, the page is
available
> at www.judgememorial.com/main.shtml)
>
> --
> Ryan Greenberg - rgrnbrg@xmission.com
> http://www.xmission.com/~rgrnbrg
------------------------------
Date: Tue, 05 Oct 1999 17:28:16 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: converting to Linux from NT but need a hand.
Message-Id: <37FA97A0.4B098ADB@cisco.com>
[ Kangas wrote:
> I have used the search too for mysql.h and *sql*h to find it but it is
> NOT on my machine. How can i get around this? Thanks.
You will have this on your machine if you installed MySQL from source.
--
------------------------------
Date: Wed, 06 Oct 1999 01:11:03 GMT
From: "Daniel W. Burke" <dwb1@home.com>
Subject: Exporting ENViroment variables back to the shell
Message-Id: <Pine.LNX.4.10.9910052003110.10931-100000@cc569157-a.warn1.mi.home.com>
Hello,
I'm trying to figure out a way to export an enviroment variable back to
the shell. I've been looking and experimenting for a while now, and havn't
been able to come up with anything that works.
What I'm trying to do is this...
A module I need requires a lib that isn't located in a place setup in
/etc/ld.so.conf, so I need to set LD_LIBRARY_PATH before executing the
script. Unfortunatly, that isn't always going to be an option, because
it's going to be a CGI script, and I don't have root on this machine to
update ld.so.conf and run ldconfig. (The machine I have to run this
script on is so messed up it's not funny (redhat 6.0)).
Does such a thing exist that will allow me to do what I need to do? Or am
I going about it all wrong?
Dan.
------------------------------
Date: 6 Oct 1999 01:57:21 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Exporting ENViroment variables back to the shell
Message-Id: <slrn7vlb41.1no.sholden@pgrad.cs.usyd.edu.au>
On Wed, 06 Oct 1999 01:11:03 GMT, Daniel W. Burke <dwb1@home.com> wrote:
>
>
>Hello,
>
>I'm trying to figure out a way to export an enviroment variable back to
>the shell. I've been looking and experimenting for a while now, and havn't
>been able to come up with anything that works.
That's because it can't be done.
>
>What I'm trying to do is this...
>
>A module I need requires a lib that isn't located in a place setup in
>/etc/ld.so.conf, so I need to set LD_LIBRARY_PATH before executing the
>script. Unfortunatly, that isn't always going to be an option, because
>it's going to be a CGI script, and I don't have root on this machine to
>update ld.so.conf and run ldconfig. (The machine I have to run this
>script on is so messed up it's not funny (redhat 6.0)).
>
>Does such a thing exist that will allow me to do what I need to do? Or am
>I going about it all wrong?
No, and Yes.
You can modify the environment directly from perl...
$ENV{LD_LIBRARY_PATH} = "whatever you feel like";
You will of course have to do that before the lib gets required. So if you
are using 'use' you will need a BEGIN block.
--
Sam
This was for Linux, but since we all know that "platform independent"
means "runs on both BSD and Linux", this should be ok. :-)
-- Tom Christiansen in <37cf3d16@cs.colorado.edu>
------------------------------
Date: Wed, 06 Oct 1999 00:11:42 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: how does her butt taste?
Message-Id: <2twK3.102$_G2.2665@nsw.nnrp.telstra.net>
On Tue, 05 Oct 1999 21:36:36 GMT,
George Jempty <jb4mt@verbatims.com> wrote:
> I don't want to piss off the truly helpful people on this board who did not
Then you should learn to hold your tongue, because with this rant you
have pissed off many people, and ended up in their killfiles. Not
because of your sentiments, but because of the way you display them.
HTH, HAND.
byebye.
Martien
--
Martien Verbruggen |
Interactive Media Division |
Commercial Dynamics Pty. Ltd. | "Mr Kaplan. Paging Mr Kaplan..."
NSW, Australia |
------------------------------
Date: Wed, 06 Oct 1999 00:32:09 GMT
From: "George Jempty" <jb4mt@verbatims.com>
Subject: Re: how does her butt taste?
Message-Id: <dMwK3.797$ry3.8292@news.rdc1.ne.home.com>
If I'm in their killfile I probably didn't want to hear any of their BS
anyway but thanks anyway
Martien Verbruggen <mgjv@comdyn.com.au> wrote in message
news:2twK3.102$_G2.2665@nsw.nnrp.telstra.net...
> On Tue, 05 Oct 1999 21:36:36 GMT,
> George Jempty <jb4mt@verbatims.com> wrote:
> > I don't want to piss off the truly helpful people on this board who did
not
>
> Then you should learn to hold your tongue, because with this rant you
> have pissed off many people, and ended up in their killfiles. Not
> because of your sentiments, but because of the way you display them.
>
> HTH, HAND.
>
> byebye.
>
> Martien
> --
> Martien Verbruggen |
> Interactive Media Division |
> Commercial Dynamics Pty. Ltd. | "Mr Kaplan. Paging Mr Kaplan..."
> NSW, Australia |
------------------------------
Date: 6 Oct 1999 00:14:15 GMT
From: dha@panix7.panix.com (David H. Adler)
Subject: Re: HTML to ASCII
Message-Id: <slrn7vl52n.b94.dha@panix7.panix.com>
In article <37fa17dd_1@newsread3.dircon.co.uk>, Jonathan Stowe wrote:
>In comp.lang.perl.misc John Porter <jdporter@min.net> wrote:
>> In article <slrn7vagi4.8gm.dha@panix.com>, David H. Adler wrote:
>>>
>>>Nah. And I think the Daleks were probably coded in Fortran...
>>>
>>>:_)
>>
>> You think? I'm guessing Logo.
>>
>
>That would explain why they couldnt go up stairs ;-}
They must have ported then, as they can, now...
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
If God didn't want us to eat animals, he wouldn't have made them out
of Meat. - Phillip, Goats, 20sep99
------------------------------
Date: Tue, 5 Oct 1999 17:14:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Need help with input verifier
Message-Id: <MPG.1264342dcf02beb798a03e@nntp.hpl.hp.com>
In article <7tdtpv$1qt$1@brokaw.wa.com> on Tue, 5 Oct 1999 15:23:33 -
0700, Lauren Smith <laurensmith@sprynet.com> says...
> >>In article <37f9f1c9.2777093@nntp.ix.netcom.com> on Tue, 05 Oct 1999
> >>12:49:36 GMT, Jana Cole or John Sayre <quikscor@ix.netcom.com> says...
> >>> $month = (qw(1 2 3 4 5 6 7 8 9 10 11 12)) [(localtime)[4]];
> >>> $day = (qw(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
> 21
> >>> 22 23 24 25 26 27 28 29 30 31)) [(localtime)[3]];
> >>> $year = (localtime)[5];
> >>> if ($year > 99)
> >>> {
> >>> $year = year - 100;
> >>> }
> >>> $todays_date = "$month/$day/$year";
...
> #!perl -w
> ($mday,$month,$year) = (localtime)[3..5];
> $todays_date = sprintf("%u/%u/%u",$month+1,$mday,1900+$year);
> print $todays_date;
Some quibbles:
We like to show code that runs with 'use strict;' as it gets people into
good habits for significant-sized programs. But the '-w' is good, too.
As long as you are going to use sprintf, you might as well pad to two
digits.
The year adjustment should be '$year % 100' to match the original
snippet.
<SOAPBOX>
Get used to two-digit years that start with 0, friends.
The California DMV has been issuing annual update stickers for license
plates that have read '97', '98', '99'. I just got my newest sticker,
which reads (in smaller letters to fit into the same place) '2000'. I
wonder why? Those geniuses are the exception. Most people will use
'00' etc.
</SOAPBOX>
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 06 Oct 1999 11:04:27 +1000
From: christopher dawson <cmd@maths.uq.edu.au>
To: "Patrick A. Smith" <psmith3@tampabay.rr.com>
Subject: Re: newbie help, module for changing date/time fromat to single number.
Message-Id: <37FAA01B.CBDEABB@maths.uq.edu.au>
Patrick A. Smith wrote:
> The format of the date/time and row info is like this;
>
> 8-16-99 00:20:00
>
For a date like this mm-dd-yy hr:min:sec if we write it as
19990816002000, then each date/time is assigned an integer, larger
integers denoting later dates
so
$datetime= "8-16-99 00:20:00";
(apologies in advance to people who find novice code offensive) The
following should assign the appropriate integer
($date,$time) = split(/\s/,$datetime);
$time =~ s/://g;
@mdy = split(/-/,$date);
$newdatetime = 19000000000000 +
$mdy[2] * 10000000000 +
$mdy[0] * 100000000 +
$mdy[1] * 1000000 +
$time;
I assumed that you'll write 2000 as mm-dd-100
You can then sort an associative array (key =$datetime, value=row) or
anything else that takes your fancy
Hope this helps,
Chris
------------------------------
Date: Tue, 05 Oct 1999 17:43:07 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: NEWBIE: how do I pull out second or third words from a string?
Message-Id: <37FA9B1B.BB5BC477@cisco.com>
{
Dermod Moore wrote:
> How do I pull the second field, NOT the second word,
> (keeping New Zealand in mind) and use that to sort the database?
Perl faq (4)
How can I split a [character] delimited string except when inside
[character]? (Comma-separated
files)
===
------------------------------
Date: Tue, 5 Oct 1999 17:49:29 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: NEWBIE: how do I pull out second or third words from a string?
Message-Id: <MPG.12643c771c15cdb798a040@nntp.hpl.hp.com>
In article <37FA7A0E.CE217B61@astrolog.demon.co.uknospam> on Tue, 05 Oct
1999 23:22:07 +0100, Dermod Moore <dm@astrolog.demon.co.uknospam>
says...
> I'm trying to sort a database like this:
>
> 21430908,"England","Bloggs, Joe"
> 07070870,"Ireland","O'Connor, Pat"
> 08708078,"New Zealand","Smith, Mary"
...
> ... How do I pull the second field, NOT the second word,
> (keeping New Zealand in mind) and use that to sort the database?
I prefer to use split() rather than a regex, when possible.
$item = (split /,/, $_, 3)[1];
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 6 Oct 1999 01:43:25 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Debugger
Message-Id: <7te9ft$mps$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Wizard of VOBs
<hazard@eznetN-O~S'P&A`M.net>],
who wrote in article <7tdkai$674$1@news.wrc.xerox.com>:
> one thing I have problems with is deubbing forked processes. Is there a
> way I can do this effectively and confidently?
Upgrade. Or if you upgraded, but the debugger cannot create a new tty
itself, follow the advice debugger gives you. And if your solution is
general enough, merge this procedure into perl5db.pl.
Hope this helps,
Ilya
------------------------------
Date: Wed, 06 Oct 1999 00:48:53 GMT
From: reedjd@bitsmart.com
Subject: Perl Error as CGI under Apache/2
Message-Id: <7te69h$r1e$1@nnrp1.deja.com>
If there is a more appropriate forum for this to posted in, I would
love to know; I couldn't find one I thought was better.
I have a CGI script running on my apache server under OS/2 that
currently runs beautifully. If I add a line into:
use Shell;
the cgi gives an error, but the perl script still runs without problem
if I run it from the command line.
Looking at the error_log gives me:
Can't locate Shell.pm in @INC (@INC contains:
f:/perllib/lib/5.00553/os2 f:/pe......
This error makes sense (sort of) since f: is my cd-rom drive and perl
should be on the c: drive. Why exactly would it be looking to my ftp
for this when run as a cgi under apache but not as a command line
script?
-Jordan
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 6 Oct 1999 01:45:48 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl Error as CGI under Apache/2
Message-Id: <7te9kc$mr4$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to
<reedjd@bitsmart.com>],
who wrote in article <7te69h$r1e$1@nnrp1.deja.com>:
> I have a CGI script running on my apache server under OS/2 that
> currently runs beautifully. If I add a line into:
>
> use Shell;
>
> the cgi gives an error, but the perl script still runs without problem
> if I run it from the command line.
You have your set PERLLIB_PREFIX= line in a wrong place. Your shell
has it set, your Apache does not see it.
Ilya
------------------------------
Date: Wed, 6 Oct 1999 09:39:47 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: print (join ':',@y)," missing\n" (Was: bug or feature?)
Message-Id: <7te97b$ob8@netnews.hinet.net>
Matthew Bafford <*@dragons.duesouth.net> wrote
> Alexander Knack <ak@dasburo.de> wrote
> : why does the following not work?
> : $x = '23.24.25';
> : @y = split '.', $x;
> : print (join " ", @y), "\n";
>
> There are actually two bugs in that program.
> You should be running perl with -w.
I've got the warning and the surprising result, which I don't understand.
@y=(23,24,25);
print (join ":", @y)," missing\n";
Warnings:
print (...) interpreted as function
Useless use of a constant in void context
Does it warn that in
print join ...
'join' is interpreted as function, not a filehandle?
Then why is the string " missing\n" in void context?
John Lin
------------------------------
Date: 6 Oct 1999 02:03:45 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: print (join ':',@y)," missing\n" (Was: bug or feature?)
Message-Id: <slrn7vlbg1.1no.sholden@pgrad.cs.usyd.edu.au>
On Wed, 6 Oct 1999 09:39:47 +0800, John Lin <johnlin@chttl.com.tw> wrote:
>Matthew Bafford <*@dragons.duesouth.net> wrote
>> Alexander Knack <ak@dasburo.de> wrote
>> : why does the following not work?
>> : $x = '23.24.25';
>> : @y = split '.', $x;
>> : print (join " ", @y), "\n";
>>
>> There are actually two bugs in that program.
>> You should be running perl with -w.
>
>I've got the warning and the surprising result, which I don't understand.
>
>@y=(23,24,25);
>print (join ":", @y)," missing\n";
>
>Warnings:
>print (...) interpreted as function
>Useless use of a constant in void context
>
>Does it warn that in
>print join ...
>'join' is interpreted as function, not a filehandle?
>
>Then why is the string " missing\n" in void context?
Because as the error message said print (...) is being interpreted as a
function...
So you have :
print(join " ",@y) as a function followed by , "missing\n";
It is not going to print the "missing\n" bit since it is
not passed to print.
Read the documentation to find out why perl does this.
You could try something like :
print join(" ",@y)," missing\n";
or
print ( (join " ",@y)," missing\n");
or
print +(join " ",@y)," missing\n";
or many other ways...
--
Sam
"... the whole documentation is not unreasonably transportable in a
student's briefcase." - John Lions describing UNIX 6th Edition
"This has since been fixed in recent versions." - Kernighan & Pike
------------------------------
Date: Tue, 05 Oct 1999 17:55:05 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Seperating records in a text file: just getting every OTHER one.
Message-Id: <37FA9DE9.FCCA752B@cisco.com>
{
Pfash1 wrote:
> open (FH, 'Buncha emails');
> while (<FH>)
> {
> $/ = "+++++++++++++++++++++++";
> $_ = <FH>;
> s/\n[ \t]+/ /g;
> push(@eachrecord, $_);
> }
> This actually just pushes everyOTHER record into the @eachrecord array. Why oh
> why?
When you jump into the loop $_ already has a line read from <FH>
Using the following statement
$_ = <FH>;
makes perl to read the NEXT line from <FH>.
Hence the alternate line behaviour you are seeing.
Delete this line and everything will fall in place.
--
------------------------------
Date: Wed, 06 Oct 1999 00:11:32 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Simple - yet won't work!
Message-Id: <slrn7vl43g.2rf.*@dragons.duesouth.net>
Martien Verbruggen:
: On Tue, 05 Oct 1999 19:15:38 GMT,
: Matthew Bafford <*@dragons.duesouth.net> wrote:
:
: > The problem with unlocking the file before the close is buffering. If
: > you write to the file, unlock it, and then close, something like this
: > could happen:
:
: Is that still true? The 5.005_03 source seems to do a flush before
: unlocking, and I seem to remember that there was a thread not that
You missed vital parts of that post:
...
3) p1: write file, but since output is buffered, only part of the data is
actually written [0]
...
[0] Actually, newer Perls do the flush for you on unlock, but it's
difficult to be 100% certain your program will always run on a newer
Perl.
...
:-)
: Martien
--Matthew
------------------------------
Date: Wed, 06 Oct 1999 00:28:56 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Simple - yet won't work!
Message-Id: <cJwK3.109$_G2.2742@nsw.nnrp.telstra.net>
On Wed, 06 Oct 1999 00:11:32 GMT,
Matthew Bafford <*@dragons.duesouth.net> wrote:
> Martien Verbruggen:
[snip]
> You missed vital parts of that post:
You are right, and I apologise (or apologize, if that sounds better to
foreign ears :)). I missed the footnote reference, and the footnote
itself (was formatted as a signature).
Martien
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd. | Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Wed, 06 Oct 1999 00:09:26 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: To Abigail re: reading current threads
Message-Id: <WqwK3.100$_G2.2665@nsw.nnrp.telstra.net>
On Tue, 05 Oct 1999 21:07:27 GMT,
George Jempty <jb4mt@verbatims.com> wrote:
> Great suggestion -- now I know what a COMPLETE witch you are.
Ooh.. She'll turn you into a frog for that!
Wait... A Perl witch... Is that the female variant of a Perl Wizard?
How politically incorrect.
> George Jempty
>
> PS: I'm NOT going away, although it's obvious that you would like all the
> beginners to do so, since you yourself obviously were never a beginner. And
> by the way -- I admit, this is SPAM -- if you don't like spam don't reply
> since that would just be spam too, you arrogant pretentious hypocrite.
And for that she'll also give you yellow feet. I hope you will see the
error of your ways once you find out how unpopular little frogs with
yellow feet are.
Spam? Do you know what spam is? Spam is a delicious mixture or
regurgitated and preprocessed blobs of semi-meat which can be used to
create Monty Python sketches or UBE (let me explain that one to you:
Unsolicited Bulk Email).
None of the above applies to your post.
It stinks, it's offtopic, it's posted to a newsgroup when it should
have been emailed, it contains unwarranted personal attacks (I refuse
to use _the word_) and unnecessary capitalisation, it's only partly
literate, and has no perl content. But it's not spam.
Martien
--
Martien Verbruggen |
Interactive Media Division | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd. | reflects this.
NSW, Australia |
------------------------------
Date: Wed, 06 Oct 1999 00:42:37 GMT
From: "George Jempty" <jb4mt@verbatims.com>
Subject: Re: To Abigail re: reading current threads
Message-Id: <1WwK3.798$ry3.8340@news.rdc1.ne.home.com>
clpm
> is the most infantile rabid newsgroup I have ever observed.
>
I've lately spent a lot of time on the Kasparov vs the World Chess match
bulletin board and was THAT ever a zoo! Some guy even made death threats
more than once, but has not been around since his ISP was contacted, as well
as the US Consulate in his city. That's why I decided I wasn't going to put
up with anybody's crap here. Sure, I've violated all sorts of protocol with
this thread, but I sometimes do that just to get a reaction. And the reason
I wanted a reaction was that my initial post was reasonable in that I
included some code snippets so I could get specific feedback. A couple of
people were very quick with the solution, and the thread should have ended
there, until Abigail decided to take issue with the fact that I could have
found my answer in a previous thread. Totally unnecessary, and I've seen
her do likewise to others, so I decided to get everybody riled up. Now that
I've succeeded, I think I'll just program my web pages with PHP in the
future!
------------------------------
Date: Tue, 05 Oct 1999 21:50:25 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: To Abigail re: reading current threads
Message-Id: <37FAAA1F.ADBF866C@chaos.wustl.edu>
lt lindley wrote:
> But what would we do for entertainment if it stopped?
So, if you were condemned to listen to a Celine Dion for the rest of
your days among the living, it wouldn't drive you mad? <scribbling notes>
> little questions and sincere pleas for help. I just don't see how
> these awful bullies can be so mean to the little critters.
It just seems pointless to rant on over and over and over and over again
and yet, the same behaviour persists. I'd be happy just to see a higher
signal to noise ratio. Not replying at all is an option.
> Speaking of pedantry, are you really sure that the above is an appropriate
> use of the word "cabal?" My dictionary defines... :-)
Pedants unite :) but of course...a little bit of humour. s/cabal/cannibal/
e.
------------------------------
Date: Tue, 05 Oct 1999 18:09:14 -0700
From: cLive hoLLoway <cLive@direct2u.co.uk>
Subject: using strict, no soft references!! now what?
Message-Id: <37FAA13A.CAFF007F@direct2u.co.uk>
Hi all,
In my never ending attempt to make my things run under strict, I ask for
a little advice.
Code below is a snapshot of what I'm working on. If I uncomment the
$field{'There'} line, I get that element as expected (%field is hash of
name/value pairs sent from form).
What I want to be able to do is then use the soft reference ${$2} next
if that element doesn't exist, and failing that, assign the value
'null';
I've played around with this for a while now, and can't work out how to
do it. Any ideas???
#!/usr/bin/perl
use strict;
my %field;
# $field{'There'} = 'hash element value';
my $Hello = 'well, hello';
my $There = 'there we go';
my $a = "Hello There";
$a =~ /(\w+) (\w+)/;
my $var_value = $field{$2} || ${$2} || 'null';
print $var_value;
ie, I want to get the value of $There in the ${$2} bit... but I get the
"Can't use soft references under strict" error.
pointers appreciated. I've just read the hard references stuff in the
camel (all one para of it) and the relevant stuff in EPP, but still
can't get it. Arghhhh
cLive ;-)
------------------------------
Date: Wed, 6 Oct 1999 00:04:14 GMT
From: Mark Roles <m.roles@spore.ca.boeing.com>
Subject: Why the $#%! can I not make a HTML link named $#%!.html?
Message-Id: <37FA91FE.6B08@spore.ca.boeing.com>
OK, here is the scenario. I have a perl program that generates an HTML
file, and then gives you a link to that newly created file. That web
page happens to be named to what ever is typed into a web form. So if
you were to type into the web form:
$#%!
You should then have a file created named $#%!.html, and a link to
$#%!.html. These two things actually do happen, but when you place your
cursor over the link, the link shows up as $%23%25!.html instead. And
thus if you try the hyperlink, you get the FILE NOT FOUND error. So I
need to know how to convert the buffer into a usable format to use as
the actual link name.
And here is the code that deals with the reading in of the buffer:
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
------------------------------
Date: Tue, 5 Oct 1999 17:03:00 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: why use references - in laymans terms?
Message-Id: <7te3kd$ul3$1@brokaw.wa.com>
jdkronicz@my-deja.com wrote in message <7te19a$nll$1@nnrp1.deja.com>...
>In article <7sr1fg$59u$1@brokaw.wa.com>,
> "Lauren Smith" <laurensmith@sprynet.com> wrote:
>....
>> Try reading
>> perlref
>> perldsc
>> perllol
>>
>> Lauren
>>
>>
>Thanks for your reply Lauren. Where can I find the documents you
>reference?
%perldoc perlref
%perldoc perldsc
%perldoc perllol
Lauren
------------------------------
Date: Tue, 5 Oct 1999 17:08:56 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: why use references - in laymans terms?
Message-Id: <7te3vr$v9l$1@brokaw.wa.com>
Sorry about that, my Send finger is a little trigger happy.
Lauren Smith wrote in message <7te3kd$ul3$1@brokaw.wa.com>...
>jdkronicz@my-deja.com wrote in message <7te19a$nll$1@nnrp1.deja.com>...
>>Thanks for your reply Lauren. Where can I find the documents you
>>reference?
Type at your favorite command line:
>
>%perldoc perlref
>%perldoc perldsc
>%perldoc perllol
>
>Lauren
>
>
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 996
*************************************