[7009] in Perl-Users-Digest
Perl-Users Digest, Issue: 634 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 19 05:47:09 1997
Date: Thu, 19 Jun 97 02:00:24 -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, 19 Jun 1997 Volume: 8 Number: 634
Today's topics:
(chat.cgi <zombie>) <perlprogrammer@hotmail.com>
Re: a perl mode in emacs that does a better job with qu (Ilya Zakharevich)
Re: appending two files into one? (Blake Winton)
Can't find *** in @INC ....Help Please (Shelle)
CLib module for calling dynamic library functions (John Tobey)
Re: file date in perl ? (Tim Gim Yee)
help needed with DB_File (Yuan-fang Wang)
Re: HELP: How to limit the length of contents in guestb <perlprogrammer@hotmail.com>
Re: How do i convert a (float) to (integer) ? (Gorazd Bozic)
Julian Date Function Needed (Frank Fisher)
Re: Linux,glibc-2,perl-5.004_1: make test fails <aj@arthur.rhein-neckar.de>
Re: Perl and Tcl which is suitable for automatic testin <joop@polder.ubc.kun.nl>
scalar vs array (Mats Larsson)
Single proccess network server... <cmason@ros.res.cmu.edu>
Re: Sorting Associative Array? (Urgent) <wesley@woais.com>
WANTED: perl script for base64 MIME decoding <josin@dimensional.com>
Re: WANTED: perl script for base64 MIME decoding (Nathan V. Patwardhan)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 18 Jun 1997 22:43:36 -0700
From: perl guy <perlprogrammer@hotmail.com>
Subject: (chat.cgi <zombie>)
Message-Id: <33A8C707.6602@hotmail.com>
I know what zombie is.. (pretty much), but haven't had the pleasure of
encountering it untill now. and can someone offer me some advice,.. I
have a chat script in perl that
was working fine on our server, *untill* my serevr tech upgraded. We
*were* running apache 1.1.1 with Rad Hat 4, now we are running Apache
1.2, and now I'm getting strange looking errors in the error log, which
I assume is the "upgraded" way of telling you about an error, in a
different way.. (i.e., send script lost connection, is now send body,
etc.).. anyway.. my problem is, that my chat.cgi keeps going zombie on
my! And NOW, *not* untill now.. about 3 people every 20 seconds lose
their messages!.. it worked fine before, other then the errors I
mentioned, whch aren't anything to
worry about.
I know what to do.. Anyway, he (my server tech) changed
it to where it calls the httpd with a force command before it..
(i.e, httpd -f /etc/httpd/blah..blah...), and for when it calls the perl
as
well.. so.. how can I fix this to not go zombie on me (or as much)?. or
at
least so people might not miss their messages?. I know about how it
works,
and how it's they usually appear when a process has been killed while it
was
waiting for some i/o connection. many times they go away when the parent
dies..
And this is a problem from the slowness of all the people chatting, but
it's not
any worse then it was before, yet now it's going zombie and people are
missing messages? I just wonder what I can change to have it work better
with the new set up
perhaps?
BTW, he also changed the keepalive and maxclients, etc.. Also, we are
going to be
installing mod_perl, etc. so will this fix the problem?. It's slow
already, but now people are actually missing files.. even when it's
writing to the disk.. 10% or so of the people's chat.cgi is going zombie
on them, and is a zero byte file in RAM and CPU.. what can I do?.
------------------------------
Date: 19 Jun 1997 06:43:18 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: a perl mode in emacs that does a better job with quotes?
Message-Id: <5oake6$7si@agate.berkeley.edu>
In article <5o731j$n9@gap.cco.caltech.edu>,
Shimpei Yamashita <shimpei@socrates.caltech.edu> wrote:
> Both the perl-mode that comes with emacs 19.34b and cperl-mode included
> in perl 5.004 are not terribly smart about syntax-highlighting lines with
> unbalanced quotes, like, say,
>
> s/'/'"'"'/g;
First of all, you can backwack bad guys. Second, if you have fresh
enough emacs (starting from Apr 15 1997 RMS Emacs), cperl will do it.
Ilya
------------------------------
Date: 18 Jun 97 21:30:45 GMT
From: bwinton+spam@incontext.ca (Blake Winton)
Subject: Re: appending two files into one?
Message-Id: <1997Jun18.173045.3445@jarvis.cs.toronto.edu>
In article <5o9fgv$4k@news-central.tiac.net>, mike@stok.co.uk (Mike Stok) wrote:
>In article <5o8phc$gc@fridge-nf0.shore.net>,
>Nathan V. Patwardhan <nvp@shore.net> wrote:
>>Magnus Bodin (Magnus.Bodin@tychonides.se) wrote:
>>
>>: foreach $appfile (@ARGV) {
>>: open(TMP,$appfile);
>>
>>Ouch.
>>
>>perl -e 'while(<>) { print; }' filename filename >> out.txt
>
>Ouch ;-)
>
>perl -pe '' filename filename >> out.txt
>
>Mike
Ouch.
< filename < filename > out.txt
(hey, works in my shell... ;)
Sorry, just had to.
Later,
Blake.
------------------------------
Date: Thu, 19 Jun 1997 06:06:25 GMT
From: shelle@interaccess.com (Shelle)
Subject: Can't find *** in @INC ....Help Please
Message-Id: <5oai91$21k_004@interaccess.interaccess.com>
Having been through all of the manuals, FAQs, and online documents regarding
Perl on Windows95, I have yet to find a suitable answer for why I get errors
such as:
Can't locate XXXXX/XXXX.pm in @INC at filename.pl line ##.
Actually I thought I found a couple of solutions but none seemed to solved
this problem. Suggestions appreciated.
P.S. Yes, I've "R" so many versions "OTFM" in the past week or so I need an
eye exam; I am not asking you do what I have not already attempted to great
extents. Flames not necessary...I have relatives I can phone if I want abuse.
Michelle ----,-'-(@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Michelle Feigen ----,-'-(@ shelle@interaccess.com
MEAN PEOPLE SUCK!
http://homepage.interaccess.com/~shelle/
http://homepage.interaccess.com/~shelle/grafx/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------
Date: 19 Jun 1997 00:58:15 +0000
From: jtobey@user1.channel1.com (John Tobey)
Subject: CLib module for calling dynamic library functions
Message-Id: <m3n2onmms7.fsf@localhost.user1.channel1.com>
This module allows one to load and call native library functions on
the fly from perl. It has been tested successfully on PC Linux and
FreeBSD, but it contains architecture-specific code which may not work
on all platforms.
Please report bugs, successes, and ports to this newsgroup and the
author.
begin 644 CLib-0.10.tar.gz
M'XL(")ECJ#,``T-,:6(M,"XQ,"YT87(`[#MM=]K&TOUJ_8HQ)D&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%GV0O!89<)<[%3RS<H\5H]RK
M\VY_WJHJ4AJUJC)A.I=V$/!9/K9X".`L6^D/E=/:>/E%[JJO1T6O*EQ\`R"B
M'W_YUOHQF'1KG=(,,/P5$S9A:GF\BL;V&5M@9WF2BM'V25LP9'D21.Z*G6W"
MP:ZE(6--3.W99BW:@5Q,L$/KK`QWA]ZUB^ZL'^``W-R/K=9#3^0GLDC?]5Y'
MZK.0/QD<M$C:MY*;-Y.H!9[93X0U>D:JT$+LY>_XP;_O%)^(3?KX?Z_3]:AU
MGV(R;OSR+9S[NBW:6/X]D%]V^OC'-Z+%',M(`7)RN*PK+K2)_(F,\;[@1,E-
M,J?3);X-=_X4SU;\+XGX=)$QMQ^:?O_HY%F_?]T+\C_X1/_^T^')J^='O7?_
M^35^UO]!WV[V?^SO7__[3_^5CU;]&T7_-8X+XAI/HXD"HRU"QK4*7TOL]>?Z
8<_VY_EQ_KC_7G^O/_]WGGX23L!4`>```
`
end
------------------------------
Date: Thu, 19 Jun 1997 08:04:44 GMT
From: tgy@chocobo.org (Tim Gim Yee)
Subject: Re: file date in perl ?
Message-Id: <33a8e643.226059716@news.oz.net>
On Tue, 17 Jun 1997 06:53:51 GMT, cutt@netcom.com (Paul S. Cutt)
wrote:
>I wonder how I can get the date of a file in perl formatted in
>day month year ? Loked at the stat command but does not seem to give the
>time in
>the right format or I do not know how to convert it.
$mtime = (stat $filename)[9]; # Seconds since 1970 or so...
print scalar localtime $mtime;
-- Tim Gim Yee tgy@chocobo.org
http://www.dragonfire.net/~tgy/moogle.html
"Will hack perl for a moogle stuffy, kupo!"
------------------------------
Date: 18 Jun 1997 10:49:13 -0700
From: yfwang@cs.ucsb.edu (Yuan-fang Wang)
Subject: help needed with DB_File
Message-Id: <5o972p$n1r@tao.cs.ucsb.edu>
Folks:
I hope someone can help me with the following:
1. I used dbmopen and dbmclose to manage hash data from CGI. However, I
noticed that the the key/value pairs are limited to 1024 bytes total.
Is there a way to enlarge the 1024 limit? Also, the Perl Camel book
mentions that there is no way to lock/unlock with dbmopen. Then what
happens with multiple simultaneous accesses, will that introduce
inconsistency into the hash data file?
2. I also look into DB_File which seems to overcome the above
difficulties: that DB_File allows key/value pairs to be of any size and
provides a locking and unlocking mechanism for mutual exclusive access
to a hash file. However, 'Use DB_File' returns an error message (meaning
that DB_File is not installed on our site). I went to CPAN and followed the
link ftp://ftp.cdrom.com/pub/perl/CPAN/modules/by-module/DB_File/ only
to find an ILYAZ directory which doesn't seem to contain DB_File. Can
anyone tell me where to get DB_File?
3. If I would like to have (1) key/value pairs to be of any size and
(2) a locking and unlocking mechanism for mutual exclusive access
to a hash file, is DB_File the way to go? Any other ways?
I tried SDBM_File and NDBM_File, but cannot figure out how
to do locking with them.
any pointer will be greatly appreciated.
please reply to yfwang@cs.ucsb.edu
------------------------------
Date: Thu, 19 Jun 1997 00:39:57 -0700
From: perl guy <perlprogrammer@hotmail.com>
Subject: Re: HELP: How to limit the length of contents in guestbook script?
Message-Id: <33A8E24D.25FF@hotmail.com>
Larry D'Anna wrote:
>
> perl guy wrote:
>
> > Larry D'Anna wrote:
> > >
> > > Jimmy wrote:
> > >
> > > > Hi, I have a guestbook script that was created using perl 5, and I
> >
> > > > want
> > > > to limit the length of user's comments. Let say 500 characters.
> > > >
> > > > So, if someone write his comment over 500 characters, he will
> > > > get a message to warn him.
> > > >
> > > > How can I do that?
> > > >
> > > > Thanks,
> > > >
> > > > Jimmy
> > >
> > > Use javaScript to validate the input before it is sent.
> > >
> > > --
> > > Larry D'Anna
> > > javaGuy
> >
> > Well I was going to ask why the heck someoen would make it so others
> > HAVE to have java to use something.? That, to me, is totally uneeded
> > and
> > a waste of time. I use java for some things.. but when using perl/cgi
> > scripts, it's better to (in my opinion) stay away from other things,
> > like java. it's not needed and it's limiting to people going to your
> > sites. /2 the people I know don't surf with java on anyway.. let
> > alone,
> > all the poor sob's that still use non-java capable browsers.. I say
> > that's just a really bad idea!.. I believe he came here to ask (in
> > this
> > *perl* newsgroup), of how to do this, and I always see a lot of people
> >
> > saying to use java.. why?.. i thought this was a perl ng?.. sorry for
> >
> > the sarcasm.. but I think people are pointed towards java too much in
> > here.. it's not needed, they can do it with perl, and they are asking
> > in
> > the perl ng.. so, why use java?.. Hmm.. whatever.. no offense.. but
> > why?.
>
> Well you could use GCI alone to do this but you would have to
> make some response page saying that the entry was unsucsesful
> or whatever so it just seems a lot cleane to check this kind of thing
> client side. It also takes a little of the load of of the server.
>
> As far as people without java capable browsers, Netsscape 4
> _is_ free...
>
> BTW I'm not bashing perl (which I like a lot more than java anyway
> except you can't securly execute it on a web browser or whatever)
> but it you can do it client side why not?
>
> --
> Larry D'Anna
> javaGuy
Don't get me wrong. java is ok for some things.. some things not..
someone emailed me about how java SCRIPT is not *java*.. two different
things.. I suppose I should have mentioned that I program in java.. oh
well.. anyway.. for what this person wanted, it was a few lines of
perl.. you didn't even give the java script. You don't need a java
browser for some things.. but when uyou have to have it.. no one will
want to go and download a browser and then come back.. most people just
pass it up.. not a big deal.. but I just didn't see the point in using
java.. but to each his own.. I'm not bashing either jave or perl.. it
just seems that most people would have to learn java.. it doesn't
matter.. it's great to learn as much about as many languages as you can,
and java is worth leanring.. just with asp sites, and other up and
comming things, it's getting more and more useless.. or so it seems (to
me). I agree perl is better. that's why I'm here looking like an idiot
posting my opinions.
------------------------------
Date: 19 Jun 1997 07:46:50 GMT
From: xmas@arnes.si (Gorazd Bozic)
Subject: Re: How do i convert a (float) to (integer) ?
Message-Id: <5oao5a$39j$2@kanja.arnes.si>
In article <adelton.866206771@aisa.fi.muni.cz>,
Honza Pazdziora <adelton@fi.muni.cz> wrote:
>
>int($random) if you just want to truncate, sprintf("%.0f", $random) if
>you need to round it.
int($random+0.5) rounds the number, no need to go around the corner and
make it inefficient on the way.
--
Gorazd Bozic
------------------------------
Date: Thu, 19 Jun 1997 04:55:28 GMT
From: frank@primemail.com (Frank Fisher)
Subject: Julian Date Function Needed
Message-Id: <33a8bbbb.1597349@news.earthlink.net>
I need to count days into the future; example, today() + 45 days to
get a mm/dd/yy date. Is there a julian date function I can use or
some other perl function that will do the same thing?
Thanks...
--frank
------------------------------
Date: 18 Jun 1997 21:35:47 +0200
From: Andreas Jaeger <aj@arthur.rhein-neckar.de>
Subject: Re: Linux,glibc-2,perl-5.004_1: make test fails
Message-Id: <u8hgevk8ks.fsf@arthur.rhein-neckar.de>
>>>>> Andreas Steffan writes:
> Hi
> I wonder if anyone succeeded in building perl-5.004(_1) with glibc-2
> on Linux.
At least one did it. :-).
> "make" finshed without errors, but "make test" yielded the following
> errors:
> [...]
> Failed 26 test scripts out of 152, 82.89% okay.
> "perl harness" died with a segfault.
> Any ideas ?
> PS: Linux-2.0.29,glibc-2.0.3,perl-5.004_1,gcc-2.7.2.2-glibc
Please send the output of ldd /usr/bin/perl (or wherever perl lives on
your system) and of perl -V. perl should compile without problems with
glibc, there's nothing unusual in your configuration.
Andreas
--
Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de
for pgp-key finger ajaeger@alma.student.uni-kl.de
http://www.student.uni-kl.de/~ajaeger/
------------------------------
Date: 19 Jun 1997 08:29:41 GMT
From: "Joop Jansen" <joop@polder.ubc.kun.nl>
Subject: Re: Perl and Tcl which is suitable for automatic testing
Message-Id: <01bc7c8a$f40a0640$2415ae83@beemster>
Hello Chuan Wang,
Use Perl. Its syntax looks more like common programming languages and it is
more powerful.
Kind regards,
Joop Jansen
Chuan Wang <chuan@engr.mun.ca> wrote in article
<5o9lck$59q$1@coranto.ucs.mun.ca>...
> Hi,
>
> I'm new to Perl and Tcl and no experence in software testing. If I want
> to write the testing script, between Perl and Tcl, which one is more
> suitable for that? Any advice is appeciated.
>
------------------------------
Date: 19 Jun 1997 05:53:13 GMT
From: matlar@rsv.se (Mats Larsson)
Subject: scalar vs array
Message-Id: <5oahg9$6d0$1@u30039.rsv.svskt.se>
I tried to call a subroutine in a "smart" way like this, i.e I want
the subrotine to recieve the minussign when no arguments given.
&fil_utskr (@ARGV||"-") unless $opt_P;
sub fil_utskr {
local $file;
FIL: while(<@_>){
$file = shift @_;
if (!open (INFIL,$file)) {
print (STDERR "Kunde inte vppna infil $file\n");
next FIL;
}
print "FIL_START $file\n";
while (<INFIL>) {
.....
if the script is called without arguments it reads STDIN as intended
but if I run the script with one or more arguments, @ARGV will be treated
as a scalar value and the subroutine recieves the number of arguments.
I want to write out information on every file opened that's why I transfer
the filenames to the subroutine instead of just using (<>) for reading.
This is of course not a big problem it's easy to solve in some other way.
It's just interesting to know if there is some way to force ARGV to be
array or is it incompatible whith the || operator.
Mats Larsson
Email: matlar@rsv.se
------------------------------
Date: 19 Jun 1997 06:05:31 GMT
From: Chris Mason <cmason@ros.res.cmu.edu>
Subject: Single proccess network server...
Message-Id: <5oai7b$a8d@news.onramp.net>
All-
I'm trying to implement a network server which accepts multiple
connections within a single process. All of the example networking code I
can find shows either blocking io and one connection at a time, or
forking a child to handle each connection. I don't want to fork because
it negates the gain I'm getting by writing this server (if you care, see
the `Tie and Multidimensional Hashes...' thread). I think what I need is
non-blocking io and accept() calls, but I don't know enough about sockets
to do that.
I've got some code below, but my problem is that both accept() and
network input block the proccess, causing none of the other connections
to be serviced. These two blocking calls are commented as `PROBLEM'
below. I'm also having problems with accept and storing the filehandle
it is "passed". I seemed to have hacked around this with FileHandle, but
I'm still having problems.
Any help, comments, advice would be greatly appreciated. (Style comments
are cool too, I can always stand to learn more about perl.)
-c
I'd like to do something like the following:
----cut here------
#!/usr/bin/perl -w
# single process server (doesn't work yet)
# Chris Mason <cmason@ros.res.cmu.edu> 18 Jun 1997 v.000001
use Socket;
use FileHandle;
$debugging = 1;
### globals #################################################
$working = 1;
#%HASHES = {}; # the hashes (see `Tie and Multidimensional...')
%CONNS = {}; # a hash of existing connections
### subroutines #############################################
sub debugmsg {if ($debugging) {print @_;}}
sub done { $working = 0 };
$SIG{HUP} = \&done; # allow graceful shutdown.
# the handler routine handles one atomic action with the child.
# it will be called repeatedly to grab input and respond to
# commands. more than one of these can exist. it returns 1
# if the connection is closed (and needs to be deleted. otherwise
# it returns 0.
sub handler {
my ($conn) = @_;
my $socket = $CONNS{$conn}{'socket'};
my $host = $CONNS{$conn}{'host'};
my $port = $CONNS{$conn}{'port'};
my $in = <$socket>; # BLOCKS?? PROBLEM!
if ($in) {
debugmsg("Command $in recieved from $host $port.\n");
if ($in =~ /^COMMAND1/) {
print $socket "This is output for command one.\n";
} elsif ($in =~ /^COMMAND2/) {
#bunch of commands to handle here...
} elsif ($in =~ /^CLOSE/) {
print $socket "Connection dieing.\n";
debugmsg("Closing connection from $host $port.\n");
close $socket;
return 1; #this connection is done.
} else {
print $socket "Unknown command.\n";
}
}
return 0; # everything is rosey
} # sub handler
### initialization ##########################################
#just about everything here comes from Camel pg 349-50
my $port = shift || 1978; #'twas a good year
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
my $proto = getprotobyname('tcp');
debugmsg("Server starting... using port $port...\n");
socket(Incoming, PF_INET, SOCK_STREAM, $proto) or die "socket(): $!.\n";
debugmsg("socket() ok.\n");
setsockopt(Incoming, SOL_SOCKET, SO_REUSEADDR, pack("l", 1))
or die ("setsockopt(): $!.\n");
debugmsg("setsockopt() ok.\n");
bind (Incoming, sockaddr_in($port, INADDR_ANY))
or die ("bind(): $!.\n");
debugmsg("bind() ok.\n");
listen(Incoming, SOMAXCONN) or die ("listen(): $!.\n");
debugmsg("listen() ok.\n");
debugmsg("Server started. Listening for connections...\n");
### main loop ##############################################
my $paddr;
my $next = 0;
while ($working) {
#call each connections handler in turn.
foreach $connection (keys %CONNS) {
my $close = &{ $CONNS{$connection}{'handler'} }($connection);
undef $CONNS{$connection} if $close;
}
#grab a new connection if its in the queue
$paddr = accept ($tempsocket, Incoming); # BLOCKS! PROBLEM!
die ("accept(): $!.\n") if $!;
if ($paddr) { #we've got a new connection to handle.
#this is not very pretty...
my $tempsocket = new FileHandle;
$CONNS{++$next}{'paddr'} = $paddr;
$CONNS{$next}{'socket'} = $tempsocket;
($CONNS{$next}{'port'}, $CONNS{$next}{'iaddr'}) = sockaddr_in($paddr);
$CONNS{$next}{'host'} = gethostbyaddr($CONNS{$next}{'iaddr'}, AF_INET);
$CONNS{$next}{'handler'} = \&handler;
debugmsg("New connection from $CONNS{$next}{'host'}\
$CONNS{$next}{'port'}.\n");
}
}
debugmsg("Gracefully shutting down...");
foreach $connection (keys %CONNS) {
print ${CONNS{$connection}{'socket'}} "Closing now.\n";
close $CONNS{$connection}{'socket'};
}
debugmsg("Done.\n");
__END__
--
Chris Mason -- <cmason@ros.res.cmu.edu> <http://ros.res.cmu.edu/>
"We have to go. I'm almost happy here." "So stay." "I've lived too long
with pain. I won't know who I am without it." -O.S.Card,_Ender's_Game_
------------------------------
Date: Thu, 19 Jun 1997 03:29:44 -0500
From: Wesley Miaw <wesley@woais.com>
Subject: Re: Sorting Associative Array? (Urgent)
Message-Id: <33A8EDF8.69C3@woais.com>
John Bokma wrote:
> You can't sort an associative array. However you can walk trough all
> the values in sorted
> order e.g. to print the key-values:
>
> foreach $key (sort keys %array)
> {
> print "$key containts $array{$key}\n";
> }
>
> or assign the keys in sorted order to an array:
>
> @sorted = sort keys %array;
Well, the sort is only one step farther.
foreach $key (sort keys %hash) {
$key_sorted_hash{$key} = %hash{$key};
}
--
Wesley Miaw wesley@woais.com
World of Artists Internet Services http://www.woais.com/
71 Middlesex Drive Tel: 518-439-0412
Slingerlands, NY 12159 FAX: 518-439-9722
------------------------------
Date: Wed, 18 Jun 1997 23:02:36 -0600
From: Josin Alvistur <josin@dimensional.com>
To: rmiug discuss <rmiug-discuss@rmiug.org>
Subject: WANTED: perl script for base64 MIME decoding
Message-Id: <Pine.SUN.3.96.970618225813.18068A-100000@flatland.dimensional.com>
would appreciate pointers on how to get one.
searched the web, but only found C versions.
thanks - josin
_________________________________________________________________________
In Heaven there will be no DOS, no Intel, and above all, no Bill.
------------------------------
Date: 19 Jun 1997 04:59:22 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: WANTED: perl script for base64 MIME decoding
Message-Id: <5oaeba$6gq@fridge-nf0.shore.net>
Josin Alvistur (josin@dimensional.com) wrote:
: would appreciate pointers on how to get one.
Get MIMETools or use the MIME modules which were included with LWP.
http://www.perl.com/CPAN/modules/by-module/MIME/
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
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 634
*************************************