[9278] in Perl-Users-Digest
Perl-Users Digest, Issue: 2873 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 15 01:07:20 1998
Date: Sun, 14 Jun 98 22:00:28 -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 Sun, 14 Jun 1998 Volume: 8 Number: 2873
Today's topics:
=== Calling http:// ....something /something.cgi with <kaichan@dircon.co.uk>
=== Calling http:// ....something /something.cgi with <kaichan@dircon.co.uk>
=== Calling http:// ....something /something.cgi with <kaichan@dircon.co.uk>
=== Calling http:// ....something /something.cgi within blueserf@my-dejanews.com
=== Calling http:// ....something /something.cgi within blueserf@my-dejanews.com
Re: access to a hash of lists (John Cartwright)
Array analogue of scalar 0? <spamsux-tex@habit.com>
Re: Bug? Why is this... (Ilya Zakharevich)
Re: Bug? Why is this... (Mike Stok)
Re: conditional curiosity... <REPLY_TO_damonbrent@earthlink.net>
Re: conditional use statement?? (Earl Hood)
How do I use FileHandle using array ? <yroh@samsung.co.kr>
Re: How do I use FileHandle using array ? <zenin@bawdycaste.org>
ibm aix rs 6000 & Perl <elssa09@callisto.si.usherb.ca>
Information needed! luong@my-dejanews.com
Information wanted luong@my-dejanews.com
Installing perl modules as a non sysadmin <berendes@access4.digex.net>
Large files (>2GB) on Solaris 2.6 <broom@voicenet.com>
Need a jumpstart with creating csv (Barry Ringuet)
Re: Return values of comparison operators (Mark-Jason Dominus)
Re: REVIEW: Perl CGI Programming - No Experience Requir (Chris Nandor)
Re: REVIEW: Perl CGI Programming - No Experience Requir <metcher@spider.herston.uq.edu.au>
Re: Socket newbie: Problems running script (Allan M. Due)
Re: Socket newbie: Problems running script <angst@scrye.com>
Re: unencoding email attachments with perl?? (Earl Hood)
Re: Using 'use' within a package? Good style? <zenin@bawdycaste.org>
Re: while (<>) vs. foreach (@ARGV) <spamsux-tex@habit.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 15 Jun 1998 03:41:07 +0100
From: "Kai Chan" <kaichan@dircon.co.uk>
Subject: === Calling http:// ....something /something.cgi within another script ===
Message-Id: <6m21ah$9u8$1@ezekiel.eunet.ie>
Hi,
I have a web form processing cgi perl script. Within that script I
wish to call another script ( which does some basic SQL database update
thing ).
Can anyone help?
Thanx in advance
Kai
kaichan@dircon.co.uk
------------------------------
Date: Mon, 15 Jun 1998 03:41:07 +0100
From: "Kai Chan" <kaichan@dircon.co.uk>
Subject: === Calling http:// ....something /something.cgi within another script ===
Message-Id: <6m215p$9u3$1@ezekiel.eunet.ie>
Hi,
I have a web form processing cgi perl script. Within that script I
wish to call another script ( which does some basic SQL database update
thing ).
Can anyone help?
Thanx in advance
Kai
kaichan@dircon.co.uk
------------------------------
Date: Mon, 15 Jun 1998 03:41:07 +0100
From: "Kai Chan" <kaichan@dircon.co.uk>
Subject: === Calling http:// ....something /something.cgi within another script ===
Message-Id: <6m21o7$a31$1@ezekiel.eunet.ie>
Hi,
I have a web form processing cgi perl script. Within that script I
wish to call another script ( which does some basic SQL database update
thing ).
Can anyone help?
Thanx in advance
Kai
kaichan@dircon.co.uk
------------------------------
Date: Mon, 15 Jun 1998 02:44:03 GMT
From: blueserf@my-dejanews.com
Subject: === Calling http:// ....something /something.cgi within another script ===
Message-Id: <6m21pk$v2r$1@nnrp1.dejanews.com>
Hi,
I have a web form processing cgi perl script. Within that script I
wish to call another script ( which does some basic SQL database update
thing ).
Can anyone help?
Thanx in advance
Kai
kaichan@dircon.co.uk
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 15 Jun 1998 02:45:29 GMT
From: blueserf@my-dejanews.com
Subject: === Calling http:// ....something /something.cgi within another script ===
Message-Id: <6m21s9$v6h$1@nnrp1.dejanews.com>
Hi,
I have a web form processing cgi perl script. Within that script I
wish to call another script ( which does some basic SQL database update
thing ).
Can anyone help?
Thanx in advance
Kai
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Sun, 14 Jun 1998 19:47:16 -0600
From: jcartwright@wans.net (John Cartwright)
Subject: Re: access to a hash of lists
Message-Id: <jcartwright-1406981947170001@usm-40-17.wans.net>
In article <6lpjeh$7of@news-central.tiac.net>, mike@stok.co.uk (Mike Stok)
wrote:
> In article <3580249C.FDE503EF@wans.net>,
> John Cartwright <jcartwright@wans.net> wrote:
> >Hello All,
> >
> >I am trying to get a list representing the first list element in every
> >hash element. For example, if
> >
> >%HoL = (
> > "flintstones" => [ "fred", "barney" ],
> > "jetsons" => [ "george", "jane", "elroy" ],
> > "simpsons" => [ "homer", "marge", "bart" ],
> > );
> >
> >what I would like is a list with ("fred","george","homer")
> >
> >I have been trying variations on the following statement but without
> >success.
> >
> >@a = @{values %HoL}[0];
>
> @a = map {$HoL{$_}[0]} keys %HoL;
>
> might be one way to do it.
>
> Hope this helps,
>
> Mike
That's cool! I have never used of the map function before, but it seems
to be exactly what I was looking for. Would it be possible to combine the
two following lines, for instance if I wanted the max value from all the
arrays in the hash:
@b = sort (map { $$_[0] } values %HoL);
$max = @b[-1];
I tried variations on:
$max = @{sort (map { $$_[0] } values %HoL)}[-1];
but no success so far. Any help would be appreciated.
Thanks!
--john
------------------------------
Date: Sun, 14 Jun 1998 20:33:01 +0800
From: Austin Schutz <spamsux-tex@habit.com>
Subject: Array analogue of scalar 0?
Message-Id: <3583C2FD.2D0@habit.com>
I found a bug recently in some code I'd done which hinged on the
following dilemma:
I have a subroutine that passes the current value of an array if the
subroutine is passed undef(), otherwise it takes the parameters passed
it and uses them to create the array. Where I run in to trouble is when
I want to 'clear' the array by passing the subroutine an empty array,
like:
sub set_array {
if defined (@_) {
@an_array=@_;
} else {
return (@an_array);
}
}
@original = set_array()
set_array(@new_array);
do_some_stuff_that_uses_an_array(set_array());
# This fails if @original is undef.
set_array(@original);
#Even if:
@original = () unless defined @original;
set_array(@original);
This is analogous to the following, which works well:
sub set_scalar {
if defined ($_[0]) {
$a_scalar=$_[0];
} else {
return ($a_scalar);
}
}
$original = set_scalar()
set_array($new_scalar);
do_some_stuff_that_uses_a_scalar(set_scalar());
# This works if original is undef.
$original = 0 unless defined $original;
set_array($original);
I guess my question is is there a way to have the null array
() passed to a subroutine and not have the subroutine receive undef,
as a 0 is null yet defined?
Thanky,
Tex
------------------------------
Date: 15 Jun 1998 01:30:24 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Bug? Why is this...
Message-Id: <6m1tfg$6u7$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to
<jvb@universe.digex.net>],
who wrote in article <6m1jt9$mus@universe.digex.net>:
> ($a, $b, $c) = split ('\t', "blah blah blah");
> print "$a $b $c\n";
To me it looks like a bug in a RE engine.
split '\t', EXPR;
should be equivalent to
split /\\t/, EXPR;
Is it? What am I missing?
Ilya
------------------------------
Date: 15 Jun 1998 01:42:48 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Bug? Why is this...
Message-Id: <6m1u6o$64j@news-central.tiac.net>
In article <6m1jt9$mus@universe.digex.net>, <jvb@universe.digex.net> wrote:
>($a, $b, $c) = split ('\t', "blah blah blah");
>print "$a $b $c\n";
Split uses its first argument as a regex (except for the special ' '
case). The single quoted string \t is 2 characters </> and <t>, the regex
engine knows that these represent a tab and acts accordingly. If you had
used double quotes then the \t would have been turned into a tab by
the quotes and passed into the regex engine as a single character.
\ is only special in a string in ' ' single quotes before \ or ', so \t
isn't special.
>outputs: blah blah blah
>
>
>$line = join ('\t', "blah", "blah", "blah");
>print "$line\n";
>
>outputs: blah\tblah\tblah\t
the join uses its first argument as a string. There is no second level of
interpretation so it's output as the 2 character sequence you asked for.
>Yes, I mean it outputs "\t" exactly, that is not my way of symbolizing a
>tab. Why is it that split could figure out '\t' was a tab and join
>couldn't? Regardless of which way '\t' should be interpreted, shouldn't
>they both interpret it the same way? I.e., both view '\t' as a tab or
>both view '\t' as exactly "\t"?
No.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Sun, 14 Jun 1998 21:42:10 -0400
From: "Brent Verner" <REPLY_TO_damonbrent@earthlink.net>
Subject: Re: conditional curiosity...
Message-Id: <6m1u54$fp2$1@argentina.it.earthlink.net>
Thank you all for enlightening me on the benchmark module's usage. i'd
never used it before.
brent
------------------------------
Date: 15 Jun 1998 04:11:29 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: conditional use statement??
Message-Id: <6m26th$3lq@news.service.uci.edu>
[mailed & posted]
In article <357F05F7.6231@lucent.com>,
Craig M. Votava <craig@lucent.com> wrote:
>I want to write a single perl script that will
>detect what OS it is running under, so it can
>use the system call to launch a command
>if on a unix machine, or the Win32::Process
>stuff if on a windows based machine.
Look at the "require" operator. "use" is a compile time statement
while require is a runtime statement. Check the docs about "use".
It states what the equivalent code is using require.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 15 Jun 1998 01:45:09 GMT
From: Youngjin Roh <yroh@samsung.co.kr>
Subject: How do I use FileHandle using array ?
Message-Id: <6m1ub5$l2c$1@news.att.co.kr>
Keywords: FileHandle
I want to open 20 files for writing to by using array filehandle.
How do I use file handle?
I tried this
use FileHandle;
@A=( "qwe1", "qwe2", "qwe3");
for $i (0..2) {
open( $FH[$i], "> $A[$i]");
}
for $i (0..2) {
print $FH[$i] "test $i\n";
}
It shows syntax error.
Files seems to open for writing, but how can I write ???
Thanks
------------------------------
Date: 15 Jun 1998 02:40:57 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: How do I use FileHandle using array ?
Message-Id: <897878987.126451@thrush.omix.com>
Youngjin Roh <yroh@samsung.co.kr> wrote:
>snip<
$FH[$i] = new FileHandle ("> $A[$i]")
or die $!;
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Mon, 15 Jun 1998 01:51:19 GMT
From: ELSS Admin <elssa09@callisto.si.usherb.ca>
Subject: ibm aix rs 6000 & Perl
Message-Id: <34A5A630.7E91@callisto.si.usherb.ca>
I may have the wrong group - tell me which is teh correct one - if I am
not in the right place.
I was told I could program my own system messages, say if someone visits
my site and tries to open a page that does not exist.
I was also told it had something to do with Perl!!??
Seems ridiculous.
I'm on an IBM AIX rs 6000 server
Please mail replies
------------------------------
Date: Mon, 15 Jun 1998 02:56:26 GMT
From: luong@my-dejanews.com
Subject: Information needed!
Message-Id: <6m22gp$3h$1@nnrp1.dejanews.com>
Hi all,
Could anybody tell me where on the Internet that I can find documentation of
Perl for Win 32, and where I can download perl modules.
Thanks,
Pham Thuc Truong Luong
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 15 Jun 1998 02:41:21 GMT
From: luong@my-dejanews.com
Subject: Information wanted
Message-Id: <6m21kh$v2a$1@nnrp1.dejanews.com>
Hi all,
Could anybody tell me where on the Internet that I can find the documentation
of Perl for Win 32 and where I can download the perl modules.
Thanks.
--------------------------
Pham Thuc Truong Luong
Hanoi - Vietnam
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Mon, 15 Jun 1998 04:07:31 GMT
From: Christoph Berendes <berendes@access4.digex.net>
Subject: Installing perl modules as a non sysadmin
Message-Id: <761h1.1577$5f.265027764@newsreader.digex.net>
To run the w3mir spider, I've been trying to install the MIME and libwww
modules but can't get the libwww module to see the MIME module.
I'm not the sysadmin, so am stuck with an already installed perl 5.003
So I'm trying to install MIME-Base64-2.05 and libwww-perl-5.10
I start with MIME, since libwww needs that:
Makefile.PL PREFIX=/homeb/berendes/pl
make test
work fine
and
make install
works once I create the necessary subdirectories by hand to allow creation
of
/homeb/berendes/pl/lib/perl5/sun4-sunos/5.003/perllocal.pod
(So I've run make install twice)
but then I can not get the libwww process to find the Mime module for love
or money:
>Checking for MIME::Base64.. failed
>Can't locate MIME/Base64.pm in @INC at Makefile.PL line 49.
is what gets returned when I run 'perl Makefile.pl
PREFIX=/homeb/berendes/pl'
Base64.pm is found if I do the following:
perl -I/homeb/berendes/pl/lib/perl5/site_perl Makefile.PL
PREFIX=/homeb/berendes/pl
Then 'make' works fine, but 'make test' reports:
>base/common-req.....Can't locate MIME/Base64.pm in @INC at
../blib/lib/HTTP/Request/Common.pm line 156.
FAILED tests 10-15
Failed 6/15 tests, 60.00% okay
Test returned status 2 (wstat 512)
base/date...........ok
and I can't seem to get around this.
I read something about dynamic loading in Dejanews and played a bit with
creating my own version of perl, but that didnt' seem to help.
FYI, perl -V reports:
Summary of my perl5 (5.0 patchlevel 3 subversion 0) configuration:
Platform:
osname=sunos, osver=4.1.4, archname=sun4-sunos
uname='sunos zeus.brahma.digex.net 4.1.4 1 sun4m '
hint=recommended, useposix=true, d_sigaction=define
Compiler:
cc='gcc', optimize='-O2', gccversion=2.7.2
cppflags='-I/usr/local/include'
ccflags ='-I/usr/local/include'
stdchar='unsigned char', d_stdstdio=define, usevfork=true
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, randbits=31
Linker and Libraries:
ld='ld', ldflags ='-s'
libpth=/usr/local/lib /lib /usr/lib /usr/ucblib /krb5/lib
libs=-lnsl -lgdbm -ldbm -ldb -ldl -lm -lc -lposix
libc=/lib/libc.so.1.9.5, so=so
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=, ccdlflags=' '
cccdlflags='-fpic', lddlflags='-assert nodefinitions'
@INC: /usr/local/lib/perl5/sun4-sunos/5.003 /usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/sun4-sunos /usr/local/lib/perl5/site_perl
/usr/local/lib/perl5/sun4-sunos .
Thanks.
------------------------------
Date: Mon, 15 Jun 1998 01:50:10 GMT
From: Barry Roomberg <broom@voicenet.com>
Subject: Large files (>2GB) on Solaris 2.6
Message-Id: <35844529.FABA995A@voicenet.com>
Issue:
Large file access (>2GB) via PERL on Solaris 2.6.
What I've tried:
FAQ
CPAN
DejaNews - found a note from
Mike Mondy nospam-mmondy@sugarland.unocal.com
who gave a patch to pp_sys.c and referered to "lfcompile".
I told perl during the compile to "-D_FILE_OFFSET_BITS=64"
based on the lfcompile man page. This allows the "open" not
to fail on a 3GB file, but there still seems to be a lot
more I need to do. "seek()" fails on >2GB, as well as the
"-s file_name" operator.
Does anyone currently have perl running under Solaris 2.6 and
is handling large files well, or are there so many issues
concerning this that I'm going to have to wait for the next
major release?
Or are there 64bit call within perl that I should be using?
(seek64, -s64, etc?).
Barry Roomberg
broomberg@nospam-ccgoupnet.com
------------------------------
Date: Mon, 15 Jun 1998 04:04:11 GMT
From: ringuetb@ix.netcom.com (Barry Ringuet)
Subject: Need a jumpstart with creating csv
Message-Id: <35849c48.40570517@nntp.ix.netcom.com>
I'd like to take the contents of a text file and write it to a
comma-delimited file. Don't know where to begin.
Appreciate any help.
Pls post to this newsgroup or e-mail to barry.ringuet@piog.com
Thanks,
Barry Ringuet
------------------------------
Date: 14 Jun 1998 21:01:23 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Return values of comparison operators
Message-Id: <6m1rp3$rpo$1@monet.op.net>
Keywords: coax Dorothy milkweed typescript
In article <6m1pob$l9d$2@news.ncal.verio.com>, <gerg@shell.wco.com> wrote:
>mjd@op.net (Mark-Jason Dominus) writes:
>>
>>It wouldn't be hard to make an operator, say %!, which just returns
>>its second argument.
>>
>
>Have I misunderstood a subtle difference here, or doesn't the comma
>operator already do this?
I forgot about the comma operator. Thanks.
Saves me a lot of trouble, because now I can say:
You could change the < operator so that it always returned its
second argument, but then it would be the , operator instead.
------------------------------
Date: Mon, 15 Jun 1998 01:18:15 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <pudge-1406982115300001@192.168.0.3>
In article <6lspgm$ikt$1@samba.rahul.net>, c.c.eiftj@54.usenet.us.com
(Rahul Dhesi) wrote:
# The only difference between a list and an array that I can think of is
# that we call a list an array if we use subscript notation on it at least
# once in a program. So the difference appears to be what we do, not what
# it is.
No, a subscripted list is still a list.
print join("",
(split
(//, (`perl -v`)[1])
)[11,19,14,15]
);
Here we put a subscript on the contents of `perl -v`, split that line into
a list, and subscript that list, and neither is an array.
Anyway, as pointed out by others, there are several differences between a
list and an array, not the least of which is that some functions take
arrays as arguments where lists do not suffice. But the one example
difference you cited is not actually a difference.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: Mon, 15 Jun 1998 12:15:32 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <358483C4.9B515315@spider.herston.uq.edu.au>
Tom Christiansen wrote:
>
> [courtesy cc of this posting sent to cited author via email]
<snip>
> An array holds a list. This is easy. The bottom line has to do with
> wither there's an AV * sitting around somewhere. Don't think that too
> confusing for page six?
>
<snip>
Certainly, it's too confusing for page six. Unfortunately, it seems to
be necessary. For me, the whole thing popped into focus the moment I
read one of your posts saying something about AV's. Maybe there could
be something on page six saying:
WARNING: There is a 98% chance you will ask a FAQ on comp.lang.perl.misc
if you don't read the following bit of arcana. [blurb about AV's].
Sorry, but that's just the way it is.
There are some things (like quantum mechanics) where the higher-level
models and abstractions don't make a tenth of the sense that the
underlying nitty gritty does. Talking about the mass of a photon is
enough to drive anyone batty, but the equations, while ugly, are
perfectly clear. This array/list thing is something for which we've
failed to find a higher-level construct that appeals to everybody, so
why not just own up and sock it to 'em?
--
Jaime Metcher
------------------------------
Date: 15 Jun 1998 01:06:56 GMT
From: due@murray.fordham.edu (Allan M. Due)
Subject: Re: Socket newbie: Problems running script
Message-Id: <6m1s3g$mav$0@206.165.146.42>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <358466ac.18782385@news.mnsinc.com>, The Walrus
(spiker@cs.odu.edu) posted...
|I'm extremely new to Socket perl scripting and scripting with modules
|all together. I've been running through my Learning Perl Llama book
|looking in the back at the Networking section and trying out some of
|the code back there. Seems I can't get any of it to work though. I
|know for an in depth discussion on socket programming I should get
|Programming Perl but I haven't gotten around to it yet so give me a
|break. Here's a script I'm trying to run and what I get when running
|it:
|
|#Word for word out of Learning Perl; A Simple Client p246
|#!/usr/bin/perl -w
|use IO::Socket;
[snip]
Your error message suggests that you are using Perl 4.
Under FeeBSD Perl 5 is usually found in:
/usr/local/bin/perl
Try changing your first line to:
#!/usr/local/bin/perl
HTH
--
Allan M. Due
Due@Murray.Fordham.edu
The beginning of wisdom is the definitions of terms.
- Socrates
------------------------------
Date: 15 Jun 1998 01:05:49 GMT
From: angst <angst@scrye.com>
Subject: Re: Socket newbie: Problems running script
Message-Id: <6m1s1d$ltk$5@jelerak.scrye.com>
The Walrus <spiker@cs.odu.edu> wrote:
: #!/usr/bin/perl -w
: use IO::Socket;
: $remote = IO::Socket::INET->new(
: Proto => "tcp",
: PeerAddr => "localhost",
: PeerPort => "daytime(13)",
: )
: or die "cannot connect to daytime port at localhost";
: while ( <$remote> ) { print }
: What I get when running the script:
: "use" may clash with future reserved word at ./net line 2.
: syntax error in file ./net at line 2, next 2 tokens "use IO"
: syntax error in file ./net at line 3, next 2 tokens "IO:"
: Execution of ./net aborted due to compilation errors.
This works just fine for me. What version of perl are you using?
I suspect it's not perl5. perl -v will tell you...upgrade if you're
using an older perl.
--
Erik Nielsen <eln@rmci.net>
mail to above (rather than header address) is answered significantly faster.
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support
------------------------------
Date: 15 Jun 1998 04:23:26 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: unencoding email attachments with perl??
Message-Id: <6m27ju$3vj@news.service.uci.edu>
In article <3581b468.20363076@news2.cais.com>,
- <root.noharvest.\@not_even\here.com> wrote:
>I want to be able to add functionality to my email filtering scripts
>(called by .forward) to capture mime/uuencoded/BinHex attachments and
>write them to a file... I don't have control over what encoding
>method is being used on the sending side, so it needs to be able to
>handle all three (I saw a uuencode/uudecode script in the CPAN, but
>that only deals with 1/3 of what I need).
>
>It doesn't necessarily have to be a perl module, I mean it could
>simply be executing a linux/unix command, much the same as
Check out the comp.mail.mime FAQ. It has a large list of software
related to MIME. Should find something that will work for you.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: 15 Jun 1998 01:24:40 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Using 'use' within a package? Good style?
Message-Id: <897874409.523484@thrush.omix.com>
jon@amxdigital.com wrote:
: I'm a bit new to OOP, but I've read Tom's tutorial and a few books.
We're talking reuse here, but not really OOP.
: I've got a package that needs to make use of objects and functions in other
: packages. (File::Find, and HTML::LinkExtor, in fact). If I do this in my .pm
: file:
: package foo;
: use File::Find;
: use HTML::LinkExtor;
This calls the import() methods of File::Find and HTML::LinkExtor
which is how you get there functions imported into your foo module's
package space (so you don't need to use fully qualified names).
: But if instead I put the use statements in my .pl file:
: use File::Find;
: use HTML::LinkExtor;
: use foo;
: Then it complains. It seems that now package foo has to use fully qualified
: names, and refer to the functions in File::Find as &File::Find::find (for
: example).
Yep, because they where never imported into foo's namespace.
: So which is the better way to do it?
The first way.
: I tried reading up on inheritance (I'm not even sure if this _is_ inheritance),
It's not. You're importing functions from other packages into your
name space, you're not overriding or inheriting there methods.
: and doing thing with @ISA but I got
: scary messages about autoloading (which I don't understand). What should I be
: doing?
If Foo.pm needs File::File, etc then it should be importing them,
not the user of Foo. This should not effect the user of Foo because
anything Foo imports is in Foo's package space, not the user's so
the user won't get unexpected side effects. You had it right the first
time.
None of this relates to OOP, but more to reuse and protecting namespace
in general.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Sun, 14 Jun 1998 20:46:25 +0800
From: Austin Schutz <spamsux-tex@habit.com>
Subject: Re: while (<>) vs. foreach (@ARGV)
Message-Id: <3583C621.5664@habit.com>
Andrew S Gianni wrote:
>
> What's the best way to read a list from the command line? The camel book
> seems to suggest that you should use something like:
>
> while(<>){
> ...
> do stuff with $ARGV
> ...
> }
>
> but when I use that kind of structure, it takes way longer to run than
> if I use something like:
>
> foreach (@ARGV){
> ...
> do stuff with $_
> ...
> }
>
> Is this one of those things where something gets recompiled every time a
> $ARGV is used or something? For now, I'm sticking with the second
> implementation because it takes maybe 2 seconds vs. 30 to run.
>
> Hmm?
This is one of those things that I fould very confusing as a novice
programmer. Perhaps an adjustment to the next release might clarify
this.
foreach (@ARGV); and while (<>); are really pretty unrelated.
The <> operator is powerful, yet bizarre. It reads in files whose names
are files as passed to the script on the command line, or STDIN if no
file names are given. <> does not(!) contain the file names, nor does
@_ at any time contain @ARGV. <> is therefore bound to take up more time
because it treis to open whatever filenames you pass, or waits for you
to enter stuff in on your keyboard (default STDIN).
<> can be useful when you want to process stuff using line-by-line
filters, like:
while (<>) {
s/moocow/holstein/g;
print $_;
}
Make sense? :)
Tex
------------------------------
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 2873
**************************************