[6365] in Perl-Users-Digest
Perl-Users Digest, Issue: 987 Volume: 7
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 21 10:17:20 1997
Date: Fri, 21 Feb 97 07:00:23 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 21 Feb 1997 Volume: 7 Number: 987
Today's topics:
Re: [Q] Array and system (Tad McClellan)
Re: `DATE` function for NT/95 <padenton@metronet.com>
Re: Camel eats my bits (with contest) (Tom Grydeland)
compiling on DRS6000? (Andrew Dunstan)
Re: dbmopen() dbmclose() using CGI variables (Piers Cawley)
Re: dbmopen() dbmclose() using CGI variables <merlyn@stonehenge.com>
Re: efficiency with while? (Dave Thomas)
Re: escaping quotes/#? (Tad McClellan)
File Locking NOT using flock <menger@mindless.com>
Getting data from a socket into variables (newbie) (Markus Harnvi)
How do I parse RFC 822 header lines with Perl? (Trevor Jenkins)
Re: limit execution time? (Kerry Schwab)
Re: NDBM limitation (Piers Cawley)
Re: output into a variable (Nathan V. Patwardhan)
Perl in Win3.1 or MSDOS - I have questions (Idaho Central Reservations)
Re: Perl on Windows 95 (Bernie Cosell)
Perl Software <aw.leblanc@ns.sympatico.ca>
Re: Perl Software (Nathan V. Patwardhan)
piping data through unix command <klausf@mucsun.sps.mot.com>
Re: Question about sorts (Tad McClellan)
Re: relationship between @INC & PERL5LIB w.r.t. module <pfeifer@ls6.informatik.uni-dortmund.de>
Re: REQ: Getting the amount of files in a certain direc (pino colosi)
Re: Savvy Newsgroup Monitors - Please Help :-) (Mike Stok)
Re: undump (Nathan V. Patwardhan)
Re: unlink on Win95 (The next Pele)
Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 21 Feb 1997 06:41:33 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: [Q] Array and system
Message-Id: <t55ke5.oo.ln@localhost>
Wouter de Boer (wouter.deboer@pi.net) wrote:
: Hello,
: Sorry, but I can't sent my complete message, I try it again.
: I've two questions:
: I have a module which returns three array, but when I want to use the
: second array from my module is it empty, because all the values are
: strored in the first array. The second and the thirth array are empy.
: I use this code:
: sub test {
: code....
: $string = .....
: $string1 = .....
: $array1[0] = ......
: $array2[0] = ......
: $array3[0] = ......
: etc.
: return ($string, $string1, @array1, @array2, @array3);
: }
: ($string, $string1, @array1, @array2, @array3) = test;
: But when I look in @array2 it is still empty, why ??
^^^
Because that is how it is defined to work.
Since you are having trouble with a subroutine, then I'm sure that
you must have already read the free documentation about subroutines
that is included with the perl distribution?
If so,
then you should re-read the second paragraph, which documents
that it is supposed to do exactly what it _is_ doing.
It also points out the answer that I already posted to this
thread, namely use references (man perlref)
If not
then shame on you. We're not here to read the manual for you...
: Do I something
: wrong,
It would appear that you haven't read the man page about subroutines
when you discovered that you are having trouble with man pages.
That is most certainly Wrong.
: or can it be done else ?? Can anybody help me to solve this
: problem ??
Yes. References.
: Second question:
: when I use the shutdown command in a simple perl script it works, but
: when I use the same command in a CGI/Perl program it waits when the the
: shutdown command ends. My program:
: But I see never the message "System is going down". My CGI program waits
: when the system command is ended. If I kill the shutdown command I see
: the message. Why ??
^^^
Maybe because the message is being written to STDERR instead of STDOUT?
Now I'm sure the first thing that pops into your head is: "I should
read the free documentation included with the perl distribution to
see what it says about STDERR/STDOUT". Right? ;-)
Also have a look at FAQ #5.15.
: Can anybody help me ??
Hope this helped.
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Fri, 21 Feb 1997 03:07:15 -0600
From: "Paul A. Denton" <padenton@metronet.com>
Subject: Re: `DATE` function for NT/95
Message-Id: <330D65C3.765D@metronet.com>
This is a multi-part message in MIME format.
--------------6DF358695DA9
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Nathan,
If I understand you correctly, this was a problem I ran into.
Try this attachement, 'ctime.pl'
Paul Dentn
Nathan V. Patwardhan wrote:
>
> JColyer@PrioritySearch.com wrote:
>
> : The question is this: Is there a small 'DATE' executable that I can
> : place in my /perl/bin/ directory locally (under Win) that will return
> : a properly formatted UNIX date string???
>
> NTPerl should have a localtime() call that will do what you want.
>
> --
> Nate [nvp@shore.net||nvp@nfic.com]
> "Nasal spray ... do you know where I can score some?"
> - Charles Demar from _Better Off Dead_
--------------6DF358695DA9
Content-Type: text/plain; charset=us-ascii; name="ctime.pl"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="ctime.pl"
;# ctime.pl is a simple Perl emulation for the well known ctime(3C) function.
;#
;# Waldemar Kebsch, Federal Republic of Germany, November 1988
;# kebsch.pad@nixpbe.UUCP
;# Modified March 1990, Feb 1991 to properly handle timezones
;# $RCSfile: ctime.pl,v $$Revision: 4.1 $$Date: 92/08/07 18:23:47 $
;# Marion Hakanson (hakanson@cse.ogi.edu)
;# Oregon Graduate Institute of Science and Technology
;#
;# usage:
;#
;# #include <ctime.pl> # see the -P and -I option in perl.man
;# $Date = &ctime(time);
CONFIG: {
package ctime;
@DoW = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
@MoY = ('Jan','Feb','Mar','Apr','May','Jun',
'Jul','Aug','Sep','Oct','Nov','Dec');
}
sub ctime {
package ctime;
local($time) = @_;
local($[) = 0;
local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
# Determine what time zone is in effect.
# Use GMT if TZ is defined as null, local time if TZ undefined.
# There's no portable way to find the system default timezone.
$TZ = defined($ENV{'TZ'}) ? ( $ENV{'TZ'} ? $ENV{'TZ'} : 'GMT' ) : '';
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
($TZ eq 'GMT') ? gmtime($time) : localtime($time);
# Hack to deal with 'PST8PDT' format of TZ
# Note that this can't deal with all the esoteric forms, but it
# does recognize the most common: [:]STDoff[DST[off][,rule]]
if($TZ=~/^([^:\d+\-,]{3,})([+-]?\d{1,2}(:\d{1,2}){0,2})([^\d+\-,]{3,})?/){
$TZ = $isdst ? $4 : $1;
}
$TZ .= ' ' unless $TZ eq '';
$year += 1900;
sprintf("%s %s %2d %2d:%02d:%02d %s%4d\n",
$DoW[$wday], $MoY[$mon], $mday, $hour, $min, $sec, $TZ, $year);
}
1;
--------------6DF358695DA9--
------------------------------
Date: 21 Feb 1997 12:13:20 GMT
From: tom@palver.nospam.eiscat.no (Tom Grydeland)
Subject: Re: Camel eats my bits (with contest)
Message-Id: <TOM.97Feb21131320@palver.nospam.eiscat.no>
In article <lclo8j37r3.fsf@ns2.avantcomp.fi> jari@iki.fi (Jari =?ISO-8859-1?Q?M=E4kel=E4?=) writes:
> I was comfortably reading the Blue Camel on a bus on my way to work
> when I reached the end of page 75. What I saw was devastating and
> inhumane if not against the Paris Peace Treaty. There was this
> example:
> tr[\200-\377]
> [\000-\177]; # delete 8th bit
> I know the people over the pond seem to have a strange hobby of eating
> the 8th bit but I thought the Camel people are not contaminated by
> this disease.
Well, sometimes, that's life. I recently needed to strip the 8th bit
from textual data coming over a socket from a machine on which the 8th
bit was a parity bit.
Before stripping it, it looked like what you wanted your strings *not*
to look like after "destripping". Rather amusing, that, unless you
actually want to use it for something... :-)
That's not to say that most of the time, 8th bit stripping is a
nuisance. It's just to say that *sometimes* it's a good thing.
(and I've gotten used to "gjxre og vfre se snill som det ger", to say
it in (8th bit stripped) norwegian)
> Jari Mdkeld
//tom
------------------------------
Date: 21 Feb 1997 12:33:50 GMT
From: amd001@its.maynick.com.au (Andrew Dunstan)
Subject: compiling on DRS6000?
Message-Id: <5ek4ne$i4b$1@mippet.ci.com.au>
arrrggghhh!!!
I've tried several dozen times to build 5.003 on this damned machine
and every time i get some sort of ld error - missing symbols or worse.
Has anyone done this, and if so how? A "hints" file would be REALLY
nice. or a config.sh. I'm in a bit of a hurry for this and I'd hate to
have to try going back to perl4.
output from uname -a gives :
4.0 6.6.04 DRS 6000 sparc
any help would be very gratefully received.
cheers
andrew
--
-------------------------------------------------------------------------
There's nothing either good or bad, but thinking makes it so - Hamlet
http://www.gr-lakes.com/~andrew (including PGP key)
PGP Key fingerprint = 5C 44 7D E4 76 A3 31 DE 3D 11 FA 15 4D 87 1F 5E
-------------------------------------------------------------------------
------------------------------
Date: 21 Feb 1997 11:41:32 GMT
From: pdcawley@aladdin.net (Piers Cawley)
Subject: Re: dbmopen() dbmclose() using CGI variables
Message-Id: <5ek1lc$18n$2@gunnar.aladdin.net>
In article <5eik4v$p43$2@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> writes:
> [courtesy cc of this posting sent to cited author via email]
>
> In comp.lang.perl.misc,
> Tony D'Andrade <blue@visinet.ca> writes:
>:
>:Hi, I am having problems passing data to dbmopen() dbmclose() in a cgi
>:script. If I run the script from the command line and substitute the
>:data from the form with locally defined data, the script works. Below
>:are both scripts. Script A works but Script B does not generate the db file.
>:
>:Any Suggestions ?
[link deletia]
> And get thee to the CGI newsgroup. Your question is unrelated
> to Perl.
Strange, looks to me at least like it's related to perl. The guy has a
problem with a perl script that won't work in a particular environment
and, whilst it may well be a problem that is covered in the references
you supply doesn't really deserve this censure. He provided source, an
approriate subject line and didn't beg, which is pretty remarkable for
a CGI related query...
--
Piers Cawley
------------------------------
Date: 21 Feb 1997 07:33:47 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: pdcawley@aladdin.net (Piers Cawley)
Subject: Re: dbmopen() dbmclose() using CGI variables
Message-Id: <8cybcip6t0.fsf@gadget.cscaper.com>
>>>>> "Piers" == Piers Cawley <pdcawley@aladdin.net> writes:
>> :Hi, I am having problems passing data to dbmopen() dbmclose() in a cgi
>> :script. If I run the script from the command line and substitute the
>> :data from the form with locally defined data, the script works. Below
>> :are both scripts. Script A works but Script B does not generate the db file.
>> And get thee to the CGI newsgroup. Your question is unrelated
>> to Perl.
Piers> Strange, looks to me at least like it's related to perl. The guy has a
Piers> problem with a perl script that won't work in a particular environment
Piers> and, whilst it may well be a problem that is covered in the references
Piers> you supply doesn't really deserve this censure. He provided source, an
Piers> approriate subject line and didn't beg, which is pretty remarkable for
Piers> a CGI related query...
No. It's not. Tom and I have been around the block enough times that
we can spot a strictly-CGI-related problem a mile away. In fact, if
you want a little bit of wizard training, the clue is right there
above. See it? The phrase "If I run the script from the command
line... the script works".
Thus, it is not (merely?) a Perl problem, but one unique to its CGI
environment. Support for that is best provided by the subset of Perl
hackers that hang out in the CGI newsgroups, not the ones that are
interested in Perl for more general applications.
Also, I have a hunch I know what the problem is (I bet Tom does too),
and it points at the original poster just really not understanding
that a CGI-launched program is running under an ENTIRELY DIFFERENT
environment from the command line. That's why Tom created the Idiot
Guide, and also pointed the poster at all the good FAQs about how to
come up to speed on this. After the poster reads those FAQs, they
will most likely will discover on their own both (1) what is wrong
with this program, and (2) how not to make mistakes like that again.
Knowing Perl is necessary, but not sufficient, to knowing how to do
CGI stuff in Perl. You can bet that if it was a strictly Perl
problem, we would have answered it here.
And now back to your Perl discussions, rather than newsgroup charter
discussions.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 557 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: 21 Feb 1997 14:51:51 GMT
From: dave@fast.thomases.com (Dave Thomas)
Subject: Re: efficiency with while?
Message-Id: <slrn5grdf5.t69.dave@fast.thomases.com>
On 21 Feb 1997 08:43:19 GMT, Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was sent to Dave Thomas
> <Dave@Thomases.com>],
> who wrote in article <slrn5gqb7d.rf2.dave@fast.thomases.com>:
> > > > @lines = <FILEIN>;
> > Well, slurping in the emacs NEWS file (250k) increased my perl programs size
> > by:
> >
> > scalar: ~300k
> >
> > array: ~800k
>
> I'm not sure you did it right (perl malloc with all the optimizations on):
Well, I don't know about _right_ - I did it with Perl.
In particular, I did it with the Perl I use every day to do production work.
It uses the system malloc. So I justed used ps -m and looked at 'size':
dave[/usr/doc/emacs-19.30-2 08:45:13] perl -e 'open(N,"NEWS");undef
$/;system("ps -m $$");$f=<N>;system("ps -m $$");print length($f), "\n";1;'
PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND
30045 p3 173 36 340 440 780 0 780 596 0 46 perl
PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND
30045 p3 177 112 344 680 1024 0 1024 600 0 106 perl
242555
dave[/usr/doc/emacs-19.30-2 08:45:03] perl -e 'open(N,"NEWS");system("ps -m
$$");@f=<N>;system("ps -m $$");print scalar(@f), "\n";1;'
PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND
30042 p3 167 37 320 440 760 0 760 572 0 47 perl
PID TTY MAJFLT MINFLT TRS DRS SIZE SWAP RSS SHRD LIB DT COMMAND
30042 p3 176 249 332 1204 1536 0 1536 588 0 237 perl
5708
So, why does my scalar example seem to use so much less memory than yours?
Am I being naive about 'ps' here?
Dave
--
_________________________________________________________________________
| Dave Thomas - Dave@Thomases.com - Unix and systems consultancy - Dallas |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: Fri, 21 Feb 1997 06:30:32 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: escaping quotes/#?
Message-Id: <8h4ke5.7n.ln@localhost>
Chris (webmaster@surewould.com) wrote:
: Escaping the quotes should work fine. I used
: print "<body bgcolor=\"#FFFFFF\">\n";
: and it did the trick.
: (By the way, I've started using single quotes with all my HTML coding;
: it removes lots of these kinds of annoyances, from Perl to Visual Basic.
: But I don't know if singe quotes are standard HTML, now that I think
^^^^^^^^^^^^^
The problem is 'standard HTML' (from W3C) is not the HTML used
by the major browsers...
In real SGML you may use either single or double quotes.
Browsers don't do real SGML however, so I don't know where it
would break things either.
: about it, so I can't exactly recommend it.)
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 21 Feb 1997 13:34:41 GMT
From: "Matthew Enger" <menger@mindless.com>
Subject: File Locking NOT using flock
Message-Id: <01bc1ffb$ce24c5a0$073040ca@menger.enger.dyn.ml.org>
Hello,
I am new to perl and I want to lock files with out using flock. I have
writen two subs but there is something wrong with them. Can anyone help?
sub set_lock{
local($filename) = @_;
While(-f $filename.lock){select(undef,undef,undef,0.1);}
open($filename.lock,">$filename.lock");
}
sub del_lock{
($filename) = @_;
close($filename.lock);
unselect($filename.lock);
}
Thanks,
Matthew Enger
menger@mindless.com
------------------------------
Date: 21 Feb 1997 13:26:35 GMT
From: Marvi@Update.UU.SE (Markus Harnvi)
Subject: Getting data from a socket into variables (newbie)
Message-Id: <5ek7qb$jnj$1@Zeke.Update.UU.SE>
I need to get some data from a filehandle (actually a socket) into som
variables. The data is in this form:
B010 AN : (one line of text)
B400 TI : (one line of text)
B420 UTI : (one line of text)
B760 AB : (up to 30 lines of text)
B460 BD : (one line of text)
MORE (Y/N) -
First I need to handle that MORE question. I want send a "Y\n" to the socket
(to get the nest post) and then ignore the "More (Y/N)"-line totally.
Then I would like to have every post in an hash, named after the value of the
"B010 AN"-field. The hash should then just have the variables named $AN, $TI,
$UTI etc.. set with the correct value. This is just one or two things to much
to handle at the same time for a newbie...
I'm not asking for a complete solution, I just need some general advice on how
to attack this kind of problem.
Is this a good way to do it? Or should I dive into the "hashes of hashes, dust
to dust" chapter in the Camel?
//Markus
------------------------------
Date: Fri, 21 Feb 1997 13:43:48 GMT
From: tfj@apusapus.demon.co.uk (Trevor Jenkins)
Subject: How do I parse RFC 822 header lines with Perl?
Message-Id: <330ea524.15321054@news.demon.co.uk>
I'm trying to write a Perl script to analyze email meassages, specifically
the header information. I can easily extract the information that I want
from single lines but continuation lines are causing me grief.
The lines I'm particularly interested in analysing, which are causing me
that grief, are the "Received: " ones inserted by all the MTAs en route to
my workstation. These can be split at arbitrary points such that some of
the information I'm after appears in the continuation line; if it were
guarenteed to all be on the first line then I would just ignore the
continuation line completely.
Anyone got an example of how I can define a pattern that I copy? Or is
there a module I could "use" that has all the necessary parsing within it?
Regards, Trevor.
--
"Real Men don't Read Instruction Manuals"
Tim Allen, Home Improvement
------------------------------
Date: 21 Feb 1997 06:46:51 -0700
From: kschwab@nyx10.cs.du.edu (Kerry Schwab)
Subject: Re: limit execution time?
Message-Id: <5ek90b$ott@nyx10.cs.du.edu>
In article <330ca553.12756335@nntp.southeast.net>,
Murray Stokely <murray@southeast.net> wrote:
> Is there any way to limit the execution time of a Perl script somehow, in
>case it gets caught in an infinite loop or something. In csh this would be
>accomplished with "limit cputime 60".
> Obviously the goal is just to not make that happen, but I modify this script
>constantly and its called in a crontab so I don't always test it after each
>modification and recently a simple typo crippled the machine when about 10
>processes of the script were stuck in the loop simultaneously.
> Thanks for any help.
>
>
>Murray Stokely ( murray@southeast.net )
>http://www.cdrom.com/pub/artpacks
Kindof a large hammer, but....
$TIMEOUT=60;
use POSIX qw(waitpid);
if ($pid = fork) {
$start=time;
while (! $donewaiting) {
$donewaiting=waitpid($pid,WNOHANG);
sleep(1);
if (time > $start + $TIMEOUT) {
kill(15,$pid);
last;
}
}
exit;
} else {
#
# your perl code here
#
}
------------------------------
Date: 21 Feb 1997 11:57:57 GMT
From: pdcawley@aladdin.net (Piers Cawley)
Subject: Re: NDBM limitation
Message-Id: <5ek2k5$1td$1@gunnar.aladdin.net>
In article <330c4f56.1311863@snews.zippo.com>,
david.getchell@paonline.com (David Getchell) writes:
> On Wed, 19 Feb 1997 18:57:20 -0500, David Gallone <dgl@offis.lu>
> wrote:
>>Here is an extract from NDBM man pages (on SINIX).
>>
>>> The sum of the sizes of a key/content pair must not exceed the
>>> internal block size (currently 4096 bytes). Moreover all
>>> key/content pairs that hash together must fit on a single
>>> block. dbm_store will return an error in the event that a disk
>>> block fills with inseparable data.
>>
>>
>>This seems to be a very hard constraint making NDBM of little use
>>for real applications.
>>
>>Is there a work around ?
[deletia]
> Don't ever try to move a large NDBM file. The file is built by
> skipping blocks that aren't used. If you try to move it, UNIX has to
> fill in all those missing blocks with blank blocks, and the file will
> get huge. Dumping and reloading is your option here. I know this is
> mentioned in the documentation, but I thought it bore repeating.
Another argument in favour of GDBM methinks. It doesn't build sparse
files. I don't believe that Berkeley's DB does either, but I'm more
than prepared to be corrected on that.
--
Piers Cawley
------------------------------
Date: 21 Feb 1997 14:25:57 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: output into a variable
Message-Id: <5ekb9l$sgk@fridge-nf0.shore.net>
Edjair de Souza Mota (mota@ftsu00.ee.TU-Berlin.DE) wrote:
: Is there any way to get the output direct to a Perl array ?
Yes.
$prog_exe = '/path/programname';
open(EXT, "$prog_exe args |") || die("HEY: $!\n");
@responses = <EXT>;
close(EXT);
foreach $response (@responses) {
print("Program responded: $response\n");
}
--
Nathan V. Patwardhan
nvp@shore.net
"send me mail"
--Jamie Zawinski
------------------------------
Date: Fri, 21 Feb 1997 09:46:25 GMT
From: idaho@mtnhigh.com (Idaho Central Reservations)
Subject: Perl in Win3.1 or MSDOS - I have questions
Message-Id: <5ejmqs$73d$1@skin01.micron.net>
I have a win3.1 machine. Perl looks very interesting to me, but I
don't have a server and only win3.1 & dos.
Haven't seen a port to win3.1 but I have to dos. Anyone working on
a dos port or win3.1 port willing to answer a few start up questions?
Thanks in advance.
Mark Cook
http://www.mtnhigh.com/
------------------------------
Date: Fri, 21 Feb 1997 04:05:23 GMT
From: bernie@fantasyfarm.com (Bernie Cosell)
Subject: Re: Perl on Windows 95
Message-Id: <33101ebd.19454071@news.swva.net>
Mark Perry <mdperry@cougar.netutah.net> wrote:
} I am setting up a website and I want to use some scripts. I want to
} test them to make sure they work befor sending them to the ISP. I
} downloaded Perl for Windows 95/NT. I can see if a script compiles and
} what its output is in a dos box by typing C:\>perl myscript.pl.
}
} I would like to also see how it works by loading the page into Netscape
} locally and then running the script (like it would on a server). Is
} this possible. When I tried clicking on the button that calls the
} script nothing happened.
Well, depending on how complicated your script is, I check that stuff the
simple way: do "perl myscript.pl >myscript.html" and then just give
Netscape the Location "C:\mydir\myscript.html"
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Fri, 21 Feb 1997 08:49:01 -0800
From: William LeBlanc <aw.leblanc@ns.sympatico.ca>
Subject: Perl Software
Message-Id: <330DD1FD.15CC@ns.sympatico.ca>
Hi,
I am looking for the Perl software package on-line. Does anybody know
where I could find the software for me to download.
Thanks
William LeBlanc
------------------------------
Date: 21 Feb 1997 14:27:35 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Perl Software
Message-Id: <5ekbcn$sgk@fridge-nf0.shore.net>
William LeBlanc (aw.leblanc@ns.sympatico.ca) wrote:
: I am looking for the Perl software package on-line. Does anybody know
: where I could find the software for me to download.
http://www.perl.com/CPAN/
--
Nathan V. Patwardhan
nvp@shore.net
"send me mail"
--Jamie Zawinski
------------------------------
Date: Fri, 21 Feb 1997 13:57:27 +0100
From: Klaus Foerster <klausf@mucsun.sps.mot.com>
Subject: piping data through unix command
Message-Id: <330D9BB7.6F9F@mucsun.sps.mot.com>
Hi folks,
I'd like to send data through a unix command.
I imagine it like this
- perl program starts and forks.
-> now there are two perl processes
- Process 1 should generate data and send it to a unix command
(e.g. sort, its just an example I know that perl can sort as well)
- Process 2 should read the output of this unix command
So process 1 generates data for a unix program.
and finishes afterwards.
process 2 will read all the data and postprocess it.
Does anyone have a small example?
Thanx in advance.
bye
--
Klaus Foerster
------------------------------
Date: Fri, 21 Feb 1997 06:26:29 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Question about sorts
Message-Id: <l94ke5.7n.ln@localhost>
Jete Software Inc. (jete@dgs.dgsys.com) wrote:
[snip]
: sub mysort {
[snip]
: if ($letter_a <=> $letter_b) { return; }
^^^^^^ return w/o a number
<=> is a _numeric_ comparison.
Use cmp to compare characters/strings...
: if ($num_a <=> $num_b) { return; }
^^^^^^ another return w/o a number
: When I run it, I get the following message:
: Sort subroutine didn't return a numeric value at Check_Forms.pl line 98,
: <IN> chunk 1.
Well, when you get an error message from perl, and you want to fix it,
the first thing to do is go look up the error message in the perldiag
man page that is included with the perl distribution.
: Why???
^^^
Because your sort subroutine didn't return a numeric value ;-)
-----
Maybe you wanted something like this:
...
return ($letter_a cmp $letter_b) unless $letter_a eq $letter_b;
return $num_a <=> $num_b;
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: 21 Feb 1997 14:38:06 +0100
From: Ulrich Pfeifer <pfeifer@ls6.informatik.uni-dortmund.de>
Subject: Re: relationship between @INC & PERL5LIB w.r.t. module loading?
Message-Id: <yfmzpwyqny9.ulp@ls6.informatik.uni-dortmund.de>
BEGIN {
push @INC, '/usr/guest/spicano/lib/perl5/site_perl/rs_aix325';
push @INC, '/usr/guest/spicano/lib/perl5/site_perl';
}
or
use lib qw(/usr/guest/spicano/lib/perl5/site_perl/rs_aix325
/usr/guest/spicano/lib/perl5/site_perl);
Ulrich Pfeifer
--
@J = split //,"J!k Phau^eHeens%rarrot&\ncl t ";
for(0..24){print $J[$_*7%($#J+1)]}
------------------------------
Date: 21 Feb 1997 14:37:58 +0100
From: pcolosi@freenet.hut.fi (pino colosi)
Subject: Re: REQ: Getting the amount of files in a certain directory.
Message-Id: <330DB8A4.416B@freenet.hut.fi>
Nathan V. Patwardhan wrote:
>
> Nathan D Richards (nathanr@k2.ashpool.com) wrote:
> : I need to know how many *.D files there are in a certain directory.
> : Is there anyway to do this in a CGI script?
>
> Even better (I could kick myself for the last, two assinine suggestions):
>
> $dir '/path/dir';
> $entry = '' unless $entry;
>
> opendir(DIR, "$dir");
> @entries = grep(/\.D$/, sort(readdir(DIR)));
> closedir(DIR);
>
> foreach $entry (@entries) {
> $i++ if $entry;
> }
>
> print("There were $i entries with a .D extension.\n");
>
> --
> Nathan V. Patwardhan
> nvp@shore.net
> "Lane, this is pure snow!
> Do you have any idea what
> the street value of this mountain is?"
> --Charles Demar from _Better Off Dead_
Hi, I'm new to perl.
I have modified the script:
print "Content-type: text/html\n\n";
print "<HTML>";
print "<head>";
print "</HEAD>";
print "<BODY bgcolor=3D'#C0F0D3'>";
print "<center>";
print "<table border=0 cellpadding=3D'4' cellspacing=3D'4'>";
$dir = "c:\\Documenti\\html";
opendir (HANDLE, $dir) || die "Cannot open directory $dir!\n";
@entries = grep(/\.htm$/, sort(readdir(HANDLE)));
foreach $entry (@entries) {
$i++ if $entry;
}
opendir (HANDLE, $dir) || die "Cannot open directory $dir!\n";
@newentries = grep(/\.html$/, sort(readdir(HANDLE)));
foreach $entry1 (@newentries) {
$j++ if $entry1;
}
print "<h2>There are $i entries with a .htm extension and<br> $j entries
with a .html extension.</h2>\n";
opendir (HANDLE, $dir) || die "Cannot open directory $dir!\n";
print "<p>";
while ($_ = readdir(HANDLE))
{print "<tr><td><font
color=3D'#000000'><A href=\"$_\">$_</a></font></td></tr>";}
closedir(HANDLE);
print "</table>";
print "</center>";
print "</BODY>";
print "</html>";
This script shows the files of a directory.
In every html document, I have put a file's description inside
<title></title>, my question is :
is it possible to show this information along with the file name?
------------------------------
Date: 21 Feb 1997 13:13:18 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Savvy Newsgroup Monitors - Please Help :-)
Message-Id: <5ek71e$e9l@news-central.tiac.net>
In article <330D300A.730B@hooked.net>, J. Badger <jbadger@hooked.net> wrote:
>I just got the Llama book and am trying to learn PERL but my ISP won't
>allow scripts of any kind on their server so........
>
>Anyone know whether or not I can download PERL to run on my C drive? If
>so, where?
There are some perl ports and pointers to information about ports in the
ports directory on the Comperhensive perl Archive Network (CPAN)
Try looking at http://www.perl.com/CPAN/ports if you have web access.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com | Pencom Systems Administration (work)
------------------------------
Date: 21 Feb 1997 14:19:46 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: undump
Message-Id: <5ekau2$sgk@fridge-nf0.shore.net>
dedens (dedens@pi.net) wrote:
: i was reading about undump, i want to download it to
: make exe files from my perl scripts.
: why? i got a cutsomer and i dont want him to
: check out the script.
: do you know where i can find it (undump)
Frankly, this is the wrong reason to use undump, then. :-) I presume
you're using some kind of Windows machine, since you're asking for
something to create an exe? If you're using Unix, you might try
the Perl compiler (see: http://www.perl.com/perl for details).
Returning to your first question, undump won't work for you if you're
using anything but a SUN 0S 4.1.x, or a really old Linux (only rumored
to work) version of TeX or LaTeX.
--
Nathan V. Patwardhan
nvp@shore.net
"send me mail"
--Jamie Zawinski
------------------------------
Date: 21 Feb 1997 13:55:49 GMT
From: gt1535b@acmey.gatech.edu (The next Pele)
Subject: Re: unlink on Win95
Message-Id: <5ek9h5$k1d@catapult.gatech.edu>
What about '.' and '..'? Should I use unlink for those or should I use
rmdir instead? The documentation for Perl says that rmdir should only
be used on an empty directory. Is a directory empty if it only has '.'
and '..' in it?
thanks
Daryl
John Dallman (jgd@cix.compulink.co.uk) wrote:
: gt1535b@acmex.gatech.edu (The next Pele) (I doubt it) wrote:
: > Hi there. I'm running the Win95 port of perl, and I was wondering
: > if there was any difference b/t the Unix Perl version of unlink and
: > the ported version.
: Yes. Lots. the different underlying operating system means that lots of
: functions based on UNIX system calls don't exist. However, this is not
: often a problem for basic work.
: > Are there links in Win95 like in Unix?
: No, but you still use unlink() to delete files. YOu can think of it as
: all files having but a single link (as is the case for a file under UNIX
: that hasn't had further links to it created).
: John Dallman, jgd@cix.co.uk. A micro-FAQ on things I keep getting asked:
: #!perl is at ftp://.../CPAN/ports/msdos/tips-tricks/hbp_403.zip, BigPerl
: for MS-DOS can be found in CPAN via http://www.perl.com, Perl for NT/Win
: 95 can be found at http://www.activeware.com, with an excellent FAQ file
: at http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html and
: no, I don't have the slightest idea what's wrong with your CGI script.
--
<>< Daryl Bowen <><
Georgia Institute of Technology
Internet: gt1535b@prism.gatech.edu
Siemens Stromberg-Carlson Co-op
------------------------------
Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Jan 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.
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 V7 Issue 987
*************************************