[16166] in Perl-Users-Digest
Perl-Users Digest, Issue: 3578 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 10 17:38:23 2000
Date: Mon, 10 Jul 2000 14:38:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <963265092-v9-i3578@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 10 Jul 2000 Volume: 9 Number: 3578
Today's topics:
Re: matching question (http related) <lr@hpl.hp.com>
Math::Random for GNUPerl 5.6 on w2k? Tom_Roche@ncsu.edu
Mechanics of a File Upload? <mjochum@nesdis.noaa.gov>
Re: Mechanics of a File Upload? <care227@attglobal.net>
Re: Mechanics of a File Upload? (Malcolm Dew-Jones)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 4 Jul 2000 15:36:32 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: matching question (http related)
Message-Id: <MPG.13cc06cba8a5b5d498aba2@nntp.hpl.hp.com>
In article <3956D923.8EFEFBBF@stomp.stomp.tokyo>,
godzilla@stomp.stomp.tokyo says...
...
> However, there is a shorter better way of
> doing this by replacing your / / / in a
> substitution operator:
>
> $string =~ s!.+(/)!$1!g;
>
> Now you have a sweet and simple one line
> code which does precisely what you want.
It isn't necessary to capture and substitute a literal. Just substitute
it literally.
$string =~ s!.+/!/!;
(nnecessary /g omitted also.)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 06 Jul 2000 13:02:00 -0400
From: Tom_Roche@ncsu.edu
To: perl-win32-users@listserv.activestate.com
Subject: Math::Random for GNUPerl 5.6 on w2k?
Message-Id: <3964BB88.AA19C040@ncsu.edu>
I'm getting a mod_perl server up on w2k/NT5 using GNUPerl 5.6.0. My
project requires a portable RNG, so we're installing Math::Random on
all our platforms.
I CPANed Math::Random, which wasn't too happy. After tweaking
CPAN::Config to use GNU tar (djtarnt wasn't working), I got a Makefile.
GNU make croaked on the very last section
> # --- MakeMaker pm_to_blib section:
> pm_to_blib: $(TO_INST_PM)
> @$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
> "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
> -e "pm_to_blib(qw[ <<pmfiles.dat ],'$(INST_LIB)\\auto')"
> # $(PM_TO_BLIB)
> # <<
> # @$(TOUCH) $@
I commented out the commented section, and removed a lone tab on the
previous line, at which point make got happy. However, the Makefile
wasn't sufficiently Micro$oftish: lots of path items had single
backslashes, which produced file-not-found errors. After fixing that,
I got
D:\ProgramFiles\Perls\GNU\site\5.6.0\.cpan\build\JVENIER001>p:\software\Gnu\make-3.77\make.exe
install
Writing
d:\\ProgramFiles\\Perls\\GNU\\site\\5.6.0\\lib\\MSWin32-x86\\auto\\Math\Random\\.packlist
Appending installation info to
d:\\ProgramFiles\\Perls\\GNU\\5.6.0\\lib\\MSWin32-x86/perllocal.pod
which seemed happy, but wasn't: no Random.pm got made anywhere. So I
grabbed one off a Solaris build, but it wants binaries: a simple test
script
> #!/usr/bin/perl
> use Math::Random ;
> random_set_seed_from_phrase("im a geek");
> print random_uniform();
gets
> Can't locate loadable object for module Math::Random in @INC (@INC contains: d:/ProgramFiles/Perls/GNU/5.6.0/lib/MSWin32-x86 d:/ProgramFiles/Perls/GNU/5.6.0/lib d:/ProgramFiles/Perls/GNU/site/5.6.0/lib/MSWin32-x86 d:/ProgramFiles/Perls/GNU/
> site/5.6.0/lib .) at myrand.pl line 2
> Compilation failed in require at myrand.pl line 2.
> BEGIN failed--compilation aborted at myrand.pl line 2.
although
perldoc Math::Random
works. Does anyone have any suggestions for a fix? or have
Math::Random binaries for GNUPerl 5.6 for w2k (NT4 should work)?
Please reply directly to me as well as the list/group, and TIA,
Tom_Roche@ncsu.edu
------------------------------
Date: Thu, 06 Jul 2000 11:02:03 -0400
From: Matthew Jochum <mjochum@nesdis.noaa.gov>
Subject: Mechanics of a File Upload?
Message-Id: <39649F6B.70EFC691@nesdis.noaa.gov>
Hey All,
I was wondering how the file upload process works? What protocol
the server uses to read the file on a remote computer. How the bytes
are transfered, etc etc...
TIA,
Matt
ps: Please reply directly to me ... it possible
NOTE: remove the .NOSPAM
This is the code I grabbed from freecode.com, and modified it to print
to a file.
#!/usr/bin/perl
#file: upload.pl
#Modified to print to a file
use CGI qw/:standard/;
$file = "/aftp/pub/upload/test.output";
print header,
start_html('file upload'),
h1('file upload');
print_form() unless param;
print_results() if param;
print end_html;
sub print_form {
print start_multipart_form(),
filefield(-name=>'upload',-size=>60),br,
submit(-label=>'Upload File'),
end_form;
}
sub print_results {
my $length;
my $file = param('upload');
if (!$file) {
print "No file uploaded.";
return;
}
print h2('File name'),$file;
print h2('File MIME type'),
uploadInfo($file)->{'Size'};
open ( FILE, ">> $file );
while (<$file>) {
$length += length($_);
print FILE $file;
}
print h2('File length'),$length;
close (<FILE>);
}
------------------------------
Date: Thu, 06 Jul 2000 13:19:40 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: Mechanics of a File Upload?
Message-Id: <3964BFAC.6BE44D97@attglobal.net>
Matthew Jochum wrote:
>
> Hey All,
> I was wondering how the file upload process works? What protocol
> the server uses to read the file on a remote computer. How the bytes
> are transfered, etc etc...
>
Since I note that you are using CGI.pm, you can check this online
version of the documentation at the authors homepage:
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
Look in the section titled: Creating a File Upload Field
------------------------------
Date: 6 Jul 2000 13:50:19 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Mechanics of a File Upload?
Message-Id: <3964f10b@news.victoria.tc.ca>
Matthew Jochum (mjochum@nesdis.noaa.gov) wrote:
: Hey All,
: I was wondering how the file upload process works? What protocol
: the server uses to read the file on a remote computer. How the bytes
: are transfered, etc etc...
The server doesn't read the file on the remote computer. The remote
computer sends the file to the server, after requesting the server to open
a network connection.
The network software uses whatever protocol it uses, which is often TCP/IP
plus HTTP, but not necessarily. Your program will not normally care - if
it's a cgi script then it simply reads and writes to standard input and
output, the only difference being that you have no way to detect the end
of file on standard input unless the remote machine disconnects, and
therefore you must know how much data to read (CONTENT_LENGTH in cgi) or
handle timeouts.
Normally a perl programmer would use a module such as CGI.pm to read this
input and decode it into something useful, and ignore the details I
described above.
------------------------------
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 3578
**************************************