[7184] in Perl-Users-Digest
Perl-Users Digest, Issue: 807 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 4 02:20:39 1997
Date: Sat, 2 Aug 97 07:02:08 -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 Sat, 2 Aug 1997 Volume: 8 Number: 807
Today's topics:
Re: !Capture who command results (A. Deckers)
Re: all subs in one file or many? speed differences <rootbeer@teleport.com>
Re: Any nice "Powered by Perl" gifs? nospam@domain.com
array growth question (Tim Gray)
Re: ARRGH! This class has no class <adrianh@pobox.co.uk>
Bitwise operator behaviour (Benjamin T Grover)
Re: Bitwise operator behaviour (Benjamin T Grover)
Re: Building perl5.004_01 on cygwin32 (Danny Aldham)
Re: CGI and foreign languages?? (Gil)
Chat Room Program <saturday@wisemind.demon.co.uk>
Re: comments in regular expressions (wish list) (Pete Jordan)
Re: comments in regular expressions (wish list) (Eric Bohlman)
Re: comments in regular expressions (wish list) <rootbeer@teleport.com>
Compiler-a3 & dbm kb@u2.cs.umb.edu
die(ing) on seek(FH,0,0) <alex.t.silverstein@bender.com>
Re: file extensions (Jeff Stampes)
Filter javascript, etc...problem!! Quick question.. <guitarweb@hotmail.com>
free perl interpreter <tetnys@ibm.net>
Re: GetOpt::Long - Corequisite options? (Johan Vromans)
howto import other perl file into current one?? <jlu01@emory.edu>
Re: keys/values 2 hashes (Tad McClellan)
Re: look at this <guitarweb@hotmail.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 1 Aug 1997 22:14:13 GMT
From: I-hate-cyber-promo@man.ac.uk (A. Deckers)
Subject: Re: !Capture who command results
Message-Id: <slrn5u4ntl.3pk.I-hate-cyber-promo@news.rediris.es>
In <33DF7659.7639@samoilu.net>,
Lauri Laakso <lauri@samoilu.net> wrote:
>When I type who I get...
>
>paja:/lauri$ who
>lauri ttyp0 Jul 30 18:48 (paja.samoilu.net)
>inkinen ttyp3 Jul 30 16:39 (cypress.samoilu.)
>paja:/lauri$
>
>...how do i get those (2 in this example) lines?
You read the FAQ, which will tell you about backticks, among other
things.
HTH,
ALain
--
Perl information: <URL:http://www.perl.com/perl/>
Perl archive: <URL:http://www.perl.com/CPAN/>
Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<
------------------------------
Date: Fri, 1 Aug 1997 15:25:11 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Dan Boorstein <dboorstein@ixl.com>
Subject: Re: all subs in one file or many? speed differences
Message-Id: <Pine.GSO.3.96.970801152200.29910P-100000@kelly.teleport.com>
On Fri, 1 Aug 1997, Dan Boorstein wrote:
> i have a good size script (=~ 1200 lines) which contains about 75
> subroutines. i am wondering how this affects start up time
> on the script. since any single execution of the script only calls
> 10 - 15 of the subs, is there considerable extra overhead during
> compiling and initialization due to the 60 - 65 unused subs?
Maybe. But this sounds like a job for the AutoLoader! Does AutoLoader.pm
do anything you need? (It may make things faster or slower, but it sounds
as if in your case it would be an improvement.) Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 2 Aug 1997 02:13:29 GMT
From: nospam@domain.com
Subject: Re: Any nice "Powered by Perl" gifs?
Message-Id: <5ru549$1fn$1@news2.voicenet.com>
Simon Fairey (sfairey@adc.metrica.co.uk) wrote:
: > Has anyone ever seen any nice "Powered by Perl" gifs?
: >
: > (Maybe with a really muscular-looking camel...)
: It would probably be worth asking this on the
: 'comp.infosystems.www.authoring.cgi' newsgroup as well.
Technically it would be off-topic on that newsgroup.
Hah! I've been wanting to post a snide "off-topic" comment.
Finally got my chance! ;)
--
##--------------------------------
## J o h n N o l a n
## jpn acm org
##--------------------------------
------------------------------
Date: 01 Aug 1997 17:24:37 -0400
From: tim@hcirisc.cs.binghamton.edu (Tim Gray)
Subject: array growth question
Message-Id: <t0hgd9ppey.fsf@hcirisc.cs.binghamton.edu>
Does an array grow if you try to access elements past the end of the
array or do you actually have to assign something past the end to get
the array to grow?
I have a program that iterates through a 2 dimensional array and needs
to compare the current element with the previous and next elements.
Suppose the are nine elements. Would the following code cause it to
grow?
if($array[8][1] == $array[9][1])
I was using a for loop to go through the array and using $#array to
determine the stopping point for the loop, but the array kept growing
until swap space was exhausted and the program died with an out of
memory error. Thanks.
------------------------------
Date: Fri, 01 Aug 1997 12:15:35 -0400
From: Adrian Hawryluk <adrianh@pobox.co.uk>
Subject: Re: ARRGH! This class has no class
Message-Id: <33E20BA5.A2CCFB07@pobox.co.uk>
Hello, I wish to thank Roger for suggesting the FileHandle library, but
it didn't work. The fileHandle library uses type GLOB as well and has
the exact same problem, with just a little difference with the
interface.
Here is a sample programme that shows what I don't want:
--> start of sample programme <--
#!/usr/bin/perl -w
package test;
use FileHandle;
sub new($$)
{
my $type = shift;
my $fileName = shift;
my $self = [];
$self[0] = new FileHandle;
$self[0]->open("<".$fileName) or die("Cannot open \"$fileName\"");
bless ($self);
}
sub prn
{
my $fh = $self[0];
print "$fh\n";
my $string = <$fh>;
print $string;
}
package main;
my ($foo,$bar);
$foo = new test("file1");
$bar = new test("file2");
$foo->prn();
$bar>prn();
--> end of sample programme <--
file1 contains: "a<CR>b<CR>c<CR>"
file2 contains: "1<CR>2<CR>3<CR>"
the output is the following:
--> start of output <--
FileHandle=GLOB(0x8109080)
1
FileHandle=GLOB(0x8109080)
2
--> end of output <--
As you can plainly see each object $foo and $bar contain the reference
to the same file handle object. This is no good.
Any other suggestions?
Thanx in advance.
Adrian
------------------------------
Date: 1 Aug 1997 21:30:15 GMT
From: stryker@defcon.engin.umich.edu (Benjamin T Grover)
Subject: Bitwise operator behaviour
Message-Id: <5rtkh7$j6l@srvr1.engin.umich.edu>
In both PERL programming books that I have, they claim that perl does
the type conversion between string and scalar for bitwise operation.
Although when I tried do this:
$flipped = $class->{'original'.$bit}^$bitVal;
print " $bit is $bitVal flipped = $flipped $class->{'original'.$bit}
\n";
everything except for $flipped would be defined.
Then I did this:
$fineBeThatWay= $class->{'original'.$bit};
if ($fineBeThatWay == 1)
{
}
$flipped = $fineBeThatWay^$bitVal;
print " $bit is $bitVal flipped = $flipped $class->{'original'.$bit}
\n";
because telling PERL that the variable $class->{'original'.$bit} was
scalar didn't work either, but somehow it finally decides to do the
conversion when I do a scalar compare.
I don't know exactly what my question is, other than why does it behave
in this manner?
Thanks,
Ben
------------------------------
Date: 1 Aug 1997 22:53:40 GMT
From: stryker@defcon.engin.umich.edu (Benjamin T Grover)
Subject: Re: Bitwise operator behaviour
Message-Id: <5rtpdk$ml8@srvr1.engin.umich.edu>
In the previous article I said that $class->{'original'.$bit}^$bitVal
being a string seemed to be the problem. I checked out the code without
using $class->{'original'.$bit} by substituting in a string
constant '1' and the program worked without the if statement. I think it
has something to do with the way perl is storing the members of the class.
Can anyone shed any light on why this would be a problem?
Thanks,
Ben
Benjamin T Grover (stryker@defcon.engin.umich.edu) wrote:
: In both PERL programming books that I have, they claim that perl does
: the type conversion between string and scalar for bitwise operation.
: Although when I tried do this:
: $flipped = $class->{'original'.$bit}^$bitVal;
: print " $bit is $bitVal flipped = $flipped $class->{'original'.$bit}
: \n";
: everything except for $flipped would be defined.
: Then I did this:
: $fineBeThatWay= $class->{'original'.$bit};
: if ($fineBeThatWay == 1)
: {
: }
: $flipped = $fineBeThatWay^$bitVal;
: print " $bit is $bitVal flipped = $flipped $class->{'original'.$bit}
: \n";
: because telling PERL that the variable $class->{'original'.$bit} was
: scalar didn't work either, but somehow it finally decides to do the
: conversion when I do a scalar compare.
: I don't know exactly what my question is, other than why does it behave
: in this manner?
: Thanks,
: Ben
------------------------------
Date: 1 Aug 1997 16:38:52 -0700
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Building perl5.004_01 on cygwin32
Message-Id: <5rts2c$ata$1@lennon.postino.com>
Allan Anderson (cerebus@mega.megamed.com) wrote:
: I'm trying to build perl5.004_01 on my winNT box, with b18 of the
: Cygnus GNU win32 kit installed. I think that I followed the instructions
: but I am getting a link error when it firest tryes to build miniperl.
: It complains about how in libperl.a(pp_sys.o) there's an undefined
: reference to setpwent. Any ideas what might be causing this?
There are some bugs. The first bug is in the patch program that comes
win gnuwin32. Get patch2.4 from prep.ai.mit.edu and build it.
Then get the perl5.04_01.patch from www.tiac.net/users/cgf . Apply
the patch, and then run configure again. Double check your
$perlpath variable, and the path to the gnuwin32 libraries.
Good luck.
--
Danny Aldham SCO Ace , MCSE , JAPH , DAD
I don't need to hide my e-mail address, I broke my sendmail.
------------------------------
Date: Fri, 01 Aug 1997 12:58:25 GMT
From: mingtian@hotmail.com (Gil)
Subject: Re: CGI and foreign languages??
Message-Id: <33e1d9b4.24605897@usenet.kornet.nm.kr>
roger@ole-net.com (Roger Easlick) wrote:
>Thanks, Abigail, that sounds encouraging. The script I am currently
>using puts weird characters in the text DB file in the place of the
>extended characters (accented letters). Any suggestions on good perl
>books?
Hi :)
What do you want to do??
special characters like 8-bit codes, control characters and some symbols
are encoded as %XX, where XX is its hexa code such as %1F, %A5..
if user post the data contains such special characters, they will be saved as they are
unless the they are decoded,
# SPACE character is encoded as "+", so it needs to change from "+" to SPACE
$chatraw =~ tr/+/ /;
# this is to block control characters that may be dangerous for security or text DB
#but I am not sure how we can input or pass control characters from browser or ..
$chatraw =~ s/(%[0-1][0-9A-F]])//g;
#now decode all the encoded special characters
#for example, "%" is encoded as "%25" and it is decoded to "%"
$chatraw =~ s/%(..)/pack("C", hex($1))/ge;
CJK(Chinese, Japanese, Korean) chatacters are usually in TWO 8-bit codes
they can also be encoded and decoded well with the method above :)
...
Gil
Homepage: http://soback.kornet.nm.kr/~chlang/
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">
!F 1W4k 3*?!0T4B >pA&3* GQ<[@L 2I@L?4@84O 0q8q1f 59>F3*?@4B !F
"> 594c ?6?!<- H/Hw 9L<RA~0m @V4B 5i2I GQ<[@L?M55 00>F ">
!F H%@Z@V>n >5>5GQ 3*@G 0!=??! Hq8A@; @|GXAV4x 2I !F
!F "4^7!<- >HAV8i ;/>n6s" !F
">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">!%">
------------------------------
Date: Fri, 1 Aug 1997 19:13:29 +0100
From: "Saturday" <saturday@wisemind.demon.co.uk>
Subject: Chat Room Program
Message-Id: <870459250.6466.2.nnrp-1.9e98dedf@news.demon.co.uk>
Hi, I was wondering if anyone would like to write me a little program that
will allow chatting on my web page. I'm in London and am starting an
Internet Radio Station playing UK dance music (http://www.0171.com). If
you could help I'd be very happy. The chat program can run on a unix
server. I'll do all the design but I need the programming done.
Thanks alot. I hope you'll get in touch.
saturday@0171.com
http://www.0171.com
------------------------------
Date: Fri, 01 Aug 1997 20:27:56 GMT
From: pete@horus.cix.vapethis.co.uk (Pete Jordan)
Subject: Re: comments in regular expressions (wish list)
Message-Id: <memo.19970801212756.11525A@horus.cix.co.uk>
Chris Schleicher <chrissch@cs.uoregon.edu> wrote:
> Are you proposing
>
> >$x =~ /(?>$var:some_pattern)(?>$var2:some_pattern_2)/;
>
> is preferable syntax to
>
> ($var, $var2) = $x =~ /(some_pattern)(some_pattern_2)/;
>
> ?
Yah. With a complex RE (particularly if it's riddled with "(?: )"), the
former is much clearer. It would be particularly good with extended REs
(not that I ever use them :)
Pete Jordan
= = = = = = = = = = = = = = = = = = = = = = =
Horus Communications
http://www.horus.cix.co.uk/
= = = = = = = = = = = = = = = = = = = = = = =
"Is a polar bear a rectangular bear after
a coordinate transform?"
------------------------------
Date: Fri, 1 Aug 1997 22:01:36 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: comments in regular expressions (wish list)
Message-Id: <ebohlmanEE996p.KB5@netcom.com>
Pete Jordan (pete@horus.cix.vapethis.co.uk) wrote:
: Chris Schleicher <chrissch@cs.uoregon.edu> wrote:
: > Are you proposing
: >
: > >$x =~ /(?>$var:some_pattern)(?>$var2:some_pattern_2)/;
: >
: > is preferable syntax to
: >
: > ($var, $var2) = $x =~ /(some_pattern)(some_pattern_2)/;
: >
: > ?
: Yah. With a complex RE (particularly if it's riddled with "(?: )"), the
: former is much clearer. It would be particularly good with extended REs
: (not that I ever use them :)
It's also clearer when
A) You need to use some parentheses for simple grouping, and others for
matching.
B) When a pattern includes alternatives, each of which includes a match.
C) When you have nested parentheses (usually as a result of A)).
This reminds me of the old debate over keyword vs. positional parameters
as command-line (or job-control card!) arguments. IMHO, the ideal
solution is to allow both.
------------------------------
Date: Fri, 1 Aug 1997 16:29:31 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Pete Jordan <pete@horus.cix.vapethis.co.uk>, Chris Schleicher <chrissch@cs.uoregon.edu>
Subject: Re: comments in regular expressions (wish list)
Message-Id: <Pine.GSO.3.96.970801162401.12810F-100000@kelly.teleport.com>
On Fri, 1 Aug 1997, Pete Jordan wrote:
> Chris Schleicher <chrissch@cs.uoregon.edu> wrote:
>
> > Are you proposing
> >
> > >$x =~ /(?>$var:some_pattern)(?>$var2:some_pattern_2)/;
> >
> > is preferable syntax to
> >
> > ($var, $var2) = $x =~ /(some_pattern)(some_pattern_2)/;
> >
> > ?
>
> Yah. With a complex RE (particularly if it's riddled with "(?: )"), the
> former is much clearer.
This sort of thing has been talked about on the Perl development mailing
list. I don't think there are any plans to implement it right away, but
maybe someday. (There are still some issues of implementation to decide, I
believe, and there are more important features higher up on the
developers' wish list.)
It certainly can be difficult to track where $5 comes from in a big
expression, but that can be helped somewhat with the extensions added to
regexps available since 5.000 came out.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 01 Aug 1997 13:47:18 -0400
From: kb@u2.cs.umb.edu
Subject: Compiler-a3 & dbm
Message-Id: <axbu3hbxsp.fsf@u2.cs.umb.edu>
I've been unable to get the Malcolm Beattie's Compiler-a3 package to
work at all with dbmopen, and wonder what I'm missing. The thing
translates ok both with the C and CC backends, and compiles ok, but the
resulting binary merely says:
``No dbm on this machine.''
The same Perl programs work fine when interpreted natively (I do have
dbm on the machine, which is sparc-sunos4.1.4). Perl version is 5.004.
I'll append some more details.
Anyway, my real goal was to make my medium-small program (about 600
lines) start up more quickly. Right now it can easily take 15-20
seconds on a Sparc 5. Most of that is interpreter overhead, not runtime
-- when I put exit 0; as the first line of the program, it takes almost
as long to run.
So I thought I'd try to translate it to C. But Compiler-a3 takes about
many minutes (maybe 15) to run, and produces a 500K file that naturally
takes a lot longer (30 minutes or so) to compile with -O2. OK, so I
could do this only when the program is stable, but changes are going to
be frequent. I was hoping for something fast enough to be part of the
development cycle. I'll look into dump/undump, but are there any other
alternatives?
Any suggestions gratefully received. Please reply by email (as well as
posting if you like). Thanks.
kb@cs.umb.edu
More details on the dbm problem. Here's the source:
#!/usr/local/bin/perl -w
use SDBM_File;
# use NDBM_File;
$data = "/home3/xiangqi/data";
dbmopen (%dbfile, "$data/members", 0666))
|| die "dbmopen($data/members) failed: $!";)
undef %dbfile; clear the whole thing
dbmclose (%dbfile);)
I get the same results with ndbm as sdbm.
I compile and compile like this:
perl -Iblib/arch -MO=C,-omindbmc.c ../mindbm
perl -Iblib/arch cc_harness -O2 -o mindbm mindbmc.c
And then running the program just gets:
prompt$ mindbm
No dbm on this machine.
I did look at the doc files and in dejanews, etc., but couldn't find
anything helpful ...
------------------------------
Date: Tue, 29 Jul 1997 18:37:49 -0400
From: miles <alex.t.silverstein@bender.com>
Subject: die(ing) on seek(FH,0,0)
Message-Id: <33DE70BD.47F5@bender.com>
--anyone see why this textbook usage of seek is failing??
(note: debugger, texts, faq, man, -w don't explain--I wouldn't waste
your time)
$/= undef; #get the whole file (for small files only)
$input= $ARGV[0];
open (IFILE, "<$input") || die;
$out = $input; #get the filename
$html = <IFILE>; #get the data
$out =~ s/\.html?/\.kdk/i; #rename destination
open (OFILE, "+>$out") || die; #open destination for reading and writing
print OFILE $html || die; #print data to destination
#to process data; go to first position of file
seek(OFILE,0,0) || die; <-----die(s) here
$all = <OFILE>;
--Alex
------------------------------
Date: 1 Aug 1997 17:20:10 GMT
From: stampes@xilinx.com (Jeff Stampes)
Subject: Re: file extensions
Message-Id: <5rt5sa$rn2$1@neocad.com>
Shaun O'Shea (lmisosa@eei.ericsson.se) wrote:
: I have an array whose elements are all file paths E.G.
: address/of/the/file/in/question/file1.Uen.A.fmk
: address/of/the/file/in/question/file1.Uen.B.fmk
: address/of/the/file/in/question/file2.Uen.A.fmk
: address/of/the/file/in/question/file3.Uen.A.fmk
: I would like to use this array to create another array which just
: contains the file extensions i.e.
: .Uen.A.fmk
: .Uen.B.fmk
: .Uen.A.fmk
: .Uen.A.fmk
#!/usr/local/bin/perl -w
use File::Basename;
@full_names = qw(address/of/the/file/in/question/file1.Uen.A.fmk
address/of/the/file/in/question/file1.Uen.B.fmk
address/of/the/file/in/question/file2.Uen.A.fmk
address/of/the/file/in/question/file3.Uen.A.fmk);
@new_names = map {s/^.+?\.(.+)$/$1/ ; basename($_) } @full_names;
See the camel or the man pages for details on File::Basename (part
of the standard distribution) and the map() function.
HTH, Jeff
--
Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
------------------------------
Date: Fri, 01 Aug 1997 16:47:57 -0700
From: filter <guitarweb@hotmail.com>
Subject: Filter javascript, etc...problem!! Quick question..
Message-Id: <33E275AD.2AE5@hotmail.com>
Hi all...
Just a real quick question. I need to filter out certian HTML and
javascript, etc..Yet at the same time, I still want to allow other HTML.
My filter works fine if someone types (for exmaple)
<A HREF="" onmouseover = "document.bgcolor=JaVa.ErRoR!'">
It will not allow it as a true HTML tags of course.
But the problem is, if someone hits the "return" key, it forces a
newline from the textarea input box..see, THIS will work-->
<A
HREF
=
""
onmouseover
=
"document.bgcolor=JaVa.ErRoR!'">
Then you'll get an error. I have it, do whenever the script sees ANY
"<" it automatically goes to the HTML filter and filters out what it
might need to like so:
$filter =~ s/<(^*.*onmouse\s*.*)>/<$1>/ig;
(I know all the wild card(s) are getting a bit carried away.. but it
helps, because it won't matter how many spaces someone puts in to make
an error..
It's pretty simple, but how the heck can I make it read all the spaces
and returns and still disable certian HTML/tags/scripts that I want? It
works great now, other then the fact that people are getting tricky!
People are also doing such commands, as <FONT SIZE="2"COLOR=""<FORM>--
code here, etc.."
People are also not putting the ">" closing tag..so I just have the
filter such as..
$filter =~ s/<(^*.*onmouse\s*.*)/<$1/ig;
I've also tried (if there's a "<" *beginning tag*) in the data, to THEN
search trhrough the filter,. and change (for example)
"javascript" to "j a v a s c r i p t" which works fine and is cool..
But if someone types:
<FONT SIZE="3"COLOR=<
javascript
>
(putting in return characters, or whatever), then the filter simply
doesn't read the "new" line, yet the HTML tag will go on untill it finds
an ending tag.
So, with that said (sorry for the rambling..longer then I thought)..
what are the controls/swtiches, etc to make it "disable" certian
filtered commands..even *if* someone does hit return or put a lot of
spaces.. (I also imagine that I could take out most of the extra\s*.*
wild cards atthat point, and not have any future problems with a tag I
DO want allowed.) I hope this made sense.. this is the best way to
explain it all.. I haven'tfound any info anywhere about this. Thanks
again..
------------------------------
Date: Sat, 02 Aug 1997 16:37:29 -0700
From: "Ekim E. YARDIMLI" <tetnys@ibm.net>
Subject: free perl interpreter
Message-Id: <33E3C4B9.7BFB@ibm.net>
hello all,
i've just started learning perl and currently i'm not being ablo to test
what i write, i plan to get a virtual web host that does support perl,
but until then i was wondering if there exists a free server where
people can run their scripts?
Thanks in advance
best wishes
--
____________________________________________________________________
Ekim E. YARDIMI - tetnys@ibm.net
------------------------------
Date: 31 Jul 1997 09:01:42 +0200
From: JVromans@Squirrel.NL (Johan Vromans)
Subject: Re: GetOpt::Long - Corequisite options?
Message-Id: <wl3hgdbr9gp.fsf@plume.nl.compuware.com>
millerb@PROBLEM_WITH_INEWS_GATEWAY_FILE (Bryan Miller) writes:
> What I'd like to do is require the user to use -blech if they
> have specified option -bar.
This sounds simple, but it is really a complex matter. Next thing you
will probably want is GetOptions to check filenames, verify that
they are existing (or not), readable, writable, and so on :-).
But seriously: how would you define this requirement?
Would you require a specific order of options?
Could you give a detailed example of what you think is useful?
> I can do this with a pile of "if" statements but I would prefer the
> tidiness and consistency of a package.
A "pile of if statements" is usualy required anyway for complex sets
of options. Often values of options are related.
> Another thought. Perhaps it would be simpler to use one option
> but to require two arguments. I don't see a method for doing
> this either.
I use an array-type option for this, plus some added flexibility:
@array_opt = split (/,/, join (',', @array_opt));
This will allow "-foo bar -foo blech" as well as "-foo bar,blech" (and
combinations).
Hmm. I could add support for this in Getopt::Long.
-- Johan
------------------------------
Date: Fri, 1 Aug 1997 22:01:18 -0400
From: jin lu <jlu01@emory.edu>
Subject: howto import other perl file into current one??
Message-Id: <Pine.GSO.3.95.970801213932.9227A-100000@curly.cc.emory.edu>
Hi, dear netter,
I like perl language but sometimes it is difficult to understand its
output.
I have a currnt file new.pl which contains lines as following:
#! /usr/local/bin/perl
require("test.pl");
$fun=1;
list($fun);
In my test.pl (in the same directory), it contains only:
sub list{
local $fun=@_;
print $fun;
}
It is a simple calling another perl script. Why is not working?
message is : "test.pl did not return a true value at new.pl line 2."
Do I miss something? What a true value it talks about?? Thank you so much
if someone can shed some lighs on it.
Jin
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Jin Lu
Biology Department Tel: 404-727-4202
Emory University Fax: 404-727-2880
1510 Clifton Road jlu01@emory.edu
Atlanta, GA 30322
http://calabreselx.biology.emory.edu/www/main.html
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
------------------------------
Date: Thu, 31 Jul 1997 15:44:47 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: keys/values 2 hashes
Message-Id: <vftqr5.i43.ln@localhost>
Greg Land (gland@ccs.neu.edu) wrote:
: I have a script with two hashes with one hash's keys to be guarenteed
: to be in the other hashes key list. I need to go through the smaller
: hash(%owned) and foreach key compare the value to that of the other
: hashes(%games) value. Do to the semi-randomness of the sorage of
^^
^^ due, I assume
: key/value pairs, how could you do this?
The storage makes no difference whatsoever. I don't think I follow
why you would think it does...
----------------------
#!/usr/bin/perl -w
%owned = qw(one 1 two 2 three 3);
%games = qw(zero 0 one 1 two TWO three 3 four 4);
foreach (keys %owned) {
print "$_ matched\n" if $owned{$_} eq $games{$_};
}
----------------------
--
Tad McClellan SGML Consulting
Tag And Document Consulting Perl programming
tadmc@flash.net
------------------------------
Date: Fri, 01 Aug 1997 17:20:43 -0700
From: filter <guitarweb@hotmail.com>
Subject: Re: look at this
Message-Id: <33E27D5B.1FAC@hotmail.com>
oooh neat!.. a pyramid scam!..That's new..
I get enough of this crap in emails... I get enough spam in my diet
already...
You've offered so much to the perl community..I'm..just..
so..impressed... Get real..
Try spamming the "newusers" NG.. they might fall for it..
Chris Ebert wrote:
>
> Some might call me skeptical but I will try this.
>
> I was browsing through a newsgroup just like your are now and found a
> post similar to this one. I thought "This has to be a scam" but I was
> curious no the less. As I read on I began to get more interested. I
> didnt know if this was legal so I checked with the US postal service
> and they said it was fully legal! So now Im trying this. And I know
> some people who have done this and made over $5,000.
>
> THIS IS HOW YOU DO THIS
> 1. you get five envelopes, five stamps, five $1 bills, and five blank
> pieces of paper.
> 2. You write "Please put me on your mailing list" on each of the five
> pieces of paper. Then you fold the paper and put one dollar bill inside
> of it so it cant be seen, to prevent thievery,. then you put the paper,
> with the dollar bill inside of it, in the envelope and seal it.
> 3. Next address the five envelopes to the five address below and put a
> stamps on each of the envelopes. Now send them away.
> 4. Then copy this message and change it by taking #1 off the list and
> moving the other four up {4 becomes 5, 3 becomes 4 and so forth} then
> put your address as #5
> 5. Now post the new message {with your address as #5} on at least 2
> newsgroups, but remember the more newsgroups you post on the more money
> youll get.
>
> HERE ARE THE ADDRESSESS
>
> #1 M. Mafucci, 3 Hilltop Rd, Bronxville, NY 10708
> #2 Joyal Holder, 1980 N Snyder Dr., Richland Center, Wisconsin 53581
> #3 Evan Christensen 2746 Ome Ave, Dayton, OH 45414
> #4 Grahame Elton, 31A Hong Kong Street, Singapore 059 670
> #5 Chris Ebert, 6621 Imperial Ridge, El Paso, TX 79912
>
> Now the why part:
> Out of 2 postings, say I receive only 5 replies (a very low example).
> So then I made $5.00 with my name at #5 on the letter. Now, each of the
>
> 5 persons who just sent me $1.00 make the minimum 2 postings, each
> with my name at #4, and only 5 persons respond to each of the original
> 5. Thats another $25.00 for me. Now those 25 each make 2 minimum
> postings with my name at #3 and only 5 reply to each. I will bring in
> an additional $125.00! Now, those 125 persons turn around and post the
> minimum 2 with my name at #2 and only receive 5 replies each, I will
> make an additional $626.00! Okay, now here is the fun part. Each of
> those 625 persons post a minimum 2 letters with my name at #1 and they
> each only receive 5 replies. That just made me $3,125.00 with an
> original investment of only $5.00! AMAZING! And as I said, 5 responses
>
> is actually very low!
> Average is probably 20 to 30! So lets put those figures at just 15
> responses per person. Here is what you will make:
> at #5 - $15.00
> at #4 - $225.00
> at #3 - $3,375.00
> at #2 - $50,625.00
> at #1 - $759,375.00
> When your name is no longer on the list, you just take the latest
> posting and start all over again. Be honest. If you dont come up with
> the measly $1.00 per person, people will know and you wont get much.
> One guy did that and made only $150 in eight weeks. Keep track of who
> sends you money and watch the newsgroups for those names. GOOD LUCK!
------------------------------
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 807
*************************************