[10472] in Perl-Users-Digest
Perl-Users Digest, Issue: 4064 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Oct 25 01:04:49 1998
Date: Sat, 24 Oct 98 23:00:17 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 24 Oct 1998 Volume: 8 Number: 4064
Today's topics:
[HELP] DBI install problem2 hooni26@my-dejanews.com
Re: CGI Help helphand@pacbell.net
Core dump after successful execution of DBD::Oracle Scr <ajit@skycorp.net>
Re: deadlock with flock() and open() (Sam Holden)
Re: deadlock with flock() and open() <rra@stanford.edu>
Re: How can I get a list of OS processes from Perl on N (Tye McQueen)
Re: How do I check input to CGI? <gellyfish@btinternet.com>
Re: How do I check input to CGI? <sjohns17@uic.edu>
Re: Installing Modules helphand@pacbell.net
Re: Lexical scoping with foreach () {} continue {} (Joergen W. Lang)
Loop problems baillie@my-dejanews.com
need info on perl compilers <mixmaster@remail.obscura.com>
Re: Newbie help--perl won't run as CGI <sjohns17@uic.edu>
Re: Not to start a language war but.. (Mike Orr)
Re: Not to start a language war but.. (Sam Holden)
Re: Not to start a language war but.. <rra@stanford.edu>
Omni /Perl/ Windows95 Shutdown (retrotek)
passing associative arrays <tobin@sji.org>
Re: passing associative arrays (Sam Holden)
Re: Perl & Y2K - booby trap code (Mark-Jason Dominus)
Re: Perl & Y2K - booby trap code (Mark-Jason Dominus)
Re: Perl scripts under NT, something not right here. <gellyfish@btinternet.com>
PERLIS.dll ---- Where are you? <steph@hotkey.net.au>
reading file and counting whitespace (Erik A Belknap)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 25 Oct 1998 05:14:41 GMT
From: hooni26@my-dejanews.com
Subject: [HELP] DBI install problem2
Message-Id: <70uc41$7r7$1@nnrp1.dejanews.com>
my os is win98
DBI install problem 2
perl makefile.pl <--- ok
nmake <enter> <--- problem . . . cp lib/DBI/FAQ.pm blib\lib\DBI\FAQ.pm cp
lib/DBI/ProxyServer.pm blib\lib\DBI\ProxyServer.pm cp lib/DBD/Proxy.pm
blib\lib\DBD\Proxy.pm cp DBIXS.h blib\arch\auto\DBI/DBIXS.h cp dbd_xsh.h
blib\arch\auto\DBI/dbd_xsh.h cp dbi_sql.h blib\arch\auto\DBI/dbi_sql.h cp
lib/DBD/NullP.pm blib\lib\DBD\NullP.pm cp lib/DBD/Sponge.pm
blib\lib\DBD\Sponge.pm cp lib/DBI/Format.pm blib\lib\DBI\Format.pm cp
lib/DBI/DBD.pm blib\lib\DBI\DBD.pm cp Driver.xst
blib\arch\auto\DBI/Driver.xst cp DBI.pm blib\lib\DBI.pm cp DriverDB.xst
blib\arch\auto\DBI/DriverDB.xst C:\PERL\5~1.005\BIN\MSWIN3~1\PERL.EXE
-IC:\Perl\5.00502\lib\MSWin32-x86- object -IC:\Perl\5.00502\lib
C:\Perl\5.00502\lib\ExtUtils/xsubpp -object_capi - typemap
C:\Perl\5.00502\lib\ExtUtils\typemap DBI.xs >DBI.tc && C:\PERL\5~1.005\B
IN\MSWIN3~1\PERL.EXE -IC:\Perl\5.00502\lib\MSWin32-x86-object
-IC:\Perl\5.00502\ lib -MExtUtils::Command -e mv DBI.tc DBI.c Usage: xsubpp
[-v] [-C++] [-except] [-prototypes] [-noversioncheck] [-nolinenumb ers] [-s
pattern] [-typemap typemap]... file.xs NMAKE : fatal error U1077:
'C:\PERL\5~1.005\BIN\MSWIN3~1\PERL.EXE' : return code '0xff' Stop.
NMAKE : fatal error U1077: 'C:\PERL\5~1.005\BIN\MSWIN3~1\PERL.EXE' : return
code '0xff' Stop. <--- problem
help me !!!!
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sun, 25 Oct 1998 00:06:44 GMT
From: helphand@pacbell.net
Subject: Re: CGI Help
Message-Id: <36326949.1548978374@news.pacbell.net>
On Sat, 24 Oct 1998 00:30:19 -0400, Errol <enyoung@echo-on.net> wrote:
[Courtesy copied emailed]
>I am trying some simple scripts and want to test them on my win 95
>desktop before uploading them.
>
>I have Sambar set up but have some problems with it.
>
>What are you all using as a test CGI environment for your scripts?
>
>Errol
>
I'm using sambar on win95 to test perl scripts. It works great.
If memory serves me right, I did have a bit of trouble initially
getting it configured right and ended up with the following
lines in sambar's config.ini file...
Perl Executable = /perl/perl.exe -Id:\perl\lib -Id:\perl\lib\site
CGI Extensions = *.pl *.cgi
Those lines were needed to get sambar to run my installed version
of perl rather than the one sambar dumps in its perl subdirectory.
Hope that helps.
Scott
--------
Delta Performance Group, "Achieving the Competitive Edge"
http://www.deltagrp.com/
------------------------------
Date: Sat, 24 Oct 1998 12:54:21 -0400
From: Ajit Deshpande <ajit@skycorp.net>
Subject: Core dump after successful execution of DBD::Oracle Script
Message-Id: <3632063D.59FC8969@skycorp.net>
Hello,
My perl script is giving segmentation faults followed by a core dump
after successful execution.
I am using perl 5.005_02 with DBD::Oracle. The following is the simple
script:
#!/usr/local/bin/perl
use DBI;
$dbh = DBI->connect('dbi:Oracle:','user/passwd');
$statement='select rownum, var1, var2 from table_name';
$sth = $dbh->prepare(qq{$statement});
$sth->execute;
my ($rownum, $var1, $var2);
$rv = $sth->bind_columns(undef, \($rownum, $var1, $var2));
while ($sth->fetch) {
print "$rownum, $comp_name : $comp_no\n";
}
$rc = $sth->finish;
Thats all!
TIA!
Ajit
ajit@skycorp.net
------------------------------
Date: 25 Oct 1998 03:59:08 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: deadlock with flock() and open()
Message-Id: <slrn7358gc.5pi.sholden@pgrad.cs.usyd.edu.au>
On 24 Oct 1998 23:26:59 GMT, Abigail <abigail@fnx.com> wrote:
>Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCCLXXIX September
>MCMXCIII in <URL:news:70qh30$iqk$1@csnews.cs.colorado.edu>:
>++ [courtesy cc of this posting sent to the despammed address to cited author via email]
>++
>++
>++ But it doesn't matter. If process number one says "lock A, then lock B",
>++ but process number two says "lock B, then lock A", you're really going
>++ to have a problem. You cannot acquire two separate lock atomically,
>++ so you'll always be vulnerable to errors in ordering. You must reduce
>++ these to one lock.
>++
>++ Suggestion: lock only a dummy third file, something of a sentinel,
>++ before attempting to access without locks the first two.
>++
>++ There's a reason that universities offer courses in operating systems
>++ and concurrency design, you know. :-)
>
>
>True to a certain extent. It only works if you can both programs.
>Often you cannot. Or you cannot know in which order files are
>locked, because it depends on external parameters.
>
>A trivial, contrieved, example. A program opens a file, locks it,
>reads the file, and for every file name found, it opens and locks
>that file. The program is smart enough to keep a graph and detect
>cycles, so it won't self deadlock if there are files A and B, where
>A contains B and B contains A.
>
>Now we run two instances of the program simultaniously; one starts
>with file A, the other with file B.
>
>
>Its a common problem in databases. One process locks table A (or just
>a page) then table B. Then another process comes in and locks B first,
>then table A. Using a third, global, lock would reduce database managers
>to silly DOS applications. There's a reason multiple processes can
>exist on certain OSses.
Isn't this very deadlock the reason you don't attempt to hold more than one
lock at a time, unless those locks are _always_ obtained in a certain order?
Then again I never studied operating systems... I did do a course on
distributed computing, which consisted entirely of doing the math to prove
that certain properties always hold. And deadlock and livelock were the things
that were most difficult (shall we say almost impossible) to avoid. Unless of
course you built in this one path of locking thing.
--
Sam
It has been discovered that C++ provides a remarkable facility for
concealing the trival details of a program--such as where its bugs are.
--David Keppel
------------------------------
Date: 24 Oct 1998 21:31:55 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: deadlock with flock() and open()
Message-Id: <yld87hurzo.fsf@windlord.stanford.edu>
Sam Holden <sholden@pgrad.cs.usyd.edu.au> writes:
> Isn't this very deadlock the reason you don't attempt to hold more than
> one lock at a time, unless those locks are _always_ obtained in a
> certain order?
> Then again I never studied operating systems... I did do a course on
> distributed computing, which consisted entirely of doing the math to
> prove that certain properties always hold. And deadlock and livelock
> were the things that were most difficult (shall we say almost
> impossible) to avoid. Unless of course you built in this one path of
> locking thing.
This tends to be a common subject in theoretical operating system classes.
The answer is that locking is something that you have to work out very,
very carefully when doing anything with concurrency and that there really
isn't any good general solution to the problem.
One of the proposals you tend to hear from theoretical OS design circles
is to have the operating system mediate all of the locks and do the
circular dependency checking itself; in other words, if process X locks
file A and then tries to lock file B, and process Y locks file B and then
tries to lock file A, the operating system would detect that X and Y are
waiting on locks held by each other and the lock attempt in both X and Y
would fail with a "deadlock broken" error.
The argument in favor of having the operating system do this is that
detecting deadlocks requires global state knowledge (in other words,
knowing about everything that's running on the system, not just the
resources of any one process), which implies that one should at least
consider moving it up into the OS.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 24 Oct 1998 21:20:49 -0500
From: tye@fohnix.metronet.com (Tye McQueen)
Subject: Re: How can I get a list of OS processes from Perl on NT
Message-Id: <70u1u1$oik@fohnix.metronet.com>
) In article <70pt1r$ghu$1@scnews.sc.intel.com>,
) m-i-r-o-s-l-a-v.d-z-a-k-o-v-i-c@intel.com says...
) >
) >if it was Perl running on Unix, I'd use 'ps' system command to look all
) >process id's on the system, or to ask for a specific one.
) >
) >Is there anything similar to this I can use on NT?
ehpoole@ingress.com (Ethan H. Poole) writes:
) If you have the Resource Kit, take a look at pulist.exe.
)
) Note that this question would have been more aproppriate in an NT newsgroup
) as it has nothing to do with Perl.
Except that you _can_ do this _in_ Perl. It is done using the
performance counters. There is a Win32::PerfLib as part of
libwin32 that should work for that.
--
Tye McQueen Nothing is obvious unless you are overlooking something
http://www.metronet.com/~tye/ (scripts, links, nothing fancy)
------------------------------
Date: 25 Oct 1998 00:59:30 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How do I check input to CGI?
Message-Id: <70tpl2$1ir$1@gellyfish.btinternet.com>
On 23 Oct 1998 13:00:09 GMT Zenin <zenin@bawdycaste.org> wrote:
> c960901@student.dtu.dk wrote:
> : I've written a small CGI script, but for some reason it doesn't behave
> : like it should. It recieves info from an applet and is supposed to
> : write that to a file. How do I check if it get's the info it's
> : supposed to? If I print the $buffer to a file just after the read(STDIN...
> >snip<
> : $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> >snip<
>
> Don't do this.
>
> Run, don't walk to the CGI.pm module. If you really want to
> get fancy, you might even want to take a look at my CGI::Validate
> module.
>
The only thing is that it appears the poor guy is running on a Novell
server - that 'sys:novonyx/blah' is a dead giveaway - and I dont think that
its entirely simple to use arbitary modules on this platform. It might be
possible to place the CGI.pm file in the same directory of the script
however.
It certainly is not possible to use modules that use XS.
Infact it might be well possible that the Perl in question is 4.036 - I think
the Perl 5 is only in Beta for release with NW5
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sat, 24 Oct 1998 20:36:10 -0500
From: Seth David Johnson <sjohns17@uic.edu>
Subject: Re: How do I check input to CGI?
Message-Id: <Pine.A41.3.96.981024203456.191386A-100000@tigger.cc.uic.edu>
On 25 Oct 1998, Jonathan Stowe wrote:
> The only thing is that it appears the poor guy is running on a Novell
> server - that 'sys:novonyx/blah' is a dead giveaway - and I dont think that
> its entirely simple to use arbitary modules on this platform. It might be
> possible to place the CGI.pm file in the same directory of the script
> however.
On what might be a side note, I had trouble implementing CGI.pm on a
Novell server (Netscape Fastrack for Netware). The older cgi-lib.pl worked
fine, though.
-Seth Johnson
------------------------------
Date: Sun, 25 Oct 1998 00:41:34 GMT
From: helphand@pacbell.net
Subject: Re: Installing Modules
Message-Id: <363472f0.1551449727@news.pacbell.net>
On Sat, 24 Oct 1998 00:29:58 +0100, "Martin" <minich@globalnet.co.uk>
wrote:
[Courtesy copy emailed]
>Hi!
>
>I'm having trouble installing a module on an NT system running
>Perl 5.
>
>The module was one from CPAN and the installation instructions
>read perl makefile.pl which worked fine and gave me the makefile
>and one called &1 of zero length. The second part is given as:
>
>make install
>
>This won't work on my system as there is not make command. I
>was wondering if anyone would be able to help me on this.
>
>Martin
>
If you are using the activestate port, use nmake
If the gs port, use dmake
Hope this helps.
Scott
--------
Delta Performance Group, "Achieving the Competitive Edge"
http://www.deltagrp.com/
------------------------------
Date: Sat, 24 Oct 1998 22:34:20 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: Lexical scoping with foreach () {} continue {}
Message-Id: <1dhfct9.11tgeyb1hrc08xN@host003-210.seicom.net>
Paul Makepeace <Paul.Makepeace@POBox.com> wrote:
> First off I wonder how many people realise a continue {} block can be used
> with a foreach statement. I say this since it's not explicitly mentioned or
> examples given in the docs according to my (possibly broken?) reading,
<snip>
>From perlfunc
=item continue BLOCK
Actually a flow control statement rather than a function. If there is a
C<continue> BLOCK attached to a BLOCK (typically in a C<while> or
C<foreach>),
....
Joergen
--
To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
"Everything is possible - even sometimes the impossible"
HOELDERLIN EXPRESS - "Touch the void"
------------------------------
Date: Sun, 25 Oct 1998 01:35:26 GMT
From: baillie@my-dejanews.com
Subject: Loop problems
Message-Id: <70tv8v$qct$1@nnrp1.dejanews.com>
I'm trying to loop through the following program so as to re-display the menu
after each action is complete, here's the script:
Someone Please tell me what I'm doing wrong here, I'd really rather not limit
this to one iteration.
#!/usr/bin/perl -w
use Fcntl qw(:flock);
use diagnostics;
$logfile = "/tmp/blah";
system "stty erase ^H";
print <<End_Of_Menu; <- if i assign "$choice = 0" and put an
\nPlease choose a menu item:\n until($choice ==4 ) {
\t\t1) Add a record the program will iterate through
\t\t2) View a record once and re-display the menu,
\t\t3) Edit a record but when another $choice is
\t\t4) Quit\n supplied, it just hangs there.
End_Of_Menu this also happens with a while($choice != 4)...
print "Enter Choice: ";
chomp($choice = <STDIN>);
if($choice == 1) {
&add_entry;
} elsif($choice == 2) {
&view_entry;
} elsif($choice == 3) {
&edit_entry;
} elsif($choice == 4) {
exit;
} else {
print "\nNot a valid choice, exiting\n";
}
<- closing brace here..........
sub add_entry {
print "\nPlease enter your login name: ";
chomp($name = <STDIN>);
print "\nPlease enter some info about the change\n";
print "End input by typing <RETURN> & ^D: ";
while(defined($_ = <STDIN>)) {
push(@comment_array, $_);
}
open(LOG, ">>$logfile") or die "Couldn't open file: $!";
flock(LOG, LOCK_EX);
seek(LOG, 0, 2);
select(LOG);
print '-' x 80, "\n";
print "$name ", scalar localtime, "\n";
print '-' x 80, "\n";
print @comment_array, "\n";
flock(LOG, LOCK_UN);
close(LOG) or die "Can't close the file: $!";
}
sub view_entry {
print "\nEnter keyword to search (i.e. name, date, etc)\n";
print "or type ALL to see the entire file\n\n";
print "KEYWORD: ";
chomp($keyword = <STDIN>);
if($keyword eq 'ALL') {
system "more $logfile";
} else {
open(LOG, $logfile) or die "Couldn't open file: $!";
$/ = '';
while(<LOG>) {
print if /\Q$keyword/s;
}
close(LOG) or die "Couldn't close file: $!";
}
}
sub edit_entry {
open(LOG, ">>$logfile") or die "Couldn't open file: $!";
flock(LOG, LOCK_EX);
system "vi $logfile";
flock(LOG, LOCK_UN);
close(LOG) or die "Couldn't close file: $!";
}
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 24 Oct 1998 22:04:18 -0700
From: Mixmaster <mixmaster@remail.obscura.com>
Subject: need info on perl compilers
Message-Id: <70ubgi$pts@sirius.infonex.com>
are there any perl compilers out there available for download?
I would love to have a list of them. thanks
------------------------------
Date: Sat, 24 Oct 1998 20:40:09 -0500
From: Seth David Johnson <sjohns17@uic.edu>
Subject: Re: Newbie help--perl won't run as CGI
Message-Id: <Pine.A41.3.96.981024203836.191386B-100000@tigger.cc.uic.edu>
On Sat, 24 Oct 1998, Matt Johnson wrote:
> In IIS 4.0 your application mapping needs to have "PERL.EXE %s %s" and not
> "%S"
>
> I sure hope this helps someone. That way my past 6 hours wouldn't have been
> as waisted.
Oh, finally I can test scripts locally! I'm going to try it out right now,
thanks! Your efforts have not been in vain.
-Seth
------------------------------
Date: 24 Oct 1998 17:59:08 -0700
From: mso@eve.speakeasy.org (Mike Orr)
Subject: Re: Not to start a language war but..
Message-Id: <70tt4s$2vp@eve.speakeasy.org>
In <70tlkq$8gu$1@csnews.cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:
>In comp.lang.perl.misc, mso@eve.speakeasy.org (Mike Orr) writes:
>:The more $@%{}/* -> => symbols, the better. Who cares
>:if the result is an unreadable code?
>This was a lie yesterday. It is a lie today. It shall be a lie tomorrow.
Which of these do you find the most readable and why?
for (keys %args) { $self->$_($args[$_]); }
self.__dict__.update(args)
def update(dict, **args):
for (key, value) in args.items():
dict[key] = value
# Later in the program.
update(mydict, subject='Hi', children_count=4)
sub update($;%) {
$dict = shift;
%args = @_;
while( ($key, $value) = each %args ) { # Incorrect?
%dict{$key} = $value;
}
}
# Later in the program.
update(%mydict, subject => 'Hi', children_count => 4);
--
-Mike Orr, mso@jimpick.com
------------------------------
Date: 25 Oct 1998 03:54:24 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Not to start a language war but..
Message-Id: <slrn73587g.5pi.sholden@pgrad.cs.usyd.edu.au>
On 24 Oct 1998 17:59:08 -0700, Mike Orr <mso@eve.speakeasy.org> wrote:
>In <70tlkq$8gu$1@csnews.cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:
>
>>In comp.lang.perl.misc, mso@eve.speakeasy.org (Mike Orr) writes:
>>:The more $@%{}/* -> => symbols, the better. Who cares
>>:if the result is an unreadable code?
>
>>This was a lie yesterday. It is a lie today. It shall be a lie tomorrow.
>
>Which of these do you find the most readable and why?
>
>for (keys %args) { $self->$_($args[$_]); }
>
>self.__dict__.update(args)
So you are claiming that self.__dict__.update(args) does the following :
for each key in the args dictionary : call the method of the same name in $self,
passing as an argument the value stored in the element indexed by that key
in a completely unrelated array.
Then perl is much cleaner, I can see what it does by the all that punctuation
telling me the 'types' of the variables and thus seeing that it makes no
sense at all...
I assume you meant something like %{$self} = %args; for the perl one...
Where the punctuation tells me what is going on : dereference $self to a hash
and assign %args to it...
>
>def update(dict, **args):
> for (key, value) in args.items():
> dict[key] = value
># Later in the program.
>update(mydict, subject='Hi', children_count=4)
Which is fine if you like overloading = to mean a couple of things...
>
>sub update($;%) {
> $dict = shift;
> %args = @_;
> while( ($key, $value) = each %args ) { # Incorrect?
> %dict{$key} = $value;
> }
>}
Doesn't the fact that you got this wrong indicate that you really don't
understand what all these $,%,@,etc... mean. Just as all the punctuation in
prose is messy if you don't understand what it means...
I like the fact that the following in perl has an obvious meaning without
any context :
%order = get_orders();
Well order is obviously a hash...
Where as the following in python (syntax may be a little off) could mean a
large number of different things :
order = get_orders()
Is order a list, a tuple, a string, a dictionary??? I Can't tell I have to
check the context and see how it is used...
># Later in the program.
>update(%mydict, subject => 'Hi', children_count => 4);
Perl's use of punctuation shows me what your sample code does, and also shows
me that it does nothing useful, and in fact is nonsense code anyway...
That punctuation you dislike happens to make perl easier to read (I know people
will laugh at using that phrase). Of course you have to learn how to read perl
first.
--
Sam
PC's are backwards ... throw them out! Linux is ok though.
--Rob Pike (on the subject of CR/LF etc)
------------------------------
Date: 24 Oct 1998 21:46:06 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Not to start a language war but..
Message-Id: <yl90i5urc1.fsf@windlord.stanford.edu>
Overall, I'd say that your post was fairly reasonable. I'd just like to
nit-pick this part:
In comp.lang.perl.misc, Mike Orr <mso@eve.speakeasy.org> writes:
> Perl evokes the image of the archetypal hacker sitting at home
> experimenting, doing it *his* way, dammit, and nobody better come tell
> him he should do it differently. The more $@%{}/* -> => symbols, the
> better. Who cares if the result is an unreadable code? Python
> adherents prefer order and clearness: they want their work readable by
> others and see their piece of code functioning in a larger whole. You
> get the feeling that Python programmers are much more likely to use the
> standard libraries and make their program conform to them, while Perl
> programmers are more likely to write their own libraries if they can,
> even if a standard library exists.
Neither this image nor this feeling are evoked for the experienced Perl
programmer. The Perl documentation itself and the Perl culture is almost
obsessive about telling people to use CPAN and the existing modules and
resources rather than writing their own, and Perl coders do care about
readable and reusable code for large projects. One of the differences I
believe may be the disagreement over whether succinct expression of
concepts contributes to readable code.
For example, I find a lot of languages less readable than Perl not because
they use more symbols or have a scarier syntax, but simply because they
take twenty lines to say something that I can say in four lines of Perl,
which means that I have to read five times as many words and figure out
five times as much structure in my head.
And of course the other common issue here is that it's quite *possible* to
write totally unreadable code in Perl, and some of us do that as a hobby
(just like some people write obfuscated C code for a hobby). Like my sig.
But I honestly think that people should consider it obvious that I would
not write code like my sig for a real programming project.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Sun, 25 Oct 1998 04:41:08 GMT
From: retrotek@cybercomm.net (retrotek)
Subject: Omni /Perl/ Windows95 Shutdown
Message-Id: <70ua54$300_002@retrotek.cybercomm.net>
I took the suggestions that I found in the group.
Omni is working great.
Perl seems to be running the scripts as I figure them
out. (much differant than unix).
I'll hold my perl module question for later.
The only problem now is shutting down Windows 95B.
It keeps telling me that Perl is running and wont let
me shut down.
After a dozen " End Task" clicks I can finally shut down.
What simple operation am I missing here.
Also,
Now, where can I find a cross referance between commands
that I will use on windows that I would have used in unix?
EG; (something like)
UNIX = Windows
Perl Do this = "%Perl do this"
Thanks
(Retrotek) New Jersey, USA
retrotek@cybercomm.net
http://www.cybercomm.net/~retrotek/
------------------------------
Date: Sat, 24 Oct 1998 10:44:55 -0700
From: Tobin Fricke <tobin@sji.org>
Subject: passing associative arrays
Message-Id: <Pine.LNX.3.96.981024104244.2147A-100000@tobin>
How do I pass an associative array to a subroutine? It seems like it
should be easy, but for some reason I'm having trouble.
%data = {'bob','1', 'joe', 'x'}
something(%data,'hello');
sub something
{ my %spork = @_[0];
my $anotherparameter = $_[1];
}
What should I change?
Thanks!
Tobin (tobin@sji.org)
------------------------------
Date: 25 Oct 1998 05:51:57 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: passing associative arrays
Message-Id: <slrn735f3t.8ee.sholden@pgrad.cs.usyd.edu.au>
On Sat, 24 Oct 1998 10:44:55 -0700, Tobin Fricke <tobin@sji.org> wrote:
>
>How do I pass an associative array to a subroutine? It seems like it
>should be easy, but for some reason I'm having trouble.
>
>%data = {'bob','1', 'joe', 'x'}
That probably doesn't do what you think...
should be %data = ('bob','1', 'joe', 'x');
Read the documentation that comes with perl for the reason why.
>something(%data,'hello');
You can either use :
something(\%data,'hello);
or
something('hello',%data);
The first one passes the hash be reference, so that you will need use
a reference in the subroutine (see the documentation again for how to use
references).
The second one turns the hash into an array and then passes it to the
subroutine (it needs to be last since perl passes the arguments in one bug
list).
>
>sub something
> { my %spork = @_[0];
> my $anotherparameter = $_[1];
> }
Of course that will have to change depending on how you decide to do it.
I'm sure this is a FAQ, but my computer is play8ing games at the moment so
I can't check the docs myself.
Search the FAQ for passing arrays to subroutines and you should find the
required information (modulus arrays and hashes of course).
--
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: 24 Oct 1998 20:16:32 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <70tql0$gpq$1@monet.op.net>
In article <Pine.SOL.3.96.981024114151.16407A-100000@taurus.cus.cam.ac.uk>,
J.P. Wright <jpw22@cus.cam.ac.uk> wrote:
>Isn't the cost 4 bytes times the number of times you store or use a date?
No.
------------------------------
Date: 24 Oct 1998 20:20:10 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <70tqrq$gql$1@monet.op.net>
In article <MPG.109b91f83063bb279898dc@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>[Posted to comp.lang.perl.misc and copy mailed.]
>
>In article <70rg3a$d1g$1@monet.op.net> on 23 Oct 1998 23:04:10 -0400,
>Mark-Jason Dominus <mjd@op.net> says...
>...
>> I believe that time.h stuff wasn't designed until sometime around
>> 1980, unless you'd like to correct me.
>
>I said "a couple of decades", which conveys the right imprecision
>without being accused of reesing.
Sorry, my mistake. I forgot how late it was already.
>> The waste space is only one
>> extra array element, a pointer. That's four bytes; eight if you want
>> to be fancy and actually include the string "Bad".
>
>A decade earlier, I crammed a virtual-memory paging system into 4K of 12
>bits-per-word RAM on a PDP-5.
I note that on a PDP-11, the code for adding 1900 to the year takes up
more than four bytes.
Shrug.
------------------------------
Date: 25 Oct 1998 00:18:31 +0100
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Perl scripts under NT, something not right here.
Message-Id: <70tn87$1in$1@gellyfish.btinternet.com>
On Sat, 24 Oct 1998 01:20:28 -0500 Matt Johnson <mjohnson@getonthe.net> wrote:
> I just upgraded from IIS 3.0 to IIS 4.0 under NT. I had Perl working fine
> under IIS 3.0, but when I upgraded to IIS 4.0 my scripts wont run now. I
> even tried reinstalling ActivePerl, but it still doesnt work.
>
> This is the response I get from the server.
> ##################################
> CGI Error
> The specified CGI application misbehaved by not returning a complete set of
> HTTP headers. The headers it did return are:
>
>
> Can't open perl script "???????????????????????????": Invalid argument
> ##################################
>
<snip>
Of course this isnt really a Perl Question at all - it is a bug in the
IIS 4 setup program.
The IIS4 installation screws with your script map. And for some reason only
known in Redmond turns the %s in the registry to %S - you will have to change
it back yourself.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
------------------------------
Date: Sun, 25 Oct 1998 15:15:15 +1100
From: Stephan Carydakis <steph@hotkey.net.au>
Subject: PERLIS.dll ---- Where are you?
Message-Id: <3632A5D3.7BFC@hotkey.net.au>
Hello All,
I have been reading the win32 faqs for running scripts under PERLIS.dll.
Apparently this dll should come with the precompiled binaries of perl.
This PERLIS.dll doesn't exist on my system.
I tried re-installing perl, but again no dll. The only dll I can find is
one called 'perl.dll'. I tried mapping this to a .plx extension, but the
server(PWS :[) returns this error: "The handle is invalid." -- it might
not be an error from the server?
Can anyone tell me why my distribution of perl(5.004_02) doesn't install
the PERLIS.dll? Can I just grab the PERLIS.dll from another install of
perl with the same build?
This may not be a 100% perl problem, but it's gotta be at least 50% ;-]
so I posted it anyways.
Thanks in advance.
___________________________________________
Stephan Carydakis steph@hotkey.net.au
___________________________________________
------------------------------
Date: 25 Oct 1998 00:45:54 GMT
From: ebelknap@runet.edu (Erik A Belknap)
Subject: reading file and counting whitespace
Message-Id: <70tsc2$cp5@newslink.runet.edu>
I am trying to read a file a search for certain info all while counting
the non-blank charcters. Any way of doing it?
I am reading in the .mailspool file and for every email I have to report
who, when, and email address and total whitespace for that email. I need
to do it for every email in the file.
Thanks
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Big South Champions 1998 !!!!!
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
My Email Address => ebelknap@runet.edu
My Personal Home Page => www.cs.runet.edu/~ebelknap
Cheerleading Home Page => www.runet.edu/~rucheer <----New
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4064
**************************************