[9241] in Perl-Users-Digest
Perl-Users Digest, Issue: 2836 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 11 03:27:33 1998
Date: Thu, 11 Jun 98 00:00:52 -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 Thu, 11 Jun 1998 Volume: 8 Number: 2836
Today's topics:
Re: [Q] unpack( q/%32C*/ ... ) kissel@kissel.spicerack.ibm.com
Blat works from command line but not in CGI script <mcate@gmu.edu>
Re: Blat works from command line but not in CGI script <bowlin@sirius.com>
Re: Certified Perl Programmers (David Adler)
Re: Crazzzzy Problem!!! (D. Pinaula)
Re: flock <tchrist@mox.perl.com>
Help with Perl CGI script <jbodine@internetpro.net>
Re: McCabe complexity analysis (Preston L. Bannister)
NEED EXPERIENCED PERL WRITER <ppdc@ix.netcom.com>
Re: New module/pragma "enum.pm" (was "fields.pm") <zenin@bawdycaste.org>
Re: Non-blocking Perl socket calls? <tchrist@mox.perl.com>
Re: pack/unpack seps <tchrist@mox.perl.com>
perl locales in RH 5.1 <see@the.sig>
Re: Perl security on NT with IIS <bowlin@sirius.com>
Re: Piping into telnet from Perl NT (Martien Verbruggen)
Re: Please help me solve my error.. <rootbeer@teleport.com>
Re: READING MAIL BY PERL (Martien Verbruggen)
reverse sorting <cessi@hantan.postech.ac.kr>
Re: reverse sorting <cessi@hantan.postech.ac.kr>
Re: Stages in a pipeline <metcher@spider.herston.uq.edu.au>
Re: thumbnails <cs@zip.com.au>
Re: thumbnails (Snowhare)
Re: Why it's stupid to `use a variable as a variable na <tchrist@mox.perl.com>
Re: Why it's stupid to `use a variable as a variable na <tchrist@mox.perl.com>
Re: Win32: File glob causes floppy to chatter <metcher@spider.herston.uq.edu.au>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 10 Jun 1998 22:18:03 -0400
From: kissel@kissel.spicerack.ibm.com
Subject: Re: [Q] unpack( q/%32C*/ ... )
Message-Id: <Pine.A32.3.91.980610221237.20034A-100000@kissel.spicerack.ibm.com>
On Wed, 10 Jun 1998, Tom Phoenix wrote:
> On Wed, 10 Jun 1998 kissel@kissel.spicerack.ibm.com wrote:
> > perl -e 'print unpack( q/%32C*/, (qq/\cA/ x 4294967295) ), qq/\n/'
> > 0 # unexpected! wanted 4294967295!
> perl -le '$_ = qq/\cA/ x 4294967295; print length'
Yes, shortly after I posted, I realized what was going on; I mistakenly
thought I was doing floating point arithmetic, and see now that the right
operand of the x operator, in Perl, is treated as a machine unsigned int,
and so, can overflow, with all that that implies.
Thank you for your help; I've learned something.
------------------------------
Date: Thu, 11 Jun 1998 01:56:29 -0400
From: "Matthew Cate" <mcate@gmu.edu>
Subject: Blat works from command line but not in CGI script
Message-Id: <6lnrhv$ibe@portal.gmu.edu>
I have an NT Server with Exchange 5.5 and IIS 4 installed. I've installed
Blat to e-mail the contents of web site CGI forms to me. I can't get it to
work. I can use blat from the command prompt to send me a text file just
fine, but it won't work from the PERL script.
I have the PERL scripts setup so that after the contents of the form have
been e-mailed to me, HTML is returned to the screen. This happens, so I'm
not sure what's going on. What follows is the first part of the script and
the part of the script that involes blat. Any suggestions would be
appreciated.
Thank you,
Matthew Cate
#! D:\perl\bin\perl.exe
require 'D:\perl\lib\cgi-lib.pl';
&ReadParse (*in);
print "Content-type: text/html\n\n";
open (MAIL, ">temp$$");
print MAIL <<EOF;
Browser: $ENV{'HTTP_USER_AGENT'}
Name: $in{'name'}
EOF
;
close (MAIL);
system ("blat temp$$ -s \"Test Message\" -t info\@mydomainname.com -q");
system ("del temp$$");
------------------------------
Date: Wed, 10 Jun 1998 23:45:16 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: Matthew Cate <mcate@gmu.edu>
Subject: Re: Blat works from command line but not in CGI script
Message-Id: <357F7CFC.B0D7C5CE@sirius.com>
Matthew Cate wrote:
>
> I have an NT Server with Exchange 5.5 and IIS 4 installed. I've installed
> Blat to e-mail the contents of web site CGI forms to me. I can't get it to
> work. I can use blat from the command prompt to send me a text file just
> fine, but it won't work from the PERL script.
>
> I have the PERL scripts setup so that after the contents of the form have
> been e-mailed to me, HTML is returned to the screen. This happens, so I'm
> not sure what's going on. What follows is the first part of the script and
> the part of the script that involes blat. Any suggestions would be
> appreciated.
>
> Thank you,
>
> Matthew Cate
>
> #! D:\perl\bin\perl.exe
> require 'D:\perl\lib\cgi-lib.pl';
> &ReadParse (*in);
> print "Content-type: text/html\n\n";
>
> open (MAIL, ">temp$$");
>
> print MAIL <<EOF;
>
> Browser: $ENV{'HTTP_USER_AGENT'}
>
> Name: $in{'name'}
>
> EOF
> ;
>
> close (MAIL);
>
> system ("blat temp$$ -s \"Test Message\" -t info\@mydomainname.com -q");
>
> system ("del temp$$");
If I may quote Larry Wall:
Always check the return code of system calls.
Always check the return code of system calls.
ALWAYS CHECK THE RETURN CODE OF SYSTEM CALLS!
This could give you your answer. I have known some versions of IIS
to refuse to run other programs via a system(). If this is your
problem, one way to fix it is to use the Net::SMTP module instead
of blat. This is a better solution for several reasons. You
can get all the info you need about this module by running
"perldoc Net::SMTP" at a DOS prompt. This assumes you have the latest
Perl 5.004.02 installed.
HTH - Jim Bowlin
------------------------------
Date: 11 Jun 1998 04:15:28 GMT
From: dha@panix.com (David Adler)
Subject: Re: Certified Perl Programmers
Message-Id: <6lnll0$p4v@news1.panix.com>
On Wed, 10 Jun 1998 22:25:40 GMT, Randal Schwartz <merlyn@stonehenge.com> wrote:
>>>>>> "Mark-Jason" == Mark-Jason Dominus <mjd@op.net> writes:
>
>Mark-Jason> ``Oh, yes. I've been a certified Perl developer since 1997.''
>
>I've been a certifiable Perl hacker since, oh, 1989. :-)
And that's only because perl's not much older than that...
<ducks>
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"This is Mace's planet. We Just Live here."
------------------------------
Date: Thu, 11 Jun 1998 03:23:37 GMT
From: pinaula@email.unc.edu (D. Pinaula)
Subject: Re: Crazzzzy Problem!!!
Message-Id: <357f4cf5.47982432@news.unc.edu>
On Wed, 10 Jun 1998 23:02:31 GMT, e_nation <info@!enation.org> wrote:
>I have a virtual server on which I host my website. There are alot of
>functions automated by the use of perl/cgi scripts. However, suddenly
>they seemed to stop working.
*snip*
>
>Any help appreciated.
>Darren
>http://www.enation.org
If your virtual host is a Unix machine and you're creating these
scripts in a Windows text editing program, it could be the difference
in newline characters. If you have access to a Unix shell, try
opening the script in an editor like emacs, deleting newlines and
reinserting them. Notepad frequently creates this problem.
------------------------------
Date: 11 Jun 1998 02:39:18 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: flock
Message-Id: <6lng0m$518$4@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Rick Delaney <rick.delaney@shaw.wave.ca> writes:
:That's because user #2 can trash user #1's changes before the file is
:renamed. If you must use a temp file then read it back and write back
:to TEMPLATE.
One point I forgot to mention in this because it didn't
occur to me at the time is that simply doing the rename before
the close is no help because then the wrong version is locked.
Perhaps there's cause for a separate lockfile afterall.
--tom
--
"Just because something is obviously happening doesn't mean something obvious
is happening." --Larry Wall
------------------------------
Date: Thu, 11 Jun 1998 05:02:20 GMT
From: Jason Bodine <jbodine@internetpro.net>
Subject: Help with Perl CGI script
Message-Id: <357F6700.5D9A@internetpro.net>
Hi all,
Can someone please tell me what perl code to use that will allow a
script to CC: and BCC: copies of form data?
Thanks!
Jason Bodine
jbodine@internetpro.net
------------------------------
Date: Thu, 11 Jun 1998 05:38:18 GMT
From: preston@home.com (Preston L. Bannister)
Subject: Re: McCabe complexity analysis
Message-Id: <e3Kf1.3584$dn.9003727@news.rdc2.occa.home.com>
In article <6ljrb5$6l1$3@justus.ecc.lu>, Stefaan.Eeckels@ecc.lu (Stefaan
A Eeckels) wrote:
>Why do even respected authors (and many more programming
>standards documents) state that you should write (in 'C'):
>
> handle = fopen(file_name, mode);
> if (handle == NULL) return -1;
Actually I would recommend:
handle = fopen(file_name, mode);
if (NULL == handle) {
return -1;
}
This form avoids at least three common programming errors.
Of course, if you never make mistakes, this makes no difference.
For the remaining 100% of the programming population, it makes sense.
You do care that your code works?
Less code per line also makes it easier to review changes between
revisions. Particularly useful if you use source code control and
review your changes before checking them in.
You do use source code control?
>instead of the much more elegant:
>
> if ((handle = fopen(file_name, mode)) == NULL)
> return -1;
Yes, I used to write code like this. Thought it was clever to pack more
code on one line. That was a long time ago.
Bugs are not elegant. If you were reading code you might miss:
if (handle = fopen(file_name, mode) == NULL)
return -1;
>I guess it's because not everybody has the required
>esthetic sense to be programming. It's an art form,
>after all.
Oh, I get it. You forgot the :-).
Non-working code is an art form. Working code is what you usually get
paid for. Writing code is closer to a craft.
--
Preston L. Bannister
preston@home.com
http://members.home.net/preston
------------------------------
Date: Wed, 10 Jun 1998 22:19:00 -0400
From: "ALAN FEILER" <ppdc@ix.netcom.com>
Subject: NEED EXPERIENCED PERL WRITER
Message-Id: <6lne7e$ik@sjx-ixn3.ix.netcom.com>
New project is in need of good programmer.
Please reply to
ppdc@ix.netcom.com
------------------------------
Date: 11 Jun 1998 04:14:57 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: New module/pragma "enum.pm" (was "fields.pm")
Message-Id: <897538985.532264@thrush.omix.com>
[posted & mailed]
Zenin <zenin@bawdycaste.org> wrote:
: This version is available at:
: http://thrush.omix.com/pub/perl/modules/enum-1.007.tar.gz
>snip<
Bad link. Too much web work lately...sorry about that.
s/http/ftp/; # This should work better :-)
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: 11 Jun 1998 03:32:31 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Non-blocking Perl socket calls?
Message-Id: <6lnj4f$e3o$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
oneilt@we.mediaone.net (Tom O'Neil) writes:
:How do I execute a non-blocking socket call in Perl?
You use fcntl to turn on O_NONBLOCK.
--tom
--
signal(i, SIG_DFL); /* crunch, crunch, crunch */
--Larry Wall in doarg.c from the perl source code
------------------------------
Date: 11 Jun 1998 02:20:51 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: pack/unpack seps
Message-Id: <6lneu3$518$2@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Ruben Safir <75762.2332@CompuServe.COM> writes:
:This is still not explaining how UNPACK behaves
:
:What is the difference between
:unpack ( a1 , $mybin) and unpack( c, $mybin)
I begin to wonder whether I have a teaching disability or whether you
have have a learning disability. :-(
Did you try them both? Did you notice the difference?
$char = unpack("a", "\101");
$byte = unpack("c", "\101");
print "char is $char, byte is $byte\n";
+-----------------------+
| char is A, byte is 65 |
+-----------------------+
Please tell me this makes sense now. One gives you back a number in
an 8-bit range, unsigned if "C" is used. The other gives you back a
character string of length one.
--tom
--
"...this does not mean that some of us should not want, in a rather
dispassionate sort of way, to put a bullet through csh's head."
Larry Wall in <1992Aug6.221512.5963@netlabs.com>
------------------------------
Date: Thu, 11 Jun 1998 06:02:58 +0000
From: Ben Sandler <see@the.sig>
Subject: perl locales in RH 5.1
Message-Id: <357F7312.9639600@the.sig>
I just installed RedHat 5.1 with perl 5.004, and whenever I run a perl
script, the output is prefaced by the following:
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = (unset),
LANG = "en_RN"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
I read the perllocale man page, but it's very late at night and I don't
really have a need to take advantage of the new features. What should I
do to make perl stop spewing error messages before every script?
Thanks,
Ben
--
Ben Sandler
email me: sandler at ymail dot yu dot edu
"Windows is an operating system, not a religion."
- Ted Waitt, chairman of Gateway
------------------------------
Date: Wed, 10 Jun 1998 22:20:32 -0700
From: Jim Bowlin <bowlin@sirius.com>
To: David Staschover <das@panix.com>
Subject: Re: Perl security on NT with IIS
Message-Id: <357F6920.655D15B8@sirius.com>
David Staschover wrote:
>
> We are running IIS3.0. We given CGI-BIN access to a few users.
> Unfortuntunatly, the user is able to write a perl script on the web which
> can create/update a file anywhere on the NT server.
>
> How do I prevent this?
You can limit the privileges of the account the web server runs under.
But if you can't trust the people writing CGI programs under NT then
you are screwed. (This is not the case in Unix). Also, I have heard
of a Perl script that will bypass ALL file security when run on NT.
Been there, done that.
-- Jim Bowlin
------------------------------
Date: 11 Jun 1998 02:14:55 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Piping into telnet from Perl NT
Message-Id: <6lneiv$2nr$2@comdyn.comdyn.com.au>
In article <6llnbv$kbq$2@mainsrv.main.nc.us>,
scott@softbase.com writes:
> protocol via sockets in your program. I'm sure someone has already
> written this as a module, and I'm equally sure it likely won't work on
> Windows. You'll probably wind up writing the raw socket code
> yourself.
# perl -MCPAN -e shell
cpan> readme Net::Telnet
[snip]
Prerequisites
-------------
. Perl Version 5.002 or later
. A Windows 95/NT machine requires Perl version 5.003_07 or later
. No other modules are required that don't already come with a
standard distribution of Perl.
[snip]
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | Think of the average person. Half of
Commercial Dynamics Pty. Ltd. | the people out there are dumber.
NSW, Australia |
------------------------------
Date: Thu, 11 Jun 1998 01:05:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Please help me solve my error..
Message-Id: <Pine.GSO.3.96.980610180510.5401Q-100000@user2.teleport.com>
On Wed, 10 Jun 1998, Drew wrote:
> Subject: Please help me solve my error..
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> 500 Server Error
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 11 Jun 1998 02:07:47 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: READING MAIL BY PERL
Message-Id: <6lne5j$2nr$1@comdyn.comdyn.com.au>
In article <6lj32p$o7q$1@morse.news.easynet.net>,
"Dan Hopkins" <dan@ukonline.net> writes:
> I'd prefer that the script was activated by incoming mail rather than
> parsing stored mail every few minutes. But if you want a relatively simple
> method.... hope it helps.
# man forward
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | We are born naked, wet and hungry. Then
Commercial Dynamics Pty. Ltd. | things get worse.
NSW, Australia |
------------------------------
Date: 11 Jun 1998 04:03:49 GMT
From: Kwon Soon Son <cessi@hantan.postech.ac.kr>
Subject: reverse sorting
Message-Id: <6lnkv5$vd1$1@news.postech.ac.kr>
hi i'm perl newbie but dare developing a data ananysis tool using perl.
what i'm trying to to is reverse sorting.
here is part of my source code.
--------
......
$size{$2} += $1;
$totalbytes += $1;
$totalpackets += 1;
}
elsif(/^(\w*)$/)
{
$totalbytes += $1;
$totalpackets += 1;
}
}
foreach $srchost (sort (keys %size)){
print "$size{$srchost} bytes from $srchost \n";
......
--------
i want to sort in reverse order.
please let me know what part should i rewrite.
thanks in advance.
p.s. sorry for my bad english.
--
-*-*-*-*-*-*-*-*-*- KLDP -*-*-*-*-*-*-*
(o_ _o)
(o_ (o_ //\ http://kldp.linux-kr.org //\
(/)_ (/)_ V_/_ cessi@kldp.linux-kr.org V_/_
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- JOIN NOW!!! -*-*
------------------------------
Date: 11 Jun 1998 04:38:20 GMT
From: Kwon Soon Son <cessi@hantan.postech.ac.kr>
Subject: Re: reverse sorting
Message-Id: <6lnmvs$11h$2@news.postech.ac.kr>
Kwon Soon Son <cessi@hantan.postech.ac.kr> wrote:
> --------
> ......
> $size{$2} += $1;
> $totalbytes += $1;
> $totalpackets += 1;
> }
> elsif(/^(\w*)$/)
> {
> $totalbytes += $1;
> $totalpackets += 1;
> }
> }
> foreach $srchost (sort (keys %size)){
--> foreach $srchost (sort { $size{$b} <=> $size{$a}} (keys %size)){
> print "$size{$srchost} bytes from $srchost \n";
> ......
> --------
i made it :-)
--
-*-*-*-*-*-*-*-*-*- KLDP:8.4*=: GQ1[9.<- GA7NA'F. -*-*-*-*-*-*-*
(o_ 0|8.@Z : 1G <x <1 _o)
(o_ (o_ //\ http://kldp.linux-kr.org //\
(/)_ (/)_ V_/_ cessi@kldp.linux-kr.org V_/_
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- JOIN NOW!!! -*-*
------------------------------
Date: Thu, 11 Jun 1998 16:11:14 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Stages in a pipeline
Message-Id: <357F7502.85B2CBA4@spider.herston.uq.edu.au>
A simple approach if the operations always happen in the same order
might be:
my ($we_want_operation1, $we_want_op2);
# somewhere in here we set our $we_want_... flags
for (<>) {
if ($we_want_operation1) {
# Do first operation
}
if ($we_want_op2) {
# Do second operation
}
}
If you need to reorder things, you could use a hash of anonymous subs.
my %ops = ("op1" => sub { print "op1\n"; },
"op2" => sub { print "op2\n"; },
"op3" => sub { print "op3\n"; },
);
sub do_ops {
foreach my $op (@_) {
&{$ops{$op}};
}
}
do_ops ("op1", "op3");
do_ops ("op3", "op2");
I'm not sure of the best place for the loop over your data array. If
the data is in-memory and you don't mind blowing out your code size, it
could go in each of the anonymous subs. If you'd rather have the loop
code in only one place, it could go inside the existing loop in do_ops.
*But* if you are processing files a line at a time you might be better
off minimizing I/O overhead by putting the loop outside the calls to
do_ops.
--
Jaime Metcher
Scott Bronson wrote:
>
> I've been programming in Perl for a few weeks now. Long enough to
> recognize that there must be an elegant(ish) Perl solution to this
> problem, but not long enough to know what it is.
>
> I've got a bunch of fucntions. All of them accept data as an argument,
> process it, and return the processed data as their result. The data is
> an array of lines, but that should be unimportant.
>
> Now, I'd like to set these functions up as a pipeline. One pipeline
> configuration would be:
>
> Print -> Format_Lists -> Number_Lines -> Remove_Header -> Get_Paragraph
>
> So, print calls Format Lists until Format_Lists returns null, printing
> out the data returned, and so on up the pipe. If I didn't want line
> numbers, I just re-order the stages in the pipe:
>
> Print -> Format_Lists -> Remove_Header -> Get_Paragraph
>
> And if I wanted headers and formatted lists, but no line numbers:
>
> Print -> Format_Lists -> Get_Paragraph
>
> You get the idea. What's an efficient, flexible way to set this up in
> Perl? Thanks,
>
> - Scott
>
> sbronson@opentv.com
------------------------------
Date: 11 Jun 1998 03:02:22 GMT
From: Cameron Simpson <cs@zip.com.au>
To: kelby@mplx.com
Subject: Re: thumbnails
Message-Id: <19980611130316-cameron-1-01850@sid.research.canon.com.au>
Kelby Valenti (kelby@mplx.com) wrote on MDCCXXXIX September MCMXCIII in
<URL: news:6l9jij$d3si$1@newssvr04-int.news.prodigy.com>:
++ I'm looking for a program that will create thumbnails from a directory of
++ images. I would like this to be a cgi program. If you can help me in my
++ search I'd appreciate it.
Or look at:
http://www.zip.com.au/~cs/im2html/
it's not a CGI - it makes static HTML files and thumbnails.
The thumbnail script may suit your needs all on its own.
--
Cameron Simpson, DoD#743 cs@zip.com.au http://www.zip.com.au/~cs/
This disk pack is sold by volume, not by wait. Crammed full by modern automatic
computer equipment, it causes full net wait timeouts. If device does not appear
full when opened, it is because file contents have been lost during transfering.
------------------------------
Date: 10 Jun 1998 23:38:54 -0600
From: snowhare@xmission.xmission.com (Snowhare)
Subject: Re: thumbnails
Message-Id: <6lnqhe$n7i$1@xmission.xmission.com>
Nothing above this line is part of the signed message.
In article <19980611130316-cameron-1-01850@sid.research.canon.com.au>,
Cameron Simpson <cs@zip.com.au> wrote:
>Kelby Valenti (kelby@mplx.com) wrote on MDCCXXXIX September MCMXCIII in
><URL: news:6l9jij$d3si$1@newssvr04-int.news.prodigy.com>:
>++ I'm looking for a program that will create thumbnails from a directory of
>++ images. I would like this to be a cgi program. If you can help me in my
>++ search I'd appreciate it.
>
>Or look at:
> http://www.zip.com.au/~cs/im2html/
>it's not a CGI - it makes static HTML files and thumbnails.
>The thumbnail script may suit your needs all on its own.
Another similar but somewhat more featured alternative that creates JPEG
rather than GIF thumbnails is
<URL:http://www.nihongo.org/snowhare/utilities/htmlthumbnail/>
Benjamin Franz
Version: 2.6.2
iQCVAwUBNX9tZOjpikN3V52xAQF1UQP/amS6csQgKPEWP0UPiBqmGd+SpO8EbRt8
tSJJeuyRnpvNudx3ESwuWsAAIbFQp7lfANUTtBAgh0nBxQdz+jKIubOH1BvFtgIj
suOaq4t1KCEoAvusOTBIH9O6TUsK2pNd1fk/auRufy933Tggm67VGWfDd3aY/ttb
kxhnQ6NsPUE=
=QqHD
-----END PGP SIGNATURE-----
------------------------------
Date: 11 Jun 1998 02:31:28 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why it's stupid to `use a variable as a variable name'
Message-Id: <6lnfi0$518$3@csnews.cs.colorado.edu>
Keywords: erasable mantissa mock wristwatch
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, mjd@op.net (Mark-Jason Dominus) writes
one of the best articles I've read this week.
:When people come into comp.lang.perl.misc asking how to do something
:stupid, I'm never quite sure what to do. I can just answer the
:question as asked, figuring that it's not my problem to tell people
:that they're being stupid.
I guess
$dirsize = -s $directory;
is one of those, eh? :-)
I certainly strongly agree that trying to use a variable to store a
variable *by name* rather than by reference is something crying out for
a hash. Then again, so are a lot of thing in Perl, like uniquing lists,
checking existence, etc. I think using hashes as a fundamental way of
looking at a problem is one of the big hurdles for many people coming to
Perl from anything but awk, python, icon, or those cool snobolish things.
Another is of course regular expressions.
--tom
--
"You can't have filenames longer than 14 chars.
You can't even think about them!"
--Larry Wall in Configure from the perl distribution
------------------------------
Date: 11 Jun 1998 04:09:31 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why it's stupid to `use a variable as a variable name'
Message-Id: <6lnl9r$hd5$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc, Zenin <zenin@bawdycaste.org> writes:
:But just don't forget that you can do it when you need to.
But how many people actually remember that you can't use symbolic
references to get at a my() variable?
Wizards don't use soft references, at least, not the way you
mean. They rummage about the symbol table directly. :-)
@{*$me} = ($readfh, $writefh);
$fh = ${*$me}[0];
*{*$me} = *{*$fh};
${*$me}{'io_pipe_pid'} = $pid
local *naughty = \&nice;
for my $name (@fieldnames) {
*$name = *{lc $name} = sub () { $fields{$name} };
}
--tom
#!/usr/bin/perl
# dutree - tchrist@perl.com
# YANETUT: When you have plucked the meaning and the mechanism from
# the following program, you are ready to leave the temple, Grasshopper.
@lines = `du @ARGV`;
chop(@lines);
&input($top = pop @lines);
&output($top);
exit;
sub input {
local($root, *kid, $him) = @_[0,0];
while (@lines && &childof($root, $lines[$#lines])) {
&input($him = pop(@lines));
push(@kid, $him);
}
if (@kid) {
local($mysize) = ($root =~ /^(\d+)/);
for (@kid) { $mysize -= (/^(\d+)/)[0]; }
push(@kid, "$mysize .") if $size != $mysize;
}
@kid = &sizesort(*kid);
}
sub output {
local($root, *kid, $prefix) = @_[0,0,1];
local($size, $path) = split(' ', $root);
$path =~ s!.*/!!;
$line = sprintf("%${width}d %s", $size, $path);
print $prefix, $line, "\n";
$prefix .= $line;
$prefix =~ s/\d /| /;
$prefix =~ s/[^|]/ /g;
local($width) = $kid[0] =~ /(\d+)/ && length("$1");
for (@kid) { &output($_, $prefix); };
}
sub sizesort {
local(*list, @index) = shift;
sub bynum { $index[$b] <=> $index[$a]; }
for (@list) { push(@index, /(\d+)/); }
@list[sort bynum 0..$#list];
}
sub childof {
local(@pair) = @_;
for (@pair) { s/^\d+\s+//g; s/$/\//; }
index($pair[1], $pair[0]) >= 0;
}
--
Mister Catbert, the company is trying to force me to use a different kind
of computer. You're the human resources directory. what are you doing
to sop this religious persecution?! What every happened to "Diversity"??
The longer you verk here, diverse it gets. next. --Scott Adams, "Dilbert"
------------------------------
Date: Thu, 11 Jun 1998 16:52:53 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Win32: File glob causes floppy to chatter
Message-Id: <357F7EC5.C5CE7852@spider.herston.uq.edu.au>
Michael Burr wrote:
>
<snip>
> I think it may have something to do with the fact that globs start a new
> process - but new processes typically don't cause disk seeks at start-up
<ahem>
perl -e "`dir` # or any other process "
*does* cause a disk seek when McAfee's VShield has "on-access scanning"
enabled.
> (even on this broken OS). So I'm still looking for a more in-depth
> understanding of what's going on.
>
McAfee know about this, but are pretending not to. My gut feeling is
that the problem is more to do with Windows95, and McAfee have just
fallen foul of a broken API.
--
Jaime Metcher
------------------------------
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 2836
**************************************