[14062] in Perl-Users-Digest
Perl-Users Digest, Issue: 1472 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Nov 23 21:10:38 1999
Date: Tue, 23 Nov 1999 18:10:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <943409419-v9-i1472@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 23 Nov 1999 Volume: 9 Number: 1472
Today's topics:
Re: New dialect of perl: xperl (or reinventing perl, or <lr@hpl.hp.com>
Re: New dialect of perl: xperl (or reinventing perl, or (Abigail)
Re: New dialect of perl: xperl (or reinventing perl, or <uri@sysarch.com>
Re: New dialect of perl: xperl (or reinventing perl, or <lr@hpl.hp.com>
Re: newbie PERL question <cassell@mail.cor.epa.gov>
Re: newbie PERL question (Andrew Johnson)
Re: Percentages Question (Greg Bacon)
Re: Percentages Question <nandu@cimedia.com>
Re: Percentages Question (Abigail)
Re: Percentages Question (Abigail)
Re: Percentages Question <lr@hpl.hp.com>
Perl ,Novell, windows, NT and Unix (John Armsby)
Re: perl and dns bj0rn@my-deja.com
Re: Portuguese Whaling Songs <jeff@vpservices.com>
Re: Portuguese Whaling Songs <uri@sysarch.com>
Re: Portuguese Whaling Songs <cassell@mail.cor.epa.gov>
Re: Portuguese Whaling Songs (Craig Berry)
Re: Portuguese Whaling Songs <lr@hpl.hp.com>
Re: Portuguese Whaling Songs <uri@sysarch.com>
Re: Q on TPJ #14 smtp article <rick.delaney@home.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 Nov 1999 15:15:39 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: New dialect of perl: xperl (or reinventing perl, or perl-izing jpython)
Message-Id: <MPG.12a4bff834294cb098a263@nntp.hpl.hp.com>
In article <x7yabon9kb.fsf@home.sysarch.com> on 23 Nov 1999 17:10:28 -
0500, Uri Guttman <uri@sysarch.com> says...
...
> check out fastcgi as well. it is an open protocol, it is free with
> apache, is supported commercially for netscape and redmondware by fast
> engines, and other servers support it too. it gives you persistancy and
> saves on the compiles as well as allowing remote execution of the cgi
> programs. go to fastcgi.com for more info.
Aware of your involvement with FastCGI, I had already done that. Their
site sent me to another, www.fastengines.com, which is pushing a Version
2.0 for Linux/Apache. I found and downloaded a Version 1.6 for Windows
NT/IIS. When it failed to install properly, I went to PerlEx, figuring
it would be better integrated into the ActiveState Perl. However,
PerlEx is still giving me problems. So I have just sent a note to
FastEngines for help and will try again.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 23 Nov 1999 17:27:27 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: New dialect of perl: xperl (or reinventing perl, or perl-izing jpython)
Message-Id: <slrn83m8sf.m2v.abigail@alexandra.delanet.com>
excalibor@my-deja.com (excalibor@my-deja.com) wrote on MMCCLXXV September
MCMXCIII in <URL:news:81e79g$snj$1@nnrp1.deja.com>:
-- In article <slrn83j9cr.m2v.abigail@alexandra.delanet.com>,
-- abigail@delanet.com wrote:
--
-- > excalibor@my-deja.com (excalibor@my-deja.com) wrote on MMCCLXXIV
-- > September MCMXCIII in <URL:news:81c10s$ain$1@nnrp1.deja.com>:
-- (Aside comment: if those romans are the date of the post, something
-- is very wrong somewhere between my clock and that script... :)
It seems to match my calendar....
-- > Punctuation bloat (8 (!!) punctuation chars to access an array), no
-- > lexical scoped 'array', and if you type 'arrya', it's not even a run
-- > time error. You can use all the -w and use stricts you want, all you
-- > get is mysterious behaviour. Sure, sure, sure, you can put in extra
-- > checks. But that's something I want from the *language*, after all,
-- > that's what "use strict" is doing for me for non-OO. Not to mention
-- that
-- > you have to do lots of repeated work yourself: building the objects
-- [1],
-- > and extracting yourself from @_.
--
-- Well, I have to agree with you in that... Although powerful, it's
-- somehow a bit too complex. Some syntactical sugar (at the very least)
-- would be gladly welcome.
I'm sorry, I fail to see what's so powerful about that. Is non-OO Perl
less powerful because you don't have to group your package variables and
your lexical variables yourself, but the language does that for you? Is
having the object as first argument more powerful than say, oh, having
a 'self' keyword, or a 'this_object ()' function, as found in other
languages? I can see reasons why the object is the first argument,
and there isn't a keyword or function that gives the current object
(for instance, because OO in Perl is optional, and 'current object'
isn't always well-defined), but I don't think it's more powerful.
-- > Perl OO violates the basic reason OO exists: implementation hiding.
--
-- Mmmm... Well, if you provide a clear interface (which can get pretty
-- tricky, that's true... specially if you need some complex data for
-- your objects like hashes of hashes...) it shouldn't matter how that's
-- implemented... (actually that's something I am exploring with
-- OO::Closures... when I have complex data types, things can get a bit
-- complex there as well, although it's a really clever hack, I take my
-- hat off :)
Oh, really? Good. Let's do an exercise, ok?
Let's say there's a class 'Clock::Cuckoo'. It has the following interface:
Clock::Cuckoo -> new (TIME):
Returns an object of class Clock::Cuckoo, with time initially
set to TIME. TIME is of the format 'dd:mm', with 01 <= dd <= 12,
and 00 <= mm <= 59.
$obj -> tick ():
Advances the internal clock. It returns a string of 0 to 12 times
"cuckoo", separated by whitespaces. The amount of "cuckoo"s returned
is the same as the number of times a cuckoo clock would cuckoo at
that time. So, on 4:00, "cuckoo cuckoo cuckoo cuckoo" will be
returned, but on 5:15, "" will be returned.
Your exercise:
Subclass Clock::Cuckoo to Clock::Cuckoo::Count, which has the same
functionality as Clock::Cuckoo, except that it also has a method that will
return the total number of "cuckoos" the clock has returned.
Note that I didn't tell you how Clock::Cuckoo keeps track of data it
wants to keep track of - if any at all. That's part of the implementation,
not the interface.
It should be trivial exercise, something you would give as an exercise
half an hour after you introduced your students to OO.
But is it trivial in Perl?
-- There are several serious problems concerning Perl's OO (or modules
-- work, for that matter) for which the susceptibility of implementation
-- of instance data vs. class data is not the biggest. For some cases,
-- this separation provides some really powerful tricks (that both Tom and
-- Damian have explained), for others it's really annoying when
-- implementing your class...
I'm not talking about class data at all. I don't even like the concept
of "class data", as that breaks my idea of what objects are: autonomish
entities. If you want to collect data from various sources, use a daemon.
But that's just my opinion; class data is not part of my argument.
-- > I guess that when Perl 5 was designed, it was an interesting exercise
-- > to do the minimalist approach: Perl objects are just syntactical sugar
-- > for ADTs with weak binding. But I think it was the wrong decision.
--
-- It was an elegant solution... and it made usable a lot of things with
-- little hassle... but for the long run, some changes may be welcome...
Elegant? Yeah, well, I guess some people would find hippos dancing
elegant as well. ;-)
-- > There's already mod_perl that more or less does this.
--
-- ah, cool... :) Then it's use should be more spread out, specially in CGI
-- where server load is high and new processes are always expensive...
Whatever. That's up to the people actually adminning servers, not the
Perl community.
-- I disagree... for some things, you cannot put speed over many other
-- issues... if you really need speed, do it in assembler on a parallel
-- box (or net)
The world isn't black and white. There are many levels of gray as well.
-- It's not really fair just comparing performance of already done
-- programs... take into account man-hours of work and stress and then
-- we'll be able to discuss in a more fair ground... perl is pretty darn
-- fast for what it offers, imo...
Yes it is. That doesn't mean the run-time speed isn't important for some
people. Furthermore, having a Java implementation of Perl doesn't cut
down developing time - people would still write Perl. But you lose on
run-time. It's a "no win"-lose situation.
-- > [1] And please, don't come with the argument that's more flexible.
-- > That's just crap. If there just were 'object instance variables',
-- > there wouldn't *be* any need to group them in Perl structure,
-- > eliminating the need to offer the subclasser a potential
-- headache.
--
-- Nod... it's actually something that can be done... aren't they adding
-- an 'our' kind of variable... well, 'private', 'really_my' or anything
-- fancy could do the trick... it should just imply another scope (I
-- dunno how hard can this be, though...)
our has nothing to do with object instance variables. It's just some
strange way of making global variables with a limited scope. Why on
earth this got added to Perl, I've no idea. We can't have ?? because,
oh golly, there are already so many "or" things and that would confuse
the poor souls (I cannot recall anyone ever using | instead of ||, or ||
instead of |, and the difference between || and or is easily explained).
However, scoping and proper use of `my' and `local' seems to be one of the
more difficult aspects of Perl, and now we get `our' as well? Something
that only seems to work under `use strict vars', and makes it easier
to use package variables instead of lexicals, while people tend to say
lexicals are usually better. I wonder why it was added to Perl without
2500 flames crying out "it's confusing" and "we don't need this".
-- And if not, it's time to have a serious chat with p5p and Chip so they
-- have changed their minds for Topaz :)
Sorry, I've given up on p5p. And Topaz is going to be perl5 compatible,
which is probably the right thing to do.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 23 Nov 1999 18:46:28 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: New dialect of perl: xperl (or reinventing perl, or perl-izing jpython)
Message-Id: <x7iu2sn54b.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> Aware of your involvement with FastCGI, I had already done that.
LR> Their site sent me to another, www.fastengines.com, which is
LR> pushing a Version 2.0 for Linux/Apache. I found and downloaded a
LR> Version 1.6 for Windows NT/IIS. When it failed to install
LR> properly, I went to PerlEx, figuring it would be better integrated
LR> into the ActiveState Perl. However, PerlEx is still giving me
LR> problems. So I have just sent a note to FastEngines for help and
LR> will try again.
so both are on equal footing! BTW i only worked at fast engines for a few
months and though i may have soem ties still there, i like to promote
the fastcgi protocol in general. it is way underutilized and has many
advantages if used correctly.
so why don't you get apache on your winblows box and use the free
mod_fastcgi and FastCGI.pm modules?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 23 Nov 1999 17:19:56 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: New dialect of perl: xperl (or reinventing perl, or perl-izing jpython)
Message-Id: <MPG.12a4dd1aad07dee998a265@nntp.hpl.hp.com>
In article <x7iu2sn54b.fsf@home.sysarch.com> on 23 Nov 1999 18:46:28 -
0500, Uri Guttman <uri@sysarch.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
>
> LR> Aware of your involvement with FastCGI, I had already done that.
> LR> Their site sent me to another, www.fastengines.com, which is
> LR> pushing a Version 2.0 for Linux/Apache. I found and downloaded a
> LR> Version 1.6 for Windows NT/IIS. When it failed to install
> LR> properly, I went to PerlEx, figuring it would be better integrated
> LR> into the ActiveState Perl. However, PerlEx is still giving me
> LR> problems. So I have just sent a note to FastEngines for help and
> LR> will try again.
>
> so both are on equal footing! BTW i only worked at fast engines for a few
> months and though i may have soem ties still there, i like to promote
> the fastcgi protocol in general. it is way underutilized and has many
> advantages if used correctly.
>
> so why don't you get apache on your winblows box and use the free
> mod_fastcgi and FastCGI.pm modules?
That too! I am investigating alternatives for various environments,
from 'pure' Micro$..t/Commercial (Windows NT + IIS + Oracle) to 'pure'
Open Source (Linux + Apache + MySQL). Mix and match when appropriate.
Note that my sig says HP *Laboratories*, not HP *Company*. But because
HP *Company* is deeply committed to Micro$..t, I have to include that
end of the spectrum in my studies. Unfortunately, they don't supply a
viable persistent-DB Perl-CGI solution, so I have to look elsewhere.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 23 Nov 1999 16:46:14 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: newbie PERL question
Message-Id: <383B3556.52048C1E@mail.cor.epa.gov>
Jeff Zucker wrote:
>
> Jonathan Yee wrote:
>
> > Newsgroups: alt.comp.perlcgi.freelance, alt.perl, comp.lang.perl.misc
>
> It's kind of overkill to post the same question to three newsgroups,
> even if some of them don't exist.
Jeff, I don't know how to break it to you, but *all*three*
of those groups exist.
That's not to say that you would want to read all three, but
they are there. alt.comp.perlcgi.freelance just appeared
this summer, I believe.
> > Someone has written some scripts for me but I need to edit them slightly.
>
> Well, that can be a good way to start learning Perl, but I hope you
> trust that other person pretty well because that can also be a good way
> to get in a lot of trouble if you start using scripts without knowing
> how or why they work.
Not only that, but people who learn Perl from the kludges
of random clueless lusers only learn *bad* Perl. The Dark
Side of the language, so to speak. And its attraction is
strong for those who are weak-minded or not in control of
their emotions.
I think that the original poster might benefit from buying
[and reading] Andrew Johnson's runaway best-seller "Elements
of Programming with Perl." Soon to be a major motion picture
starring Jeff Speakman.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 24 Nov 1999 01:45:20 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: newbie PERL question
Message-Id: <QqH_3.119$f5.5166@news1.rdc1.mb.home.com>
In article <383B3556.52048C1E@mail.cor.epa.gov>,
David Cassell <cassell@mail.cor.epa.gov> wrote:
[snip]
! I think that the original poster might benefit from buying
! [and reading] Andrew Johnson's runaway best-seller "Elements
! of Programming with Perl." Soon to be a major motion picture
! starring Jeff Speakman.
you're just trying make up for that 'fashion victim' remark
now aren't you?
andrew
--
Andrew L. Johnson http://www.manning.com/Johnson/
Where the hell are my fries, kid?
-- Tom Christiansen, on comp.lang.perl.misc
------------------------------
Date: 23 Nov 1999 23:31:59 GMT
From: gbacon@ruby.itsc.uah.edu (Greg Bacon)
Subject: Re: Percentages Question
Message-Id: <81f85f$2lt$3@info2.uah.edu>
In article <MPG.12a4b258200285f798a262@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> writes:
: In article <81f2kd$1av$4@info2.uah.edu> on 23 Nov 1999 21:57:33 GMT,
: Greg Bacon <gbacon@ruby.itsc.uah.edu> says...
:
: > my $total = 0;
: > $total += $votes{$_} for keys %votes;
:
: Alternatively,
:
: $total += $_ for values %votes;
High marks for elegance!
Greg
--
If the #2 pencil is the most popular, why is it still #2?
-- George Carlin
------------------------------
Date: 23 Nov 1999 17:01:33 -0500
From: Nandu Shah <nandu@cimedia.com>
Subject: Re: Percentages Question
Message-Id: <m33dtw50le.fsf@budgie.cimedia.com>
jimtaylor5@aol.com (Jimtaylor5) writes:
> Does anyone have any simple code that will explain to me how I
> calculate percentages in a group of numbers situation. Perhaps the
> same as a voting booth calculates numbers as 50 pecent yes, 30
> percent no, and 20 percent maybe from the number orf votes. Any
> help will be appreciated.
How would you do it by hand? Write it out in English (or your natural
language of choice), then translate what you wrote to Perl.
For example, if you were taking the mean of a bunch of numbers, you
might write:
Add up all the numbers, then divide by the size of the list.
You might translate that to Perl as
$" = '+';
$avg = eval ("(@x)/($#x+1)")
Nandu
------------------------------
Date: 23 Nov 1999 19:35:43 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Percentages Question
Message-Id: <slrn83mgdk.m2v.abigail@alexandra.delanet.com>
Jimtaylor5 (jimtaylor5@aol.com) wrote on MMCCLXXV September MCMXCIII in
<URL:news:19991123163000.17075.00001644@ng-fn1.aol.com>:
~~ Does anyone have any simple code that will explain to me how I calculate
~~ percentages in a group of numbers situation. Perhaps the same as a voting booth
~~ calculates numbers as 50 pecent yes, 30 percent no, and 20 percent maybe from
~~ the number orf votes. Any help will be appreciated.
Uhm, uhm, calculating percentages is elementary school, isn't?
Perhaps you should ask in alt.algebra.homework, as calculating
percentages in Perl isn't any different from another language.
Abigail
--
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 23 Nov 1999 19:37:10 -0600
From: abigail@delanet.com (Abigail)
Subject: Re: Percentages Question
Message-Id: <slrn83mggb.m2v.abigail@alexandra.delanet.com>
Larry Rosler (lr@hpl.hp.com) wrote on MMCCLXXV September MCMXCIII in
<URL:news:MPG.12a4b258200285f798a262@nntp.hpl.hp.com>:
## In article <81f2kd$1av$4@info2.uah.edu> on 23 Nov 1999 21:57:33 GMT,
## Greg Bacon <gbacon@ruby.itsc.uah.edu> says...
##
## ...
##
## > my %votes = (
## > yea => 435,
## > nay => 42,
## > abstain => 72,
## > );
## >
## > my $total = 0;
## > $total += $votes{$_} for keys %votes;
##
## Alternatively,
##
## $total += $_ for values %votes;
$" = "+";
$total = eval "@{[values %votes]}";
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 23 Nov 1999 17:38:17 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Percentages Question
Message-Id: <MPG.12a4e16364478f9098a266@nntp.hpl.hp.com>
In article <m33dtw50le.fsf@budgie.cimedia.com> on 23 Nov 1999 17:01:33 -
0500, Nandu Shah <nandu@cimedia.com> says...
> jimtaylor5@aol.com (Jimtaylor5) writes:
>
> > Does anyone have any simple code that will explain to me how I
> > calculate percentages in a group of numbers situation. Perhaps the
> > same as a voting booth calculates numbers as 50 pecent yes, 30
> > percent no, and 20 percent maybe from the number orf votes. Any
> > help will be appreciated.
>
> How would you do it by hand? Write it out in English (or your natural
> language of choice), then translate what you wrote to Perl.
>
> For example, if you were taking the mean of a bunch of numbers, you
> might write:
>
> Add up all the numbers, then divide by the size of the list.
>
> You might translate that to Perl as
>
> $" = '+';
> $avg = eval ("(@x)/($#x+1)")
I think you have been reading too much Abigail! There was a thread last
week on the 'reduce' concept, and Abigail submitted something like that
for the 'sum' reducton. But it would have been expressed more like
this:
$avg = do { local $" = '+'; eval("@x")/@x };
I am sure you realize that this is both slow and EEE-vil.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 24 Nov 1999 01:35:43 GMT
From: jaws@mindspring.com (John Armsby)
Subject: Perl ,Novell, windows, NT and Unix
Message-Id: <383b3e01.858676@news.mindspring.com>
I have been writing fairly simple perl scripts for unix for a couple
of years, i.e. file upload, File::find, etc. On Unix (Solaris and
Linux) everything has worked as advertised. I have posted some
anonomalies regarding File::find and Novell (It works great on the PC
but return 8.3 filenames on a Novel drive from the PC. Doesn't seem
to matter if I run the script from my dual boot windows 98 or NT, the
results are the same...). I am also seeing some anomolies with the
script below which uploads a file to a "c:\temp" directory. I adapted
it from my unix script which works great for long filenames. I never
tried it with "spaces" in the file name (unthinkable).
In the PC environment, long filenames and spaces in the filename are a
matter of course. My script below works ON THE WINDOWS98/NT MACHINE I
have at work as long as there are no spaces in the file name. When I
change the script to write to a Novell drive, longfilenames results in
a CGI error. Spaces in the file name results in the resulting file
having the last "word" in the file name string as the file name. Has
anyone seen anomolies as these with Novell?
#!c:\perl\bin\perl -w
#filename upload.pl 11/21/99
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use Text::Wrap;
$ENV{'PATH'}="/bin:/usr/bin:/user/ucb"; #required for security
my $upload_dir="c:\\temp";
#Parse input from the Form
my $query = new CGI;
my $state = $query->param('state');
my $comments = $query->param('comments');
my $EmailAddress = $query->param('EmailAddress');
if ((not defined $state) or ($state eq 'return'))
{
#display the upload form
print $query->header('text/html'), "\n";
print $query->start_html(-title =>'File Upload Form',
-author=>'jarmsby',
-BGCOLOR=>'#fffff');
print $query->start_multipart_form(-action=>"upload.pl");
print"<h2>PAO File Upload Utility</h2>";
print"\n<p>This utility will enable a file upload to the
\"Check in\" Directory on the \"J:\" drive. An Email will be sent to
Project Office requesting document release.";
print"\n<p>";
print'Enter your Email Address (i.e.
john.armsby@worldspan.com) ';
print $query->textfield(-name=>'EmailAddress',
-size=>20,
-maxlength=>25);
print"\n<p>Enter the name of the local file to upload:\n<p>";
print $query->filefield(-name=>'uploaded_file',
-size=>40,
-maxlength=>256);
print"\n<p>Comments:\n<p>";
print $query->textarea( -name =>'comments',
- cols=>'40',
- rows=>'5',
- 'wrap'=>'virtual');
print$query->hidden(-name=>'state',
-default=>'submit');
print "<p>\n";
print'Select "Binary" for Word,Powerpoint Files, etc. Select
"Ascii" for text Files, etc.';
print"\n\n<p><p>";
print $query->radio_group(-name=>'mode',
-'values'=>['Binary','Ascii'],
-default=>'Binary',
-linebreak=>'true');
print "<p>\n";
print $query->submit(-name=>'Upload',
-value=>'Upload...');
print $query->endform;
print"<p><hr>\n";
#print $query->start_form(-action=>"upload.pl");
#print $query->hidden(-name=>'state',
# -default=>'view');
#$query->param('state','view');
#print $query->submit(-name=>'View',
# -value=>'View uploaded files...');
#print $query->endform;
print $query->end_html;
}
else
{
#Form has been submitted and store the uploaded file and show a
#directory.
#print a nice header
print $query->header('text/html'),"\n";
print $query->start_html(-title =>'Transfer Complete',
-author=>'dsnyder',
-BGCOLOR=>'#ffffff');
my $upload_name="";
if($state eq 'submit')
{
#Clean up the file name
my $filename=$query->param('uploaded_file');
$upload_name="$filename";
$upload_name=~tr[A-Z] [a-z];
$upload_name=reverse($upload_name);
$upload_name=~s/^([\w.-]+).*/$1/;
$upload_name=reverse($upload_name);
####################################################
#
# copy contens of the file to the upload directory.
# $filename is both the name of the file and an open filehandle to
# the contents of the file that was uploaded by the user. This
# is strange, but it works. You can not enable "use strict".
#
open OUTFILE, ">$upload_dir/$upload_name" or die "$0: open
$upload_dir/$upload_name: $!\n";
binmode OUTFILE if ('Binary' eq $query->param('mode'));
my ($bytes_read, $buffer);
my $total_bytes=0;
while($bytes_read=read($filename,$buffer,1024))
{
$total_bytes+=$bytes_read;
print OUTFILE $buffer;
}
close OUTFILE or die "$0: close $upload_dir/$upload_name: $!\n";
print "File Transfer Complete. You transferred a
total of ";
printf "%.1f Kbytes.\n",$total_bytes/1024;
print"\n<p>\n<p>PAO has been sent an Email Message
with your comments.";
}
################################Send Email to PAO
##########################
#prepare $MailMessage.....
my $Message ="$upload_name has been uploaded to the PAO Checkin
directory.\n The submitter's comments ($EmailAddress) are presented
below:\n\n$comments";
# write $MailMessage to a Message.txt file...
open(OUTFILE,">Message.txt");
print(OUTFILE $Message);
close(OUTFILE);
my $MailSubject ="New File uploaded to PAO."; #prepare
$MailSubject
Email($Message,$MailSubject);
print "\n<p>The following files have been uploaded to
$upload_dir:\n";
print "<table border=2 align=bottom>";
print "<tr>\n";
print " <th>Filename</th>\n";
# print " <th>Size in Kbytes</th>\n";
print " <th>Date</th>\n";
print "</tr>\n";
#generate the body of the table from the directory contents
my $fname;
#my $md5=new MD5;
my ($size, $mtime);
opendir DIR,"$upload_dir" or die "$0: opendir $upload_dir:
$!\n";
foreach $fname (sort(readdir DIR))
{
next unless open FILE, "<$upload_dir/$fname";
($size,$mtime)=(stat(FILE))[7,9];
next unless -f _; #is an abbreviation for the filehandle last
#processed by the stat() function
# $md5->reset; #these cals are use to compute the MD5
# $md5->addfile(FILE); #message digest for the file.
close FILE;
print "<tr>\n";
if($fname eq $upload_name) #Boldface the file just uploaded
{
print " <td>$fname</td>\n";
# print " <td align=right>strong>%.1f</strong></td>\n",
$size/1024;
print " <td nowrap><strong" . localtime($mtime) .
"</strong></td>\n";
# # print " <d <code><strong>" . $md5->hexdigest .
"</strong></code></td>\n";
}
else
{
#else stuff here
print " <td>$fname</td>\n";
# print " <td align=right>%.1f</td>\n",$size/1024;
print " <td nowrap>" .localtime($mtime) . "</td>\n";
# print " <td><code>" . $md5->hexidigest . "</code></td>\n";
}
print "</tr>";
}
print "</table>\n<p>";
closedir DIR;
#reset the state variable and provide a way to go back by
#creating a form with only a submit button.
print $query->start_form(-action=>"upload.pl");
$query->param('state','return'); #update state variable
print $query->submit(-name=>'Return',
-value=>'Return...');
print $query->endform;
print $query->end_html;
}
sub Email
{
my $Message=shift;
my $MailSubject=shift;
# my $MailTo='jaws@mindspring.com';
# open (DOMAIL, "|blat -\"$Message\" -s \"$MailSubject\"
$MailTo");
# print DOMAIL wrap ("","", $Message);
my $Mail = "blat Message.txt -s \"$MailSubject\" -t "
'jaws@mindspring.com -q';
# print("$Mail");
system($Mail);
}
Note: This time I have pasted the script.
John
------------------------------
Date: Wed, 24 Nov 1999 01:41:41 GMT
From: bj0rn@my-deja.com
Subject: Re: perl and dns
Message-Id: <81ffol$s95$1@nnrp1.deja.com>
Thanks a lot Simon! And yeah, you don't wanna know! Now let's see how
this works... Hmm, I remember I tried something similar...... I guess
that 1 number says its root?
Thanks again!
-Bj0rN
> Well, this suggests that you've already done the bit that updates the
> DNS records, which requires root privileges. Then you've got half the
> battle won - the next bit is to send a SIGHUP to bind as root.
>
> kill 1, `cat /var/run/named.pid`;
>
> I'm not even going to *ASK* how you got a CGI running as nobody to
> affect files as root, though, because I'm pretty sure I don't want to
> know.
>
> --
> It is now pitch dark. If you proceed, you will likely fall into a
pit.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 23 Nov 1999 23:28:33 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Portuguese Whaling Songs
Message-Id: <383B22CD.6E8E48F0@vpservices.com>
Greg Bacon wrote:
>
> In article <jadapturNOSPAM-2311991645270001@nas-2-37.boston.navinet.net>,
> jadapturNOSPAM@hotmail.com (John) writes:
>
> : Anyone know where I can find info on Portuguese Whaling Songs of the 19th
> : Century?
>
> [16:02] ruby% perldoc -q whaling
> No documentation for perl FAQ keyword `whaling' found
Ah, but I can find the Perl content in the message:
$msg = 'Portugese Whaling Songs';
$msg =~ s/^(.).(.)...(.)......(.).*$/$1$3$2$4/;
Making a better re to do that is left as an exercise for the reader.
--
Jeff
------------------------------
Date: 23 Nov 1999 19:27:07 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Portuguese Whaling Songs
Message-Id: <x7aeo4n38k.fsf@home.sysarch.com>
>>>>> "JZ" == Jeff Zucker <jeff@vpservices.com> writes:
JZ> $msg = 'Portugese Whaling Songs';
JZ> $msg =~ s/^(.).(.)...(.)......(.).*$/$1$3$2$4/;
JZ> Making a better re to do that is left as an exercise for the reader.
$msg = join '', substr( $msg, $_, 1) for 0,6,2,13 ;
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 23 Nov 1999 16:47:46 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Portuguese Whaling Songs
Message-Id: <383B35B2.E290DE0@mail.cor.epa.gov>
John wrote:
>
> Portuguese Whaling Songs
>
> Anyone know where I can find info on Portuguese Whaling Songs of the 19th
> Century?
At last! An on-topic post!
You'll want to look in the Perl documentation, under the
Lingua::Pt::Humpback module.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 24 Nov 1999 01:18:07 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Portuguese Whaling Songs
Message-Id: <s3mf6ffarrp40@corp.supernews.com>
John (jadapturNOSPAM@hotmail.com) wrote:
: Portuguese Whaling Songs
:
: Anyone know where I can find info on Portuguese Whaling Songs of the 19th
: Century?
On CPAN (Cetacean Portuguese Antique Noodlings), of course!
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Tue, 23 Nov 1999 17:43:48 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Portuguese Whaling Songs
Message-Id: <MPG.12a4e2b2664a078298a267@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <x7aeo4n38k.fsf@home.sysarch.com> on 23 Nov 1999 19:27:07 -
0500, Uri Guttman <uri@sysarch.com> says...
> JZ> $msg = 'Portugese Whaling Songs';
> JZ> $msg =~ s/^(.).(.)...(.)......(.).*$/$1$3$2$4/;
>
> JZ> Making a better re to do that is left as an exercise for the reader.
>
> $msg = join '', substr( $msg, $_, 1) for 0,6,2,13 ;
My God! What were you thinking (and not testing!)?
$msg = join "" => map substr($msg, $_, 1) => 0, 6, 2, 13;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 23 Nov 1999 20:54:44 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Portuguese Whaling Songs
Message-Id: <x77lj8mz6j.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> [Posted and a courtesy copy mailed.]
LR> In article <x7aeo4n38k.fsf@home.sysarch.com> on 23 Nov 1999 19:27:07 -
LR> 0500, Uri Guttman <uri@sysarch.com> says...
JZ> $msg = 'Portugese Whaling Songs';
JZ> $msg =~ s/^(.).(.)...(.)......(.).*$/$1$3$2$4/;
>>
JZ> Making a better re to do that is left as an exercise for the reader.
>>
>> $msg = join '', substr( $msg, $_, 1) for 0,6,2,13 ;
LR> My God! What were you thinking (and not testing!)?
LR> $msg = join "" => map substr($msg, $_, 1) => 0, 6, 2, 13;
mea culpa
it was tested in perldb. i even cut and pasted it from there. but what
happened is that i changed print to $msg =.
print map substr($msg, $_, 1) => 0, 6, 2, 13;
print join "" => map substr($msg, $_, 1) => 0, 6, 2, 13;
both printed 'Perl'
:-(
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Wed, 24 Nov 1999 01:10:23 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Q on TPJ #14 smtp article
Message-Id: <383B3B1F.4161773B@home.com>
[posted & mailed]
tavi367@attglobal.net wrote:
>
> Can't use string ("To") as a HASH ref while "strict refs" in use at
> /usr/local/lib/perl5/site_perl/5.005/Mail/Mailer.pm line 272.
...
> $mailer->open(To => ['you@localhost'],
> Cc => ['me@localhost'],
> From => 'me@localhost',
> Subject => 'Some test mail');
Well, without knowing anything about Mail::Mailer, I'd guess that the
open method expects a hashref for its first argument.
That should probably be
$mailer->open(
{
To => ['you@localhost'],
Cc => ['me@localhost'],
From => 'me@localhost',
Subject => 'Some test mail'
}
);
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 1472
**************************************