[8549] in Perl-Users-Digest
Perl-Users Digest, Issue: 2166 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 23 17:17:57 1998
Date: Mon, 23 Mar 98 14:00:43 -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 Mon, 23 Mar 1998 Volume: 8 Number: 2166
Today's topics:
Re: "Newbie" Crib Notes (John Moreno)
Re: - Limiting the length of a list on a page..... - (Martin Vorlaender)
Calling all Newbies <doug@ccinet.com>
Re: Creating a unique id number? <spicano@ptdcs2.intel.com>
Re: Creating an array for e-mail addresses for online f (MistaK)
Re: help me, I'm desperate <kmiles@erols.com>
Help: AS400 Perl Savf Install Problems. <julianje@iname.com>
Re: Is there a "Newsgroup" for Newbies to Perl? (John Moreno)
Is there a Perl Cross-Reference tool? (long) <mike@unival.com>
LWP doesn't do HTTP keepalives! (Ian Kallen)
Passing reference to array of hashes: a better way? spamfree@yahoo.com
Re: Passing reference to array of hashes: a better way? <jdf@pobox.com>
Please help with ACGI vs. CGI in MacPerl <mmgosink@facstaff.wisc.edu>
Re: sprintf rounding error <kmiles@erols.com>
Re: Submitting to another CGI-Script (brian d foy)
Re: ts: unexpected behavior of "last" with "print" <quentin@jihad.amd.com>
Unlink on WinNT/95 <karld@feklore.demon.co.uk>
Re: Unlink on WinNT/95 ("John Dallman")
Re: Variable question <dboorstein@shopcfn.com>
Re: Wanted: email address gleaner (John Moreno)
Re: What does "UNIX" stand for.. <akulkis@be1151.pd3.ford.com>
Re: What does "UNIX" stand for.. (Rob Rodgers)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 23 Mar 1998 20:16:00 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: "Newbie" Crib Notes
Message-Id: <1d6ccn3.igkncv1dgziz3N@roxboro0-004.dyn.interpath.net>
Mark Stackhouse <stackhou@execpc.com> wrote:
> Abigail,
>
> My sincere apologies. Below is a clip from a previous post,
> Calling all "Newbies" As far as I can tell, only one person
> responded to this post. Since I didn't get any objections, I assumed this
> would be acceptable to all. Sorry, my error! This was just my feeble
> attempt to help correct an obvious source of irritation in this Usenet.
> Looks like it's not going to work. I guess I'll just trash to whole idea.
> Again, I apologize... I guarantee you'll not see a post of this nature
> from me in the future. In this group you're Damned if you do and Damned
> if you don't! I'm outa here!
It's not really what you do - it how you do it and what you did before.
I.e. - I've been over the documentation in the faq and the manual and I
STILL can't figure out how faq #x is supposed to work.
Or
How can you get the length of an array that's an element another array?
The best answer I've seen to this came was by Abigail in clpm here's
the code sample.
See the difference?
The rest of her comments was just better answers - for example if you're
doing html parsing then the thing to do is use HTLML::Parser, not give a
regex which is only of limited use - if you wanted to give the regex
anyway the thing to do is to say that it's fine if you have a limited
data set (maybe scanning for mailto addresses in a text file) but not
for general html parsing.
--
John Moreno
------------------------------
Date: Mon, 23 Mar 1998 19:40:40 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: - Limiting the length of a list on a page..... -
Message-Id: <3516aca8.524144494f47414741@radiogaga.harz.de>
James (James@cydaps.nospam.co.uk) wrote:
: I have a script that pulls details of the jobs for a specific agency
: from a database of several agencies. The results are then displayed in
: list format on the web page, but often each agency can have several
: hundred jobs, and I was wondering how I could limit the list of jobs per
: page. It would need to work in a similar manor to altavista or yahoo etc
: where you can click a link to view the next 10 matches etc... I have the
: script working and the format sorted, but I have not yet managed to work
: out how to display 10 or 20 matches etc at a time...
That's exactly what Randal Schwartz presents in his WebTechniques column
#2 at http://www.stonehenge.com/merlyn/col02.html
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Mon, 23 Mar 1998 21:12:28 GMT
From: "Doug Evans" <doug@ccinet.com>
Subject: Calling all Newbies
Message-Id: <0fAR.8$3C.163891@katana>
Hi,
I would like to propose, that we "Newbies" set up a mail list, designed to
help each other. I am "all the way up" to p. 25, of Learning Perl on Win32
systems-:), and have already run into a number of problems. By the way,
virtually every question that I have asked, on this newsgroup, was answered,
or led me to the answer, to my problem.
It seemed's to me, that if we formed a list, we could create a usable faq,
based on our experiences, as newbies, struggling to learn, that would serve
as a learning tool, for future newbies.
Any takers?
Doug Evans
------------------------------
Date: Mon, 23 Mar 1998 13:32:06 -0800
From: Silvio Picano <spicano@ptdcs2.intel.com>
Subject: Re: Creating a unique id number?
Message-Id: <3516D4D6.41C6@ptdcs2.intel.com>
khaines@oshconsulting.com wrote:
>
> You won't be able to determine with certainty which ID in a given second was
> created before another, but all of the PIDS from a previous second will have a
> lower numerical value than all of the PIDS from the current second.
Not true; AIX reuses expired PIDs (i.e., not sequential as with sunos).
Silvio
------------------------------
Date: Mon, 23 Mar 1998 20:42:24 GMT
From: bounce@localhost.com (MistaK)
Subject: Re: Creating an array for e-mail addresses for online form
Message-Id: <35157f68.49881016@news.seed.net.tw>
On Tue, 17 Mar 1998 15:10:47 -0500, Kurt Stype <kurt.stype@bani.com>
wrote:
>Hello all.
>
>I need to have a user fill out a form that they can use to request
>infomation about various topics. Each topic on the form has a checkbox
>next to it and each selection if checked might have a specific e-mail
>address that gets added to the "send to" list. I need some neat code
>that will check if the topic was selected and add the appropriate e-mail
>address to the "send to" array. Then when the mail is sent, the "send
>to" array is used to populate the mail programs "To:" field.
>
>Can anyone help?
>
>Thanks!
Try this javascript code to do the trick ;-)
cybercrack @ hotmail.com
<!-- TWO STEPS TO INSTALL MULTIPLE MAILER:
1. Paste the specified coding into the HEAD of the HTML document
2. Put the last code into the BODY of your HTML document -->
<!-- STEP ONE: Copy this code into the HEAD your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available online from -->
<!-- The JavaScript Source!! http://javascriptsource.com -->
<!-- Begin
var next=","
var recipient="you@yoursite.com,";
function changeRecipient(form) {
if (document.forms[0].recipient1.checked)
{recipient+="recipient1@aol.com"+next;}
if (document.forms[0].recipient2.checked)
recipient+="recipient2@aol.com"+next;
if (document.forms[0].recipient3.checked)
recipient+="recipient3@aol.com"+next;
if (document.forms[0].recipient4.checked)
recipient+="recipient4@aol.com"+next;
if (document.forms[0].recipient5.checked)
recipient+="recipient5@aol.com"+next;
if (document.forms[0].recipient6.checked)
recipient+="recipient6@aol.com"+next;
if (document.forms[0].recipient7.checked)
recipient+="recipient7@aol.com"+next;
if (document.forms[0].recipient8.checked)
recipient+="recipient8@aol.com"+next;
if (document.forms[0].recipient9.checked)
recipient+="recipient9@aol.com"+next;
if (document.forms[0].recipient10.checked)
recipient+="recipient10@aol.com"+next;
window.location="mailto:"+recipient;}
// End -->
</SCRIPT>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<CENTER>
<FORM action="">
<TABLE BORDER>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient1></TD>
<TD align="left">Recipient 1's Name</TD>
</TR>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient2></TD>
<TD align="left">Recipient 2's Name</TD>
</TR>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient3></TD>
<TD align="left">Recipient 3's Name</TD>
</TR>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient4></TD>
<TD align="left">Recipient 4's Name</TD>
</TR>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient5></TD>
<TD align="left">Recipient 5's Name</TD>
</TR>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient6></TD>
<TD align="left">Recipient 6's Name</TD>
</TR>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient7></TD>
<TD align="left">Recipient 7's Name</TD>
</TR>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient8></TD>
<TD align="left">Recipient 8's Name</TD>
</TR>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient9></TD>
<TD align="left">Recipient 9's Name</TD>
</TR>
<TR>
<TD><INPUT TYPE=CHECKBOX name=recipient10></TD>
<TD align="left">Recipient 10's Name</TD>
</TR>
<TR align=center><TD colspan=2>
<input type="button" value="Send Mail"
onClick="changeRecipient(this.form);"></TD>
</TR>
</TABLE>
</FORM>
</CENTER>
<!-- Script Size: 2.69 KB -->
------------------------------
Date: Mon, 23 Mar 1998 15:07:44 -0500
From: Kevin Miles <kmiles@erols.com>
Subject: Re: help me, I'm desperate
Message-Id: <3516C110.7613@erols.com>
http://www.cgi-resources.com
PMS wrote:
>
> To all:
>
> I just need somebody, somewhere to recommend a good website where I can get
> some examples of CGI script/Perl code that will allow information entered
> in a form to be downloaded into a text file on my end. That is, I'm
> developing on-line registration for an orientation program and just need
> one good example of code that will allow the information sent to me to be
> appended to a regular, old text file. I've looked at many, many sites on
> the Web and found not ONE example of this! And I think this is a fairly
> common procedure...
> Thanks,
> Holly from Georgia Tech
------------------------------
Date: Mon, 23 Mar 1998 20:27:09 GMT
From: "Jere C. Julian" <julianje@iname.com>
Subject: Help: AS400 Perl Savf Install Problems.
Message-Id: <3516C525.FF36DDD4@iname.com>
I have FTP'd from CPAN the AS400 perlpgm.savf binaries.
then on my 400 types CRTSAVF FILE(MYLIB/PERLPGM) TEXT('AS/400 Perl
Executables')
Binary ftp the perlpgm.savf from my pc to myas400:MYLIB/PERLPGM
I get the following:
ftp> put perlpgm.sav misjcj/perlpgm
200 PORT subcommand request successful.
150 Sending file to member PERLPGM in file PERLPGM in library MISJCJ.
-> netout:Connection reset by peer
426-Cannot write to member PERLPGM in file PERLPGM in library MISJCJ.
426 Data transfer ended.
45056 bytes sent in 3.18 seconds (14.17 Kbytes/sec)
ftp>
What am I missing?
FTP from the 400 gives:
> get perlpgm.sav misjcj/perlpgm (replace
200 PORT command successful.
150 Opening BINARY mode data connection for perlpgm.sav (7645959 bytes).
Cannot write to member PERLPGM in file PERLPGM in library MISJCJ.
No response from remote host; all connections closed.
DSPJOBLOG returns:
5 > ftp serv1
Save file PERLPGM in library MISJCJ cleared.
Incorrect record for output operation to save file.
HELP:
Additional Message Information
Message ID . . . . . . : CPF5175 Severity . . . . . . . : 40
Message type . . . . . : Escape
Date sent . . . . . . : 03/23/98 Time sent . . . . . . : 15:21:53
Message . . . . : Incorrect record for output operation to save file.
Cause . . . . . : An incorrect record was output to save file PERLPGM in
MISJCJ. The condition code is 1. Condition codes and their meanings follow:
1 -- A record is out of sequence. The data you are trying to write into
the save file may not be from a save file;
Any help on this matter would be much appreciated preferrably by email but
reply to group is okay too.
Sincere thanks,
-Jere
--
+----------------------------------------------------------------------+
| Jere C Julian PO Box 100, 166 Teague Town Rd. 704-495-2304 |
| Network Administrator Hickory, NC 28601 Fax: 704-495-2260 |
| LADD Upholstery Group: Barclay-Clayton Marcus-Pennsylvania House |
| mailto:julianje@iname.com http://www.laddfurniture.com/ |
+----------------------------------------------------------------------+
------------------------------
Date: Mon, 23 Mar 1998 20:10:47 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <1d6cee7.1mp8yxe102hgyjN@roxboro0-004.dyn.interpath.net>
Mark Stackhouse <stackhou@execpc.com> wrote:
> I am not a programmer, but I'm still expected to get the job done. In a
> UNIX environment, AWK, SED, and GREP, don't quite get the job done.
Well, as any number of people are bound to tell you - this is the
problem. You either need to BECOME a programmer or you need to tell
your bosses that they MUST hire one to get the job done.
You don't have to become a expert programmer, or the worlds best, but
you do need to become one.
It's a highly technical and specific job - you (and your bosses) need to
understand that and that to do the job decently you'll have to learn to
be a programmer.
You can do this in steps (like being a mechanic and learning how to
change the oil, and then maybe the sparks plugs, but it's going to be a
while before you are reparing the carborator(sp?) and even longer before
you are tearing the engine apart and rebuilding it).
Perl is a programming language - you program with it. You can create
compilers, or word processors or drawing programs, machine control
programs or web browsers - basically anything that you could write in
another language you could do in perl (maybe not easily, but possible).
But it IS a programming lanuage and you have to be able to program to
get it to do what you want.
But as long as you keep trying to insist that you aren't a programmer
you're not going to get much beyond changing the tires and adding oil.
--
John Moreno
I am trying to convince the author of YA-NewsWatcher that the latest
version should be released to the public. He doesn't think there's much
interest in a new version. Help me prove him wrong. To do so, send me
mail <mailto:phenix@interpath.com> with a Subject of New YA. Comments
on what you like/dislike in the current version will be appreciated.
------------------------------
Date: Mon, 23 Mar 1998 13:52:49 -0800
From: Mike Hitchcock <mike@unival.com>
Subject: Is there a Perl Cross-Reference tool? (long)
Message-Id: <3516D9B1.735D336D@unival.com>
I've inherited a perl project that was in the form of
one massive monolithic script. I've been modularizing
it, but due to wildly excessive amounts of global variables
and other shortcuts the previous author took, I find
myself combing the new modules line by line to look for
subroutine calls. Due to the nature of the project,
the dependency tree will be fairly complex, and I want
to make each module as independent of the others as possible.
So, now (finally ;-) for the question: does anyone know of
a ("free") cross-reference tool for perl? There is a B::Xref,
which is part of the alpha Perl Compiler. I am looking into
its use now, but was wondering if there might be a simpler
tool out there.
I've written some quick-n-dirty perl parsing reqexes that catch
about 85% of the calls, but with Perl5 object methods and
dereferencing syntax, I'm still reduced to looking at some
of the results. Then I have more scripts to process the output
into a dependency table. I've included my crude "xref.pl" below. Is
there a module to parse perl code, and/or is perl's parsing
engine available separately or will I need to dig it out myself?
TIA,
--
Mike Hitchcock
mike@unival.com
----------------------------------
#!/usr/local/bin/perl5.004 -w
use strict;
# xref.pl: extract subroutine definitions and and calls
# from input file -- c 1998 Mike Hitchcock <mike@unival.com>
# usage: xref.pl <filename>
my($file) = $ARGV[0] || die "usage: $0 <filename>";
open(IN,"<$file") or die "$file: $!";
my(@file) = <IN>;
close(IN);
$file = pop(@{[split('/',$file)]}); # basename
$file =~ s/\..*$//; # remove extension
my(%subs,%subcalls); # %subs holds subroutines defined in $file
# %subcalls holds subroutines called by $file
my(%what); # %what holds whatever looks like a subroutine
# call but will need manual inspection
my($line_num) = 0; # track line number call occurs on
my($line);
# first run through file to grab subroutine defs
foreach $line (@file) {
$line_num++;
# skip blank lines or comments
next if ($line =~ /^\s+$/ || $line =~ /^\s*#/);
# strip off trailing comments
$line =~ s/\s+#.*//;
# grab subroutines defs
if ($line =~ /sub\s+([^\s{]*)\s*{/) {
push(@{$subs{$1}},$line_num);
}
}
# $reserved is ref to array of perl reserved functions
# and operators
my($reserved) = &reserved;
# now run through again to pull out subroutine calls
$line_num = 0;
foreach $line (@file) {
$line_num++;
next if ($line =~ /^\s+$/ || $line =~ /^\s*#/);
# ignore calls to database SPL
next if $line =~ /PROCEDURE/i;
$line =~ s/\s+#.*//;
# regex matches "&foo(", "&main::foo(", "&$foo(", etc.
if ($line =~ /&([\w:\$]*)\s*\(/) {
push(@{$subcalls{$1}},$line_num) if &is_good($1,$reserved);
}
# matches "$object->method(", "$pkg::dbh->method(", etc.
elsif ($line =~ /\$([\w->:{}'"]*)\s*\(/) {
my($func) = $1;
if ($func =~ /(\w+)::(.*)/) { # match foo::bar
$func = $2 if ($1 eq "$file"); # ie, if file is foo, return
method bar
}
push(@{$what{$func}},$line_num) if &is_good($func,$reserved);
}
# match "foo("
elsif ($line =~ /(\w*)\((.*)/) {
next if $2 =~ /^\w/;
push(@{$subcalls{$1}},$line_num) if &is_good($1,$reserved);
}
}
my(@report);
print "are these subs?\n";
foreach (sort keys %what) { print $_, " [", join("
",@{$what{$_}}),"]\n"; }
print "---------------------------------\n";
print "subs defined by $file:\n";
foreach (sort keys %subs) { print $_, " [", join("
",@{$subs{$_}}),"]\n"; }
print "---------------------------------\n";
print "subs called by $file:\n";
# determine if sub being called is internal (int) or
# external (ext) to $file
foreach (keys %subcalls) {
my($func) = $_;
my($foo) = 0;
if ($func =~ /(\w+)::(.*)/) {
if ($1 eq "$file") {
$func = $2 ;
$foo = " [int] ";
}
}
$foo = (exists $subs{$func}) ? " [int] " : " [ext] " if !$foo;
push(@report, $foo . $func . " [" . join(" ",@{$subcalls{$_}}) .
"]");
}
print join("\n", sort @report);
sub is_good {
my($func,$reserved) = @_;
my($test) = (grep(/^$func$/,@{$reserved})) ? 0 : 1;
return $test;
}
sub reserved {
my(@reserved) =
("","if","new","elsif","while","unless","for","foreach",
"abs","accept","alarm","atan2","bind","binmode","bless","caller","chdir","chmod",
"chomp","chop","chown","chr","chroot","closedir","close","connect","continue",
"cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each",
"endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof",
"eval","exec","exists","exit","exp","fcntl","fileno","flock","fork","format",
"formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname",
"gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername",
"getpgrp","getppid","getpriority","getprotobyname","getprotobynumber","getprotoent",
"getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent",
"getsockname","getsockopt","glob","gmtime","goto","grep","hex","import","index",
"int","ioctl","join","keys","kill","last","lcfirst","lc","length","link","listen",
"local","localtime","log","lstat","map","m","mkdir","msgctl","msgget","msgrcv",
"msgsnd","my","next","no","oct","opendir","open","ord","package","pack","pipe","pop",
"pos","printf","print","prototype","push","qq","q","quotemeta","qw","qx","rand","readdir",
"read","readlink","recv","redo","ref","rename","require","reset","return","reverse",
"rewinddir","rindex","rmdir","scalar","seekdir","seek","select","semctl","semget",
"semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent",
"setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite",
"s","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf",
"sqrt","srand","stat","study","sub","substr","symlink","syscall","sysopen","sysread",
"system","syswrite","telldir","tell","tie","tied","time","times","tr","truncate",
"ucfirst","uc","umask","undef","unlink","unpack","unshift","untie","use","utime",
"values","vec","wait","waitpid","wantarray","warn","write","y"
);
return \@reserved;
}
#
# end of xref.pl
#
------------------------------
Date: 21 Mar 1998 00:33:54 GMT
From: spidaman@well.com (Ian Kallen)
Subject: LWP doesn't do HTTP keepalives!
Message-Id: <6ev1ti$rmb$1@was.hooked.net>
So, has anybody written keep alive client code in Perl? I sure don't want
to write it myself, I'm spoiled by LWP, I confess()!
--
Ian Kallen <spidaman@well.com>
"Like so many Americans, she was trying to construct a life that made
sense from things she found in gift shops."
-- Kurt Vonnegut, Jr.
------------------------------
Date: Mon, 23 Mar 1998 13:52:50 -0600
From: spamfree@yahoo.com
Subject: Passing reference to array of hashes: a better way?
Message-Id: <6f6eho$m48$1@nnrp1.dejanews.com>
Hi,
I'm having a problem deciding how to implement a function that reads a file
and stores some of its data in an array. Actually, the problem is deciding
how to pass the data to the caller.
After reading perlref, it seemed like I wanted an array of hashes, which I'm
building like this:
# ...
if(/^MACHDATA_OBJ_JOBNAME: (\w+)/) {
$thisrecord{'jobname'} = $1;
next;
}
if(/^MACHDATA_OBJ_DOUBLE_DATA: ([\+\-\.0-9]+)/) {
next unless ++$double_c == $dbl_rec_nr;
$thisvalue = new Math::BigFloat $1;
$number = $thisvalue->fround(10);
$thisrecord{'value'} = $number;
}
if(m{^MACHDATA_OBJ_TIMESTAMP: (\d+)/(\d+)/(\d+) (\d+):(\d+):(\d+)}) {
$month = $1 - 1; $day = $2; $year = $3;
$hour = $4 - 1; $mins = $5; $secs = $6;
$time = timelocal($secs,$mins,$hour,$day,$month,$year);
$thisrecord{'time'} = $time;
next;
}
Then, when the %thisrecord has its key/value pairs all loaded up, I want to
add it to the array I'm calling @pmdata, declared inside the function, like
this:
if(/^MACHDATA_OBJ_END_DEF/) {
push @pmdata, %thisrecord;
$inrecord = 0;
next;
}
At the end of the function, I return a reference to this array, like this:
return \@pmdata;
Is this the way to do it? Or should I pass a reference to an array *into* the
function, and have the function load it up? The problem I'm having is that
when I try to access the data, like this:
*pdata = readpmdata $fname;
pdata acts like an array of scalars, and the debugger says it has these
elements:
@pdata = (
0 'jobname'
1 'IPH'
2 'value'
3 '+7539498E-6'
4 'time'
5 866241751
6 'jobname'
7 'X025'
8 'value'
9 '+7540866E-6'
10 'time'
11 866252646
12 'jobname'
13 'X025'
14 'value'
15 '+754067E-5'
16 'time'
and so on. I can reference them as $pdata[0], $pdata[1], but what I want to
do is refer to it as $pdata[0]{'jobname'}, for example.
Thanks for any help, either by email or followup posting.
Dave
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: 23 Mar 1998 16:42:02 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Passing reference to array of hashes: a better way?
Message-Id: <3eg913v9.fsf@news.concentric.net>
spamfree@yahoo.com writes:
> push @pmdata, %thisrecord;
You meant to push a reference to the hash, not the elements of the
hash:
push @pmdata, \%thisrecord;
print $pmdata[0]->{whatever'};
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: Mon, 23 Mar 1998 13:53:44 -0600
From: Mark Gosink <mmgosink@facstaff.wisc.edu>
Subject: Please help with ACGI vs. CGI in MacPerl
Message-Id: <3516BDC6.157D@facstaff.wisc.edu>
Hello netters:
I have been running into alot of trouble with a 32k limit to my
output in a CGI application written in MacPerl to run on MacHTTP. I
have heard that it is possible to get around this limit by using
ACGI applications instead of CGI. Unfortunately, I know nothing about
ACGI except that the A stands for asynchronous. If anyone could point
me to a location where I could find out more on how to create ACGI
applications I would appreciate it. (Do I need any additional plugins
with MacPerl to create them?)
Alternatively, if someone knows of Mac server software that is
free or inexpensive that would not have these limits please let me
know.
Thanks.
Mark
------------------------------
Date: Mon, 23 Mar 1998 15:32:06 -0500
From: Kevin Miles <kmiles@erols.com>
Subject: Re: sprintf rounding error
Message-Id: <3516C6C6.662D@erols.com>
This worked:
use Number::Format qw(round);
print round($_,1);
------------------------------
Date: Mon, 23 Mar 1998 16:04:21 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Submitting to another CGI-Script
Message-Id: <comdog-ya02408000R2303981604210001@news.panix.com>
Keywords: from just another new york perl hacker
In article <Pine.GSO.3.95.980323125925.22695C-100000@cp.pathfinder.com>, "Andrew Lee (Parenttime)" <andrewf@cp.pathfinder.com> posted:
>On Mon, 23 Mar 1998, Webmaster wrote:
>> how can one Perl-Script submit FORM-Data to another
>> CGI-Script (on another server)?
>> E.g.: Submit Website-Data to multiple Searchengines.
>
>The operative words are "another server." THis means that you will need
>to use networking protocols. I would recommend looking at Socket.pm.
but there are modules that make it so one doesn't have to worry about
this sort of thing and can concentrate on getting the job done. use
LWP and save some time :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: 23 Mar 1998 14:44:20 -0600
From: Quentin Fennessy <quentin@jihad.amd.com>
Subject: Re: ts: unexpected behavior of "last" with "print"
Message-Id: <xim4t0pxhln.fsf@jihad.amd.com>
>>>>> "t" == tsatan <tsatan@hotmail.com> writes:
Follow these examples and I think you will understand:
DB<27> $x = 1
DB<28> print $x
1 # works
DB<29> print $x, last
# no output
DB<30> print ($x), last
1 # works again
parenthesizing args to print means that $x is the only thing
evaluated for the execution of the print statement.
Without parentheses print() is handed a list including
1 and last. Last gets evaluated before print, exiting
the loop.
When I replaced your print statement with this:
print ("root's pw is $1\n"), last if /^root:([^:]*)/;
I get:
: qf@jihad:~/tmp; ./ttt
print (...) interpreted as function at ./ttt line 7 (#1)
(W) You've run afoul of the rule that says that any list operator followed
by parentheses turns into a function, with all the list operators arguments
found inside the parentheses. See perlop/Terms and List Operators (Leftward).
root's pw is x
(And root's passwd is 'x', at least in /etc/passwd!)
I think this is more readable:
while (<PW>) {
if (/^root:([^:]*)/) {
print ("root's pw is $1\n");
last;
}
}
--
Quentin Fennessy AMD, Austin Texas
Secret hacker rule #11 - hackers read manuals
------------------------------
Date: Sun, 22 Mar 1998 10:25:19 +0000
From: Karl Dyson <karld@feklore.demon.co.uk>
Subject: Unlink on WinNT/95
Message-Id: <wcLLTCAPcOF1EwjB@feklore.demon.co.uk>
Hi there,
I've only recently started learning Perl and I've come across a bit of a
problem. I borrowed a bit of code from the book "teach yourself CGI
Programming with Perl 5 in a week" and it's supposed to wait until the
file counter.lock does not exist before continuing and actually creating
counter.lock itself.
i.e This is a basic form of file locking so processes can tell if the
file they need is already being worked on.
The code goes like this:
------------------------------------------------------------------------
While (-f counter.lock) {
select(undef,undef,undef,0.1;}
open(LOCKFILE, ">counter.lock");
#Do other stuff here.
#E.g. what you want the CGI program to do
close(LOCKFILE);
unlink(counter.lock);
------------------------------------------------------------------------
Problem is: this code leaves a file named counter.lock on my harddrive.
So a) the file isn't being deleted by unlink and
b) the while loop at the beginning doesn't appear to be checking if
counter.lock exists.
Baring in mind I'm using Windows95 to write this on, and it'll be
running on a WindowsNT web server - can anyone help me out?
Karl
--
Karl Dyson <karld@feklore.demon.co.uk>
"A look can be deceiving; a touch can be lethal."
------------------------------
Date: Mon, 23 Mar 1998 21:06:36 GMT
From: jgd@cix.compulink.co.uk ("John Dallman")
Subject: Re: Unlink on WinNT/95
Message-Id: <EqAIn0.24J@cix.compulink.co.uk>
In article <wcLLTCAPcOF1EwjB@feklore.demon.co.uk>,
karld@feklore.demon.co.uk (Karl Dyson) wrote:
> I borrowed a bit of code ... it's supposed to wait until the file
> counter.lock does not exist before continuing and actually creating
> counter.lock itself.
> While (-f counter.lock) {
> select(undef,undef,undef,0.1;}
> open(LOCKFILE, ">counter.lock");
>
> #Do other stuff here.
> #E.g. what you want the CGI program to do
>
> close(LOCKFILE);
> unlink(counter.lock);
Try eliminating the bare words, and checking the error returns. Are you
sure which directory is the current directory when you run this?
$fn = "counter.lock";
While (-f $fn)
{
sleep(1); # I'm not sure if select() works right on Win32
}
open(LOCKFILE, ">$fn") || die "Failed to open $fn: $!";
#Do other stuff here.
#E.g. what you want the CGI program to do
close(LOCKFILE) || die "Failed to close $fn: $!";;
if( unlink($fn) < 1)
{
die "Failed to unlink $fn: $!";
}
See if this can tell you what the problem is.
---
John Dallman jgd@cix.co.uk
------------------------------
Date: Mon, 23 Mar 1998 14:55:15 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
Subject: Re: Variable question
Message-Id: <3516BE23.E675D7E1@shopcfn.com>
Jim Brewer wrote:
>
> Tom Christiansen <tchrist@mox.perl.com> writes:
>
> > In comp.lang.perl.misc, "Shawn M. Kelly" <kellysm@ix.netcom.com> writes:
> > :I have a data file that looks like this:
> > :door1 5.0
> > :door2 2.0
> > :door3 7.0
> >
[SNIP]
> > while (<>) {
> > ($door, $number) = split;
> > $valuables{$door} = $number;
> > }
> >
> > foreach $door (sort keys %valuables) {
> > $contents = $valuables{$door};
> > print "$door equals $contents\n";
> > }
> Dear Tom,
>
> wouldn't you want to use chomp($number) to remove the newline hanging on the end of the 'number'?
[SNIP]
i think, if you run a little test, you would find that there
is no \n on the end of $number. after all \n is matched by \s+,
which is split's default regex.
cheers,
--
# dan boorstein <dboorstein@shopcfn.com>
seek DATA,0,0;print scalar<DATA>,__END__
Just another Perl hacker,
------------------------------
Date: Mon, 23 Mar 1998 20:11:09 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: Wanted: email address gleaner
Message-Id: <1d6cfrb.v0wiq91117l1cN@roxboro0-004.dyn.interpath.net>
Sneex <chasecreek.systemhouse@usa.net> wrote:
> Allow me to end this thread now :-)
>
> I will write the gleaner program for $10,000.
> (I need a new G3 PowerMac laptop, and an Ultrasparc 5 :-)
>
> Yes, I am serious. Someone needs to make some money;
> might as well be me :-)
>
> There,
> Sneex :-)
>
> Jeff Potter wrote:
>
> > Any offline project involving a newsgroup interest will cost money.
>
> PS - No, I won't volunteer. And yes, I can provide references.
Well, I've already written one that works well enough for what I needed
it for - I'll volunteer to provide it for a measly 3k (I need a G3, but
not the Ultrasparc).
--
John Moreno
------------------------------
Date: Mon, 23 Mar 1998 15:31:57 -0500
From: Aaron R Kulkis <akulkis@be1151.pd3.ford.com>
Subject: Re: What does "UNIX" stand for..
Message-Id: <3516C6BD.534F@be1151.pd3.ford.com>
Chris Mikkelson wrote:
>
> "Phlip" <tegan@deltanet.com> writes:
> > M.Ranganathan wrote:
> > >On the other hand Windows has the well-deserved nick name of "Windoze".
> > >Recently, I lost a whole directory (I kid you not) merely by assuming
> > >my Windows NT box died (when it was merely dozing) and turning it off.
> > >( Incidentally does anybody know what the deuce it is doing when it is
> > >playing possum like that? )
> >
> > Running a screen saver?
>
> Just taking up space?
Wasting electrons!
--
Aaron R. Kulkis
Unix Systems Administrator
---------------------------------------------------------------------------
I speak for me, not my employer
---------------------------------------------------------------------------
"What's wrong with 3rd party tools? Especially if they are free?
What the hell do you think unix is anyway? It's a big honkin' party
of 3rd party free tools." --Bob Cassidy (rmcassid@uci.edu)
------------------------------
Date: Mon, 23 Mar 1998 21:34:13 GMT
From: rsrodger@wam.umd.edu (Rob Rodgers)
Subject: Re: What does "UNIX" stand for..
Message-Id: <3516d531.15928281@news.wam.umd.edu>
Aaron R Kulkis <akulkis@be1151.pd3.ford.com> wrote:
Need Another Seven Astronauts.
------------------------------
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 2166
**************************************