[11739] in Perl-Users-Digest
Perl-Users Digest, Issue: 5339 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 9 12:07:31 1999
Date: Fri, 9 Apr 99 09:00:22 -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 Fri, 9 Apr 1999 Volume: 8 Number: 5339
Today's topics:
==> keys() with hash reference <== <Andreas.Fischer@Sun.COM>
Re: ==> keys() with hash reference <== (Larry Rosler)
Re: Anyone help with reading from data file? Read here (Daniel Beckham)
Can you use defined() on a typeglob? (Daniel Beckham)
cbc_encrypt() and cbc_decrypt() bing-du@tamu.edu
Re: Could someone please tell me...... (Sam Holden)
dir list utility (BLUESRIFT)
Re: Enclosing a binary within perl <linux2000@hotmail.com>
Four-arg select on STDIN broken in Win95? <chess@watson.ibm.com>
Re: ftp problem with NET::FTP <M.Roessiger@alcatel.de>
Glob Problem <martin@guest-books.com>
Re: Glob Problem (Sam Holden)
Re: Glob Problem <martin@guest-books.com>
HELP! Code needed for line of best fit?!?!? <p8e77@keele.ac.uk>
HELP-shopping cart help <erik@rockymountainwebtech.com>
Is Javascript better than Perl? (Macrosheep)
Re: Is Javascript better than Perl? (David Turley)
Re: Is Javascript better than Perl? <ebohlman@netcom.com>
Re: Is Perl the right tool for the job jay_ethridge@my-dejanews.com
looking for capacity planning resources: perl/oracle <jgm@home.com>
Perl conception (Aaron)
Piping Input into a Perl script on NT lingane@my-dejanews.com
Re: Piping Input into a Perl script on NT <ebohlman@netcom.com>
Re: Privacy for slaves forced to use a proxy/firewall t <jfrost@edstrom.com>
Reading from STDIN, VMSperl + DCL (Rich Lafferty)
Re: Returning "undef" from a subroutine. Appears broken <tbutler@rational.com>
Re: Sys::Syslog (Marc Haber)
Thank You comp.lang.perl.misc! <adickinson@barr.com>
Re: Thank You comp.lang.perl.misc! (Randal L. Schwartz)
Re: why my map diff to a loop? (Larry Rosler)
Re: Y2K (yes, again - sorry!) <gellyfish@gellyfish.com>
Yet another regexp question <clwolfe@indiana.edu>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 09 Apr 1999 17:07:55 +0200
From: Andreas Fischer <Andreas.Fischer@Sun.COM>
Subject: ==> keys() with hash reference <==
Message-Id: <370E17CB.4ECF1257@Sun.COM>
Hi,
I've got a little problem with the "keys()" function.
How can I use the reference of a hash for building a keys array?
Example:
#!/usr/local/bin/perl -w
%hash=("1","a","2","b","3","c");
$rhash=\%hash;
@tmp1=keys(%hash);
@tmp2=keys($$rhash);
print"tmp1=@tmp1, tmp2=@tmp2\n";
Who can help me :-)
Thanks in advance
Andi
***************************************************************
Andreas Fischer
Technical Account Manager (Finance Team)
SUN Microsystems GmbH Tel: (++49) 6103 752 196
Amperestr. 6 Fax: (++49) 6103 752 161
D-63225 Langen Andreas.Fischer@germany.sun.com
***************************************************************
------------------------------
Date: Fri, 9 Apr 1999 08:29:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: ==> keys() with hash reference <==
Message-Id: <MPG.1177bcb0e694d936989877@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <370E17CB.4ECF1257@Sun.COM> on Fri, 09 Apr 1999 17:07:55
+0200, Andreas Fischer <Andreas.Fischer@Sun.COM >says...
> I've got a little problem with the "keys()" function.
> How can I use the reference of a hash for building a keys array?
>
...
> $rhash=\%hash;
> @tmp1=keys(%hash);
> @tmp2=keys($$rhash);
@tmp2 = keys %$rhash;
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 09 Apr 1999 15:45:02 GMT
From: danbeck@qual.net (Daniel Beckham)
Subject: Re: Anyone help with reading from data file? Read here.
Message-Id: <7el3v3$hdm@nnrp3.farm.idt.net>
Ok, to make it simple:
open ( FH, $file3) || die $!
@file_contents = reverse <FH>;
close (FH)
DONE!
In article <370a2bfe@news.greatbasin.net>, "Freaky" <D@nt.Email.Me> wrote:
>Does anyone know how to read a data file in reverse order? I use the format
>open (HEADERREAD, "$file3") or die "Unable to open...
>and it will only read in normal order. Im just curious if theres a way to
>reverse it. Thanks.
>
------------------------------
Date: Fri, 09 Apr 1999 15:52:04 GMT
From: danbeck@qual.net (Daniel Beckham)
Subject: Can you use defined() on a typeglob?
Message-Id: <7el4c9$hdm@nnrp3.farm.idt.net>
I need to check to see if a filehandle is defined. Can I use a defined() o a
typeglob?
if (defined *FH) {
&do_something;
}
Common sense would say yes, but I can't find any specfic information about it.
The definition of defined() doesn't really mention typeglobs.
Thanks,
Daniel Beckham
------------------------------
Date: Fri, 09 Apr 1999 14:31:09 GMT
From: bing-du@tamu.edu
Subject: cbc_encrypt() and cbc_decrypt()
Message-Id: <7el2vd$iij$1@nnrp1.dejanews.com>
Greetings all,
I need to use cbc_encrypt() and cbc_decrypt() in my Perl code. Which module
are they in? I have Perl 5.005. How to lookup their specification?
Thanks in advance for your help.
Bing
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 9 Apr 1999 15:00:06 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Could someone please tell me......
Message-Id: <slrn7gs5fl.mi0.sholden@pgrad.cs.usyd.edu.au>
On Fri, 9 Apr 1999 14:27:07 +0200, Jon <jon@ukonline.net> wrote:
>Is Perl v5.004_04 Y2K compliant?
>
>If so would you be able to point me in the right direction for getting
>official confirmation please?
You could have a look around yourself first...
There's this thing commonly called 'the web' that contains lots of information
about lots of things... www.perl.com might be a good start...
There's this thing on that web thing called dejanews that will let you search
previous posts on this newsgroup and find that this may have been asked (and
may have even been answered) more times than I bet you think...
There's also this thing known as documentation. It comes with perl. There's
a whole lot of FAQs... You could try reading them...
There's also the license that you have agreed to in order to use perl... it
might mention something about warrantie and fitness in it...
--
Sam
If your language is flexible and forgiving enough, you can prototype
your belief system without too many core dumps.
--Larry Wall
------------------------------
Date: 9 Apr 1999 15:58:52 GMT
From: bluesrift@aol.com (BLUESRIFT)
Subject: dir list utility
Message-Id: <19990409115852.22299.00000595@ng-fw1.aol.com>
Attempting to ascertain the correct method (if possible) to display a directory
listing for users given any http:// root address. Purpose to allow for user
selection of a file name from that directory listing for inclusion as a
hyperlink or image tag in a perl generated html page. Such list to optimally
provide for drill down to sub directories and to recognize file types. Host
for script is Apache Unix, however, dir list would need to read other servers
including those not using Unix.
Suggestions? Hints?
Thank You,
Rob Bell
------------------------------
Date: Fri, 09 Apr 1999 10:14:33 -0400
From: J J <linux2000@hotmail.com>
Subject: Re: Enclosing a binary within perl
Message-Id: <370E0B48.DFFA68CB@hotmail.com>
Medtronic Employee wrote:
> The Question
> --------------
> Is there any way I can embed a binary within a perl script and have the perl
> script execute
> it? (either directly or by writing it to a file and then doing a "system" or
> shell "open" on
> that file)
The Answer (?)
-------------
#!/usr/bin/perl -w
# P O D a t t h e e n d
use Getopt::Long;
use MIME::Base64;
use diagnostics;
############################################################
# Set default names and get user's options.
############################################################
$SCRIPT = "pb-out";
$DECODE_NAME = "outfile";
GetOptions( "-encode=s" => \$opt_encode,
"-script-name=s" => \$opt_script_name,
"-decode-name=s" => \$opt_decode_name
) ;
if (!defined $opt_encode || $opt_encode eq "") {
system("perldoc $0");
exit 1;
}
$SCRIPT = $opt_script_name if ($opt_script_name);
$DECODE_NAME = $opt_decode_name if ($opt_decode_name);
############################################################
# Encode the file into a self-extracting script.
############################################################
open INFILE, $opt_encode
or die("Can't open $opt_encode");
open SCRIPT, ">$SCRIPT"
or die("Can't open new-script");
select SCRIPT;
# Write the body of the script to the script file.
# why not use a HERE doc ? because it hoses Emacs' highlighting
print "#!/usr/bin/perl -w\n";
print "\n";
print "use MIME::Base64;\n";
print "\n";
print "extract_$DECODE_NAME();\n";
print "\n";
print "sub extract_$DECODE_NAME {\n";
print " open OUTFILE, \">$DECODE_NAME\"\n";
print " or die(\"Can't open $DECODE_NAME\");\n";
print " binmode OUTFILE;\n";
print " while (<DATA>) {\n";
print " tr#A-Za-z0-9+/##cd;\n";
print " tr#A-Za-z0-9+/# -_#;\n";
print " \$len = pack(\"c\", 32 + 0.75 * length);\n";
print " print OUTFILE unpack(\"u\", \$len . \$_);\n";
print " }\n";
print " close OUTFILE;\n";
print "\n";
print " chmod 0755, \"$DECODE_NAME\";\n";
print "}\n";
print "\n";
print "__DATA__\n";
# Write the encoded data to the script file.
while (read(INFILE, $buf, 60*57)) {
print SCRIPT encode_base64($buf);
}
close INFILE;
close SCRIPT;
chmod 0755, $SCRIPT;
__END__
############################################################
# P O D F o l l o w s
############################################################
=head1 NAME
piggyback - encode a file as a self extracting perl script
=head1 SYNOPSIS
piggyback -encode <filename> [-script <scriptname>]
[-decode-name <decode-name>]
=head1 DESCRIPTION
Creates a script which, when executed, decodes the data attached to
it producing the file originally encoded. The script file produced
is structured so that it can be tacked on to the end of an existing
perl script. The extract_<whatever> function can then be called
when needed.
=head 1 OPTIONS
=item -encode <filename>
<filename> is the file to be encoded.
=item -script-name <filename>
The name of the script file to be produced. Default is B<pb-out>.
=item -decode-name <filename>
The name of the file to be produced when the script is run, or
the extract function is called. Default is B<outfile>.
=head2 Examples
piggyback -encode /bin/grep -script-name pb-grep -decode-name newgrep
Encodes /bin/grep and produces the script pb-grep. Running pb-grep will
produce the file newgrep, which is the same as /bin/grep.
=head1 SEE ALSO
MIME::Base64
=head1 BUGS
None known.
=head1 AUTHOR
John Johnson <linux2000@hotmail.com>
=cut
------------------------------
Date: Fri, 09 Apr 1999 14:35:00 GMT
From: David M. Chess <chess@watson.ibm.com>
Subject: Four-arg select on STDIN broken in Win95?
Message-Id: <7el36j$ir3$1@nnrp1.dejanews.com>
I see that lots of other people have reported similar problems,
but I haven't found any definitive answer in the group. It
looks to me like four-argument select just isn't working right
on STDIN. In particular, in Win95 this program:
use strict;
my ($rbitsin,$rbitsout,$nfound);
$rbitsin = "";
vec($rbitsin,fileno(STDIN),1) = 1;
for (;;) {
print "Sleeping; enter to exit...\n";
$nfound = select($rbitsout=$rbitsin,undef,undef,60);
print "$nfound\n";
last if $nfound > 0;
print $! if $nfound < 0;
}
just prints
Sleeping; enter to exit...
-1
Bad file number
Sleeping; enter to exit...
-1
Bad file number
and so on forever, at full speed, with no waits at all. Seems that
four-arg select just doesn't like STDIN? Is there some other way to
do the obvious "wait N seconds or until input becomes available
from the console or STDIN" sort of thing?
My perl -V, if it matters:
Summary of my perl5 (5.0 patchlevel 4 subversion 02) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32
uname=''
hint=recommended, useposix=true, d_sigaction=undef
bincompat3=undef useperlio=undef d_sfio=undef
Compiler:
cc='cl', optimize='-O', gccversion=
cppflags='-DWIN32'
ccflags ='-MD -DWIN32'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=n, randbits=15
Linker and Libraries:
ld='link', ldflags ='-nologo -subsystem:windows'
libpth=C:\program files\DevStudio\VC\lib
libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib [...]
libc=msvcrt.lib, so=dll
useshrplib=undef, libperl=undef
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags='', lddlflags='-dll'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING
Built under MSWin32
Compiled at Aug 9 1997 21:42:37
@INC:
D:\PERL\lib\site
D:\PERL\lib
c:\perl\lib
c:\perl\lib\site
c:\perl\lib\site
.
Thanks for any help!
DC
http://www.research.ibm.com/people/c/chess/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 09 Apr 1999 15:22:57 +0200
From: Martin Roessiger <M.Roessiger@alcatel.de>
Subject: Re: ftp problem with NET::FTP
Message-Id: <370DFF31.2C3F68B1@alcatel.de>
hello all,
the problem has been solved:
I forgot to close the file before ftp-transfer ! Sorry !
--
************************************************************************
* Kind regards A l c a t e l SEL *
* Martin Roessiger Dept. : VS/EFB4 *
* Tel. : +49 711 821 41871 *
* Email : mailto:M.Roessiger@alcatel.de *
************************************************************************
------------------------------
Date: Fri, 9 Apr 1999 16:00:02 +0100
From: "Martin" <martin@guest-books.com>
Subject: Glob Problem
Message-Id: <7el4jm$i47$1@newnews.global.net.uk>
Hi!
I'm having a problem with globs. I've written a script (CGI but this
isn't a CGI problem as the problem occurs when run from the
command line). Although the script works fine on an NT server, it
doesn't work fully on a Unix server and I believe this is because
of the globs. I tested the following:
perl -e "print join(' ',<*>)" on Windows NT Server
perl -e 'print join(" ",<*>)' on Unix Server
On the NT server, it did as I expected, printed the directory listing
with a space between each file name. On the Unix server nothing was
printed at all.
Martin
------------------------------
Date: 9 Apr 1999 15:19:27 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Glob Problem
Message-Id: <slrn7gs6jv.nul.sholden@pgrad.cs.usyd.edu.au>
On Fri, 9 Apr 1999 16:00:02 +0100, Martin <martin@guest-books.com> wrote:
>Hi!
>
>perl -e 'print join(" ",<*>)' on Unix Server
>
>On the NT server, it did as I expected, printed the directory listing
>with a space between each file name. On the Unix server nothing was
>printed at all.
Works fine for me with perl5.005_02 on intel linux and sparc solaris...
--
Sam
I would like to tell you that Perl is simple in its complexity. But some
people won't understand that. So pretend I didn't say that, unless you
do. --Larry Wall
------------------------------
Date: Fri, 9 Apr 1999 16:47:38 +0100
From: "Martin" <martin@guest-books.com>
Subject: Re: Glob Problem
Message-Id: <7el7eb$k0r$1@newnews.global.net.uk>
>Works fine for me with perl5.005_02 on intel linux and sparc solaris...
I'm using Perl5.004_04 could that be the problem?
Martin
------------------------------
Date: Fri, 9 Apr 1999 14:59:51 +0100
From: "Andrew Weller" <p8e77@keele.ac.uk>
Subject: HELP! Code needed for line of best fit?!?!?
Message-Id: <7el14p$4h0$1@cfs2.kis.keele.ac.uk>
Dear All,
I need to write some code that basically filters out a set of points.
With a scattering of points how does one 'filter-out' (average) the unwanted
points and is left with a line of best fit, which can then be saved to a
file?
Thanks loads,
Andy
--
Andy Weller
M.Sc. Computing in Earth Sciences
Dept. of Earth Sciences
Keele University
Staffordshire, ST5 5BG, UK
e-mail: p8e77@keele.ac.uk
Tel. (+44) 01782 246883
------------------------------
Date: Fri, 09 Apr 1999 08:28:35 -0700
From: Erik Boles <erik@rockymountainwebtech.com>
Subject: HELP-shopping cart help
Message-Id: <370E1CA2.D7AFA9BB@rockymountainwebtech.com>
Does anyone know if there is a users group or anything for Perlshop
users? I have posted my question to this NG and gotten no response and
as I am sure everyone is aware the author has failed to respond to
anyones requests but I have a problem I need to get resolved.....
Alternatively, can anyone else recommend another good shopping cart
program? Any help is greatly appreciated.....
Erik
------------------------------
Date: 9 Apr 1999 15:21:09 GMT
From: macrosheep@aol.com (Macrosheep)
Subject: Is Javascript better than Perl?
Message-Id: <19990409112109.11469.00000482@ng19.aol.com>
I'm doing a project for an Independent Study at WPI. I was wondering if anyone
had feedback concerning Java's pluses and minuses vs. Perl as a script
language?
For example, do you think Java's more client-based processing is preferable to
Perl's server-based?
Are script languages something that helps usability of the web, or are they
simply technological marvels that we do because we can, without realizing that
the average American has a slow internet connection and many have slow
computers (where Java can be quite annoying).
Any feedback, positive or negative would be appreciated. Thanks.
--Macrosheep
------------------------------
Date: Fri, 09 Apr 1999 15:39:00 GMT
From: dturley@binary.net (David Turley)
Subject: Re: Is Javascript better than Perl?
Message-Id: <370f1e87.15450070@news.erols.com>
On 9 Apr 1999 15:21:09 GMT, macrosheep@aol.com (Macrosheep) wrote:
[Courtesy copy to Macrosheep.]
>
>I'm doing a project for an Independent Study at WPI. I was wondering if anyone
>had feedback concerning Java's pluses and minuses vs. Perl as a script
>language?
So which is it? In the subject you write JavaScript, but then you ask
about Java. All three are totally different, with different purposes.
Java's pluses and minuses have nothing to do with Perl as a scripting
language.
--
David Turley
dturley@pobox.com
http://www.binary.net/dturley/
------------------------------
Date: Fri, 9 Apr 1999 15:53:31 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Is Javascript better than Perl?
Message-Id: <ebohlmanF9xIt7.8zp@netcom.com>
Macrosheep <macrosheep@aol.com> wrote:
: I'm doing a project for an Independent Study at WPI. I was wondering if anyone
: had feedback concerning Java's pluses and minuses vs. Perl as a script
: language?
: For example, do you think Java's more client-based processing is preferable to
: Perl's server-based?
1) Your subject line refers to Javascript but your message body refers to
Java. The two languages have nothing in common beyond four characters in
their names. Which one is it?
2) There's nothing inherently "client-based" about Java programs and
nothing inherently "server-based" about Perl. As far as I can tell,
you're asking how Java used to implement an applet run on a Web browser
compares with Perl used to implement a CGI script run on a Web server.
That isn't a meaningful question to ask; to compare languages, you have
to compare them on similar tasks, not wildly different ones.
------------------------------
Date: Fri, 09 Apr 1999 15:19:24 GMT
From: jay_ethridge@my-dejanews.com
Subject: Re: Is Perl the right tool for the job
Message-Id: <7el5pl$l07$1@nnrp1.dejanews.com>
In article <370A0F0C.50A9931B@pog.ufl.edu>,
William Sanns <wsanns@pog.ufl.edu> wrote:
> I've just come from a "microsoft" shop and am now managing a web based
> remote data entry system. We have a Java front end and Oracle (V7.3.4)
> on the back end. We are currently running on AIX but will migrate to
> Linux within the next 3 months. Java is working fine for most of the
> client work, but there are many instances where I would just like to
> present the user with a "report" from the database in html format (I
> would have used ASP in my "previous life"). From what I've seen, Perl
> looks like its easy to pick up, but is it capable of creating a "dynamic
> length" html page (the page would have anywhere from 0 to n number of
> records returned to the user based on their selections). We are
> considering PHP, but Perl seems more widely supported.
>
> Thanks in advance
>
> Bill
>
>
Hi,
We use perl in our shop to connect to several Oracle 8.0 DBs. We are using
Solaris, but it really doesn't matter which flavor of unix you use.
You can develop all of the stuff on your AIX box and simply move it over to
the Linux box when they are installed. If you use the DBI module, it is very
easy to talk to Oracle.
I have attached a code snippet to get you going.
NOTE: I just hacked this example together! Don't try to run it.
If you have questions about this, just email me at my mindspring account (see
below) or post here in clpm.
---------- CODE START -----------
#! /usr/bin/perl -w
use DBI;
use CGI;
## if you are using DBI and CGI, always put this BEFORE
## you connect to the database!!!
print "Content-type: text/html\n\n";
$dbSID = "put your oracle SID here";
$dbUSER = "userid";
$dbPASS = "password"; ### NOT SECURE!!!!!
$dbhM = DBI->connect( $dbSID,$dbUSER,$dbPASS,'Oracle' ) || die "Could not
connect to Oracle: $DBI::errstr";
$query = new CGI({}); ## create a blank object.
print $query->start_html;
$sql = "
SELECT
tblX.item1,
tblX.item2,
tblX.item3,
tblY.item4,
tblY.item5
FROM
XXX.SOME_TABLE_NAME tblX,
XXX.ANOTHER_TABLE_NAME tblY
WHERE
tblX.item1 = tblY.item4
";
$sth = $dbh->prepare($sql) || die "Can't prepare: $DBI::errstr";
$rc = $sth->execute || die "Can't execute: $DBI::errstr";
$rows = $sth->rows;
if ($rows == 0) { ## The query returned no data (undef).
### Do something if you don't have any rows...
next;
}
if ( $rows > 0 ) { ## The query returned data. Do something.
## you can print the beginning of a table (with headings) here.
while (($item1, $item2, $item3, $item4, $item5) = $sth->fetchrow ) {
## do something with your row...
## you can pring a single table row here...
}
## finish up the table here ( print "<\/table>\n"; )
}
print $query->end_html;
## end of program.
------- CODE END ---------
Jay Ethridge spam_proof email ==> jle123 AT mindspring DOT com
For the Spammers:
root@localhost
abuse@localhost
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 09 Apr 1999 15:58:21 GMT
From: JG Motolanez <jgm@home.com>
Subject: looking for capacity planning resources: perl/oracle
Message-Id: <370E2EBE.96D25249@home.com>
apache/perl/oracle/solaris, everything worked fine until people started
showing up :). In terms of capacity planning, I'm looking for advice on
how to figure out the number of requests my Enterprise 450 can handle at
one time before it grinds to a halt. Of course the short answer is it
depends, but what tools are good that people use to measure and, more
importantly, predict the demands their perl apps place on their
equipment.
I'm working with $ENV{PERL_DEBUG_MSTATS} at the moment, but I'm sure
this is just the beginning of what promises to be a significant learning
process.
jgm@home.com
------------------------------
Date: Fri, 9 Apr 1999 08:50:40 -0500 (CDT)
From: aaron@soltec.net (Aaron)
Subject: Perl conception
Message-Id: <Pine.LNX.4.04.9904090847560.16748-100000@localhost.pants.org>
Hi
I had someone tell me the other day that people don't use perl because of its large footprint
He went on to say that Java had a smaller footprint because it loaded its classes dynamically by nature
I was curious as to how much truth is here and how much is a misconception
It would seem to me that Java would by far have a larger footprint since the JVM would take up memory on top of the code it was executing
but Perl is in some ways the same way
is there a document that points to memory consumption difference between the two languages?
Aaron
-----
I wasn't happy that I lost a few pounds and could fit into those pants. I was happy because I didn't have any clean pants and I could fit into those pants.
Big difference!
-Thomas Musgrave
-May 4, 1998
------------------------------
Date: Fri, 09 Apr 1999 14:39:10 GMT
From: lingane@my-dejanews.com
Subject: Piping Input into a Perl script on NT
Message-Id: <7el3ed$ivv$1@nnrp1.dejanews.com>
I need to do a directory listing with a number of options and pipe that
listing into a perl script.
I am an old UNIX programmer so I must not be doing this right for Dos.
I am doing the following:
dir c:\ | script.pl
The script still expects waits for me to type in the data.
Inside the script I am using:
while (defined ($line = <STDIN>)){
}
There is a reason I must do this outside the script. It works just fine if I
do the dir command inside.
Can anyone tell how to pipe data into a perl script.
Thanks for your help.
lingane
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 9 Apr 1999 15:32:08 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Piping Input into a Perl script on NT
Message-Id: <ebohlmanF9xHtK.769@netcom.com>
lingane@my-dejanews.com wrote:
: I need to do a directory listing with a number of options and pipe that
: listing into a perl script.
: I am an old UNIX programmer so I must not be doing this right for Dos.
: I am doing the following:
: dir c:\ | script.pl
: The script still expects waits for me to type in the data.
When you use file associations on NT to automatically run a
non-executable just by typing its name, you lose the ability to redirect
its input or output, and piping is a form of redirection. Try replacing
'script.pl' with 'perl script.pl'.
------------------------------
Date: Fri, 9 Apr 1999 09:27:05 -0500
From: "Jeff Frost" <jfrost@edstrom.com>
Subject: Re: Privacy for slaves forced to use a proxy/firewall to access the net?
Message-Id: <67oP2.215$Oz.94866@homer.alpha.net>
Ahh, my lad you are sadly misguided?
So your saying that if I see a user surfing during work hours looking for a
new job, car, toaster, etc. I should look the other way. How about an
employee looking at porn, where a fellow co-worker could walk by, see it,
and sue the company for offensive work environment? What about lusers using
active desktop to have a stock-ticker running all day sucking down the
bandwidth on the LAN until productivity is affected... Now you might say to
yourself "I'm only one person, it can't make more than a tiny ripple in the
network traffic." And you would be right! But then if everyone thought
that way... I would have 175 employees doing the same thing, and that I
assure you would affect speed.
My policy: If you are off the clock or on lunch, go wherver you want
(except porn, hate sites, etc.). But if it is during work hours, it should
be work related. Am I a Nazi admin? No, I am not. I let all sorts of
little things slip... if someone bops in once and awhile, hits a page, and
gets right out... well, to me that's nothing in the grand scheme of things.
But an employee who is surfing for hours a day... now why the #%!@ should
the company look the other way? The employee is there to work, that's why
it is called work. I have a special hate for idiots like you who are too
smart for their own good. I wish you worked here, so I could get a hard
copy of all the crap you must enjoy doing, and send it to the owner. If you
don't enjoy being a cube slave, well then I am sure you know where the door
is... go into business for yourself and do whatever you want!
Jeff the burned out Admin
foj@nym.alias.net wrote in message <7ejqpi$ibv$1@nnrp1.dejanews.com>...
>In article <370CFD2F.D8C81B45@tivoli.com>,
> john_warner@tivoli.com wrote:
>> Not that it what he wants exists anyway...Stop and think about how IP
works
>and
>> how an IP datagram is structured. Word 4 contains the source address and
>word 5
>> contains the destination address. Without those tidbits in the IP
header, the
>> datagram isn't going anywhere and IP does not support encryption. (You
can
>> however, encrypt the data portion of an IP datagram.)
>
>I fully realize how an IP packet is structured, and that the encrypted data
>must be put in the data area. Indeed.
>
>Let me do some diagraming for you:
>
>
><Evil net user in company
>or country that censors
>net access>
>
> ^
> |
> |
> |
> some sort of encrypted link -
> maybe SSL via a web browser
> or SSL via some product like
> SecureCRT, or maybe via
> SSL and a browser and some
> app like the GNU httptunnel (?)
> |
> |
> v
><a computer which accepts encrypted
>http requests from the user, translates
>them to non-encypted requests, and sends
>them out on the network - then it receives http
>(or whatever) packets for the user, and sends
>them back to the user via the encrypted channel>
>
>One key is to not reveal the address the user is
>actually requesting in the IP header being sent
>to the encrypted proxy the user is using - that info
>would need to be part of the encrypted data itself.
>
>So, I've been thinking, how can a perl application
>(or some other app on a proxy or web server) do this?
>
>Is there already a solution?
>
>httptunnel is one I am checking out. It doesn't provide a secure channel in
>and of itself, but maybe it could be used to do so. Check out:
>http://www.nocrew.org/software/httptunnel.html
>
>>
>> In order to accomplish his mission, he needs to go through an anonymizer
>before
>> hitting his corporate firewall/proxy server where his network admin is
>> watching. Such animals will be non-existent (no admin right mind would
allow
>> one to exist on his network) and be shut down promptly upon discovery
(along
>> with giving the original poster his pink slip).
>>
>
>All the tight-assed admin will see is a link to a certain IP address or web
>site, and packets that look like gibberish in the data area.
>
>> In short, it ain't happen' dude, so you might as well go back to work and
stop
>> wasting time and bandwidth surfing the web. The computer and the network
to
>> which it is connected belong to the company and as such, they have a
right to
>> know how and for what purposes their equipment is being used.
>
>Employees have a copyright over their emails - and yet employers monitor
>them. Employees have a right to privacy, and yet employers belittle & break
>those rights. Employees are not robots, and yet employers treat them as
much.
>Employers can monitor the work an employee does by seeing what work he
turns
>in to his manager, or whether customers are being served by the employee &
>etc. Censoring net access is completely inappropriate though. I consider
>uncensored net access at my work to be a requirement for my presence.
>
>I want the same to be available to all who are locked away in little
cubicals,
>and all those in totalitarian countries.
>
>It seems there are a lot of similarities between totalitarian countries and
>father-knows-best tight-assed companies who censor their employees Internet
>activities.
>
>It's time for the cubical slaves to fight back! And we shall! And we will
win
>against the oppressors with nothing better to do than watch if we ever
visit a
>site that depicts all aspects of human activity, or whether we visit a
>politically incorrect site.
>
>Yes it IS going to happen in my case, and I'm going to fight for the
>availability of such technologies for others as well.
>
>Learn to trust your employees enough to leave them alone. Give them
>uncensored Internet access as a perk for their being willing to submit
>themselves to life in a cubical. The time is shortly coming when more and
>more people will be able to work from their homes - and there you're
>micromanaging activities will be far less effective. Don't treat the work
>place like a prison, with spy cameras, and packet sniffers to monitor
>employees every move. Fuck that shit!
>
>Learn to trust your citizens enough to leave them alone. You, as a
>government, have no right to censor where they go on the net. A free
society
>of uncensorced ideas is what is best for humanity and our global society.
>
>And now, we return to our regularly scheduled newsgroup...
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 9 Apr 1999 14:57:53 GMT
From: rich@vax2.concordia.ca (Rich Lafferty)
Subject: Reading from STDIN, VMSperl + DCL
Message-Id: <7el4hh$bca$2@newsflash.concordia.ca>
Excuse the crosspost; I'm not sure at this point if my problem
is more perl-related or DCL-related.
I've run into an unusual situation with perl 5.004_01 under
OpenVMS/AXP 7.1.
This:
$usrinput = <STDIN>; # asking user a yes-or-no question
works fine when I run the program directly from the DCL prompt,
i.e.,
$ perl -w editmail.plx
Unfortunately, since this program's going to be called from MAIL
(it's a wrapper to use a nonstandard editor with MAIL$EDIT), I
can't call it directly; instead, I call it from a one-line DCL
script containing the 'perl' line above.
When I do so, STDIN doesn't block; it just cruises right on past
that line without stopping.
I tried
while (sysread(STDIN,$usrin,2) == 0) { }
This also works fine when called directly ("perl -w editmail.plx"),
but when called from a DCL script, it hangs at that point.
Explanations as to why this is occuring, and hints as to how to get
around it (that is, how to get user input in a perl program called
from a DCL script) would be greatly appreciated.
Thanks,
-Rich
--
Rich Lafferty ---------------------------------------------------------
IITS/Computing Services | "Oderint dum metuant."
Concordia University | -- Lucius Accius (170-90 BC).
rich@vax2.concordia.ca -----------------------------------------[McQ]--
------------------------------
Date: Fri, 9 Apr 1999 14:29:26 GMT
From: Tim Butler <tbutler@rational.com>
Subject: Re: Returning "undef" from a subroutine. Appears broken in my latest version.
Message-Id: <ixkogkxx3y1.fsf@kinetic.atria.com>
lr@hpl.hp.com (Larry Rosler) writes:
> The test should print "defined", because the hash %f is defined. It has
> one element, whose key is the null string, and whose value is undef.
Ah, that explains this undef example from the perlfunc manpage:
return (wantarray ? () : undef) if $they_blew_it;
(I didn't pick up that it was explictly avoiding returning undef in
list context.)
> This would be a lot clearer if you ran your test with the '-w' flag,
I had with the larger original program, but even in my short example
that doesn't work with every version of perl I have:
$ /usr/local/bin/perl5.002 -w ./s1
undefined
$ /usr/local/bin/perl5.003 -w ./s1
undefined
$ /usr/local/bin/perl5.00502 -w ./s1
Odd number of elements in hash assignment at ./s1 line 7.
Use of uninitialized value at ./s1 line 7.
defined
$ cat s1
#!/usr/local/bin/perl -w
sub func {
return undef;
}
%f = func();
if (defined %f) {
print "defined\n";
} else {
print "undefined\n";
}
Is the warning new in version 5.005, or are my older builds broken?
I've fixed it as suggested, and avoid the undefined (?) behavior
above:
#!/usr/local/bin/perl -w
sub func { return (); }
%f = func();
if (%f) {
print "non-empty\n";
} else {
print "empty\n";
}
thanks for the assistance,
tim
------------------------------
Date: Fri, 09 Apr 1999 13:52:29 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Sys::Syslog
Message-Id: <7el0mu$s72$1@news.rz.uni-karlsruhe.de>
Kozo <kozo@pobox.sk> wrote:
>perl is This is perl, version 5.004_04 built for i386-linux
>from perl-5.004m4-1 on RH 5.2
There are some rumours of a broken perl with certain RedHat versions.
This is known to affect majordomo.
>simple example:
>--
>#!/usr/bin/perl -w
>use Sys::Syslog
>
>openlog('test', 'pid', 'LOG_LOCAL6')
>syslog('warning', 'only test: %d', time)
>closelog()
Aside from the fact that your example code is missing some semicolons,
it seems to work reasonably well on my system (Debian 2.1).
|mh@torres:/mnt/main6/home/mh/stuff > perl -v
|
|This is perl, version 5.004_04 built for i386-linux
|
|Copyright 1987-1997, Larry Wall
|
|Perl may be copied only under the terms of either the Artistic License or the
|GNU General Public License, which may be found in the Perl 5.0 source kit.
|
|mh@torres:/mnt/main6/home/mh/stuff > cat test
|#!/usr/bin/perl -w
|use Sys::Syslog;
|
|openlog('test', 'pid', 'LOG_LOCAL6');
|syslog('warning', 'only test: %d', time);
|closelog();
|mh@torres:/mnt/main6/home/mh/stuff > ./test
|mh@torres:/mnt/main6/home/mh/stuff >
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: Fri, 09 Apr 1999 09:36:29 -0700
From: Aaron Dickinson <adickinson@barr.com>
Subject: Thank You comp.lang.perl.misc!
Message-Id: <370E2C8C.256031D7@barr.com>
I posted a question about directory traversing on 4-8-99 and within just
an hour I received several replies which should solve my problems, each
in a different way. Thank you all for being roll models for other
programmers out on the Net... I wish everyone gave advice as freely and
knowledgeable as you!
------------------------------
Date: 09 Apr 1999 08:47:49 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Thank You comp.lang.perl.misc!
Message-Id: <m1hfqpvlqy.fsf@halfdome.holdit.com>
>>>>> "Aaron" == Aaron Dickinson <adickinson@barr.com> writes:
Aaron> Thank you all for being roll models for other programmers out
Aaron> on the Net...
I'm thinking of something wicked regarding "look at these buns", but
I'm probably just suffering sleep deprivation.
:)
--
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@teleport.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: Fri, 9 Apr 1999 07:57:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: why my map diff to a loop?
Message-Id: <MPG.1177b523988c52a6989876@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <370DBD78.CF03E288@hotmail.com> on Fri, 09 Apr 1999 09:42:32
+0100, Richard H <rhrh@hotmail.com >says...
+ Im trying to replace a loop with a map but cant quite see why im not
+ gettin the array processed in the same way.
+ Does map not just pass $_ through if no operation is performed on it?
Not at all. Map always returns the value of the last expression
evaluated.
+ These are my versions:
+
+ @nums = (0.123,1.1234,2.345345,0,undef,3.467467,6,7,8);
...
+ @nums5 = @nums;
+ for (@nums5) {
+ $_ = sprintf("%2.2f",$_) unless ($_ == 0);
+ }
...
+ Output:
+
...
+ nums5>0.12 1.12 2.35 0 3.47 6.00 7.00 8.00
+
+ where the output i want is equiv to nums5, but i cant get it with map?
nums6 = map {
$_ ? sprintf '%2.2f', $_ : $_;
} @nums;
+ Any explanations??
The test on $_ succeeds if $_ is defined and has a value other than 0.
Using the '-w' flag will help you see where you are doing invalid
operations on undef.
--
(Just Another Larry) Rosler
------------------------------
Date: 9 Apr 1999 11:13:31 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Y2K (yes, again - sorry!)
Message-Id: <7ekncs$1bd$1@gellyfish.btinternet.com>
On Fri, 09 Apr 1999 09:18:59 +0100 Matt Sergeant wrote:
> Someone mailed me directly the other day (like I'm some kind of
> authority on the subject!) asking me for a statement as to whether perl
> was y2k compliant. I gave the standard answer, and the URL on
> www.perl.com.
>
> Then they asked me to fax a company letter letter headed statement
> stating what I had said. Obviously my company isn't in that business
> (scares the pants off me being liable for some company's y2k compliance)
> and I don't want to do that, so can someone give me some clues as to
> what to tell them - or alternatively I can just ignore this person...
>
It sounds like someones brief have got their knickers in a twist. I guess
they're looking to have some evidence for a court case if it all goes
horribly wrong for them. I have no idea what the legal position in your
neck of the woods is but I would either ignore them totally or reply
saying that you arent an authority on this matter.
'tis a bit worrying though - people thrashing around blindly like this
looking for compliance statements from random people.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Fri, 09 Apr 1999 10:21:43 -0500
From: Clinton Wolfe <clwolfe@indiana.edu>
Subject: Yet another regexp question
Message-Id: <370E1B07.968C58F4@indiana.edu>
I'd like to find all occurences of the string "<img" that don't have
"alt" before the ">". (Hmmm... what am I up to, one wonders? :)
$content is the entire contents of an HTML file.
$linenum is the current line number ( I track this so I can record at
which line I got a match).
$current is the contents of the file from $linenum to the end of the
file.
(ineffiecent, but see the footnote at the end).
I keep my regexp's in an PostgreSQL database, so we would typically have
something like
$reg = "(?is)^[^\n]*<img.*?>"
which should find each img tag.
It works like this:
# $reg magically springs forth from the database
$linenum = 0;
while ($content =~ /^.*$/gm) {
$curr = $& . $'; #ghastly performace hit here
$linenum += 1;
if ($curr =~ /$reg/) {
#record the fact that I got a match on $linenum
}
}
To at all img's without alt's, I tried
$reg = "(?is)^[^\n]*<img.*?[^(alt)].*?>"
which of course didn't work, it matched every img. (which it should, on
further reflection!)
I'm thinking I may need to use (?!...) but my understnading of this is
foggy at best.
Any advice about how to do this regexp?
I have the ram, the llama, and the camel books.
Thanks,
Clinton Wolfe
FOOTNOTE: I'm not concerned about performance. Here's why: this will
be run inside a web robot script (using, of course LWP::RobotUA) with
the delay set to at least 2 minutes. Just before it does an HTTP GET,
the script forks, with one child waiting 2 minutes to do the GET and the
other child processing the last html file. So I'll have a good 2
minutes to run this!
Memory, CPU aren't issues either - I'm running this script on my Sun
workstation, which really doesn't have anything else to do.
Yes, I know using $' even once will slow down the whole script. Advice
on how to avoid its use would be welcome.
Advice on how to make the script in general more effecient is welcome,
but it's just not a high priority.
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 5339
**************************************