[6941] in Perl-Users-Digest
Perl-Users Digest, Issue: 566 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 3 23:07:50 1997
Date: Tue, 3 Jun 97 20:00:25 -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 Tue, 3 Jun 1997 Volume: 8 Number: 566
Today's topics:
Re: 5.004 problem with Hashes <zenin@best.com>
Re: [Q] Passing Variable to an Interactive Program <rootbeer@teleport.com>
Re: Any plans for perl plug-ins? <zenin@best.com>
Array of hashes with use strict; (Joonas Timo Taavetti Kekoni)
AWK to perl translation problem <webmaster@deltastar.nb.ca>
Re: binary conversions ?? (Andrew M. Langmead)
CGI/WWW/Perl Tutorials (John Donnelly)
Re: Decoding of the 'Zafir' language :) <ajohnson@gpu.srv.ualberta.ca>
Re: Decoding of the 'Zafir' language :) (Abigail)
Re: Help for "date" <jbokma@caiw.nl>
Re: How can perl fetch a http:// page? (maybe like a 'b <rootbeer@teleport.com>
IPC question: Perl driver for interactive program? (Dave Steffen)
Re: LOG base 10 operator <rootbeer@teleport.com>
Re: moving form BSD to SunOS 5.5 (formmail.pl) (Abigail)
MS-DOS port of the Perl programming language Flkj@jumbo.com
Re: Newbie question (Chipmunk)
Re: Newbie question <rootbeer@teleport.com>
odd problem with readdir <cwg-spambegone@pobox.com>
Re: odd problem with readdir (Nathan V. Patwardhan)
Opening File Handle to a function. <shahjn@cig.mot.com>
Re: Opening File Handle to a function. (Nathan V. Patwardhan)
Re: pack template that packs like 'a' but unpacks like <rootbeer@teleport.com>
Perl -> C <can1jad@is.ups.com>
Re: Possible bug handling '--' switch in v5.001n ??? <rootbeer@teleport.com>
Question: Simple Giving and Getting info to WWW (Benjamin M. Hill)
Refs to globs <g-fast@ux8.cso.uiuc.edu>
Re: Searching a text file <rootbeer@teleport.com>
Re: Server side includes to run Perl scripts from web p (Ed Kear)
Talking to a modem <jbosch@tid.cdscc.nasa.gov>
Re: Where do I find Perl 5? <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Jun 1997 19:13:07 GMT
From: Zenin <zenin@best.com>
Subject: Re: 5.004 problem with Hashes
Message-Id: <5n1qc3$ba2$1@nntp2.ba.best.com>
Prince Mystery <mystery@itis.com> wrote:
> I'm getting an error that I didn't used to get when the system was on
> the previous version of perl (5.003):
> Odd number of elements in hash list at...
> Over the line:
> %final = {};
This is because 1 is an odd number, and you just assigned a single,
empty hash *reference* to a hash. Your hash now looks like:
%final = ({});
If you did a "foreach $key (keys %final)" you would go through the
loop once, with a hash ref in $key.
What you probably want is:
%final = ();
Note the parens, not curlys. This assigns an empty list to the
hash.
--
-Zenin
zenin@best.com
------------------------------
Date: Tue, 3 Jun 1997 14:22:23 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "William [Billy] Harrison" <harrison@ug.cs.dal.ca>
Subject: Re: [Q] Passing Variable to an Interactive Program
Message-Id: <Pine.GSO.3.96.970603141103.24048E-100000@kelly.teleport.com>
On 3 Jun 1997, William [Billy] Harrison wrote:
> open(PASS, "|passwd");
It sounds like you're trying to write to that program's input stream, but
it takes its input from the console (instead of from STDIN). You aren't
going to be able to get that to work without some moderately-advanced
wizardry, so far as I know.
I'd look to see whether there's another way to do what you want, perhaps
by emulating the program you're calling. In the case of passwd, a
(carefully-written) setuid script can update a password file without too
much trouble.
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 3 Jun 1997 19:19:38 GMT
From: Zenin <zenin@best.com>
Subject: Re: Any plans for perl plug-ins?
Message-Id: <5n1qoa$ba2$2@nntp2.ba.best.com>
Mark Nielsen <men2@auto.med.ohio-state.edu> wrote:
> However, I was wondering about something, although I love Linux, our
> public computers are NT 4.0 using Netscape communicator.
> Anyways, I don't see how to set it up so that I can get Netscape
> to execute penguin code. I thought I read all the documents that
> came with penguin, but I didn't see anything that explained how to do it.
> I did read that a plugin has not been developed yet, but since it hasn't
> how do I get Netscape to execute the code whether it is on Linux or NT?
> I have Perl 5 for NT.
I wonder how hard it would be to make a "plug-in" for Netscape that
simply runs any perl program it finds by calling
"perl -MPenguin code.pl". This would be assuming that if the
penquin program wanted to be graphical it would use Tk or similar
(Which I think is available for NT).
Of course, I'm speeking from the point of view that I know almost
nothing about Windows, plug-in, or C++ programming, but it still
doesn't sound *that* hard...
--
-Zenin
zenin@best.com
------------------------------
Date: 3 Jun 1997 21:03:57 GMT
From: jkekoni@cc.hut.fi (Joonas Timo Taavetti Kekoni)
Subject: Array of hashes with use strict;
Message-Id: <5n20rt$gj4$1@hiekkalaatikko.cs.hut.fi>
i have $code[}{} structure. How can i define it using my with
use strict; ?
I have tried almoust anything and adding a # before use strict was the only
working solution. I am not familiar with perl pointers.
With commonn sense my( %@code ); would sound logical, but wont work.
--
_- Joonas Kekoni OH2MTF I -_
_-internet: jkekoni@cc.hut.fi I DO NOT EAT. -_
_-slowmail: j{mer{ntaival 7a176 I -_
_- 02150Espoo I It is a monitor -_
_- Finland/Europe I -_
------------------------------
Date: Tue, 03 Jun 1997 11:41:59 -0300
From: Brian Freeze <webmaster@deltastar.nb.ca>
Subject: AWK to perl translation problem
Message-Id: <33942D37.3662@deltastar.nb.ca>
I have an AWK script built and functioning with the the nawk program
that I have been trying to convert to perl. I have run it through the
"a2p" program but have run into the following error message and was
wondering if someone would be so kind as to point out what is wrong with
the code that perl won't take it.
This is the Awk code:
substr($0, 216, length) > output_file2; # sent to o/p file
The error message that I get is there is syntax error.
Thanks
------------------------------
Date: Mon, 2 Jun 1997 13:11:36 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: binary conversions ??
Message-Id: <EB5GnC.Hsx@world.std.com>
kschwab@nyx10.cs.du.edu (Kerry Schwab) writes:
>Since most folks are looking for MSB when doing this, and don't care
>for the leading zeros, I'd suggest the following variation..
>( $bits=unpack 'B*', pack 'N', hex($number) ) =~ s/^0+//g;
I can understand wanting 'N' instead of 'I', but usually, I want
binary data to be whole bytes or at least nybbles. So maybe
($bits = unpack 'B*', pack 'N', hex $number) =~ s/^0*((?:[10]{4})+)$/$1/;
--
Andrew Langmead
------------------------------
Date: 3 Jun 1997 11:31:17 -0600
From: johnd@xor.com (John Donnelly)
Subject: CGI/WWW/Perl Tutorials
Message-Id: <5n1kd5$dqs@xor.com>
**Upcoming CGI/WWW/Perl (June '97) Tutorials**
All sessions are held at our training facility in Boulder, CO.
Contact me for further information, registration forms.
--John Donnelly, Training Coordinator
XOR Network Engineering, Inc.
http://www.xor.com/ johnd@xor.com 303-448-4816
*****
CGI and WWW Programming in Perl
(Two Day Hands-on Lecture/Lab)
Tom Christiansen, Consultant
June 17-18, 1997
*****
Advanced Perl Programming
(Three Day Hands-on Lecture/Lab)
Tom Christiansen, Consultant
Monday - Wednesday, June 23-25, 1997
*****
------------------------------
Date: Tue, 03 Jun 1997 12:03:48 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Decoding of the 'Zafir' language :)
Message-Id: <33944E74.7F90A9E2@gpu.srv.ualberta.ca>
[snip]
! As you can see, the language is a very simple one. This is
! his suggestion for an algorithm, using the test-string
!
! "Rolling On the Floor Laughing And Scaring The Cat"
!
!
! $s="Gnillor No eht Roolf Gnihgual Dna Gniracs Eht Tac";
! foreach ( split(/ /, $s)) {
! $c = lcfirst($_);
! substr($c, length()-1, 1) = uc(substr($c, length()-1, 1))
! if $_ ne $c;
! $c = reverse($c);
! print "$c ";
! }
! print $/;'
!
!
! here, for comparison, is mine:
!
! $s = "Gnillor No eht Roolf Gnihgual Dna Gniracs Eht Tac" ;
! $s =~ y/A-Z/a-z/ ; $s = ~s/(\S)(\s|$)/\u$1$2/ig ;
! foreach $w (split(/ /,$s) ) {
! foreach $c( reverse( split(//,$w) ) ) {
! print $c ;
! }
! print" " ;
! }
! print "\n" ;
!
!
! Comments ? As there is More Than One Way, I'd love to see
! some suggestions for other implementations... >:) Any
! RegExperts willing to attempt a oneliner ?
$_ = "Gnillor No eht Roolf Gnihgual Dna Gniracs Eht Tac" ;
s#(\w+)#print ucfirst(join "",reverse split //,lc $1)." "#eg;
dealing with punctuation within a sentence is left as
an excersise for the reader :-)
regards
andrew
------------------------------
Date: Wed, 4 Jun 1997 01:15:25 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Decoding of the 'Zafir' language :)
Message-Id: <EB88tp.M1r@nonexistent.com>
On 3 Jun 1997 17:01:48 +0200, Tina Marie Holmboe (tina@htmlhelp.com) wrote
in comp.lang.perl.misc
<URL: news:5n1bks$p1j@hrotti.ifi.uio.no>:
++
++ Said person was a genius, but also quite mad at times. He developed
++ his own language, used by all his troops. The correct phrase to greet him
++ would be:
++
++ "Rifaz Evil Gnol!" = "Long Live Zafir!"
++
++ As you can see, the language is a very simple one. This is his suggestion
++ for an algorithm, using the test-string
++
++ "Rolling On the Floor Laughing And Scaring The Cat"
++
++ $s="Gnillor No eht Roolf Gnihgual Dna Gniracs Eht Tac";
Ah, but it turns out the language isn't simple! While the first
sentence is just the reversal (modulo case), the second one
is reversal of the words.
Let's asume that's the correct one.
My solution would be:
#!/usr/local/bin/perl -wl
use strict;
$_ = "Gnillor No eht Roolf Gnihgual Dna Gniracs Eht Tac"; $, = " ";
print map {ucfirst lc reverse;} split;
__END__
Explaination:
Read the last line from right to left. First we split; split doesn't
have arguments so we split $_ on whitespace. The words are feeded into
a map, $_ is locally set to each word. Each word is reversed, then
lowercased, then gets its first letter uppercased. Finally, the words
are printed. They are space separated due to the setting of $,, the
trailing newline comes from the -l switch.
++ Comments ? As there is More Than One Way, I'd love to see some suggestions
++ for other implementations... >:) Any RegExperts willing to attempt a
++ oneliner ?
And as a oneliner:
$ perl -wle 'print join " ", map {ucfirst lc reverse;} split / /, "Gnillor No eht Roolf Gnihgual Dna Gniracs Eht Tac";'
Abigail
--
I love map.
------------------------------
Date: 3 Jun 1997 23:05:00 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: Help for "date"
Message-Id: <01bc7072$c5bb4b60$d00ab2c2@tschai>
Jun Zhuang <jzhuang@ringer.cs.utsa.edu> wrote in article
<5mv3jb$fd@ringer.cs.utsa.edu>...
> Under UNIX prompt, enter "date" will get : Mon Jun 2 13:45:34 CDT
1997
> Is there a similar function in PERL? What if I only want digits of
the
> date? i.e. I want 970602 instead of Jun 2 1997?
> Any help will be appreciated.
use localtime;
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime(time);
and combine whatever you need into one string...
Regards,
John
--
----------------------------------------------------------------------
Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)
http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]
email: jbokma@caiw.nl phone: +31 10 4291827
------------------------------
Date: Tue, 3 Jun 1997 14:48:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "J. Linder" <jann@internetMCI.com>
Subject: Re: How can perl fetch a http:// page? (maybe like a 'bot'?)
Message-Id: <Pine.GSO.3.96.970603144746.24048J-100000@kelly.teleport.com>
On 3 Jun 1997, J. Linder wrote:
> I need to know how I go about taking a http:// address & fetching it
> from a web server.
Did you check the FAQ? :-)
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq9/
How_do_I_fetch_an_HTML_file_.html
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 3 Jun 1997 22:13:03 GMT
From: steffend@lamar.colostate.edu (Dave Steffen)
Subject: IPC question: Perl driver for interactive program?
Message-Id: <5n24tf$3hau@yuma.ACNS.ColoState.EDU>
Keywords: IPC pipe FIFO gnuplot
Howdy Folks!
I'm trying to write a simple Perl script to run gnuplot for
me; in this case, I'd like it to step through a bunch of files and
show them to me one at a time.
My first attempt was to write gnuplot commands to a file, then
execute gnuplot using backtics:
files = <ep_*>;
foreach (@files) {
open OUT, ">showtemp" or die;
print OUT "plot \'$_\' with lines\n";
close OUT;
print `gnuplot showtemp`;
The problem with this method (well, one of many ;-) is that
each time through the loop a new gnuplot process is run; this is
annoying for many reasons. What I'd really like is to have _one_
gnuplot process running, and then have my Perl script send commands to
it. I tried this:
open G, "|gnuplot";
@files = <ep_*>;
foreach (@files) {
print G "plot \'$_\' with lines\n";
print G "pause -1 \"Hit any key\"\n";
}
However, nothing actually gets plotted and the "pause"
statements don't work. Clearly the output is going to gnuplot (if I
send something that isn't a valid gnuplot command, I get gnuplot
errors) but somehow the actual gnuplot process is happening "somewhere
else" and not on my screen.
Is there something wrong with my approach here?
From the docs and the Camel book, perhaps a named pipe is the
way to go. Unfortunately I don't know squat about named pipes, and the
only example (having the .signature file run a Perl script) "goes the
wrong way", in that (I think) what I need is a named pipe that's
attached to gnuplot, and then my Perl script writes to that.
Does anybody have any suggestions?
THANKS!!!
--------------------------------------------------------------------------
Dave Steffen Wave after wave will flow with the tide
Dept. of Physics And bury the world as it does
Colorado State University Tide after tide will flow and recede
steffend@lamar.colostate.edu Leaving life to go on as it was...
- Peart / RUSH
"The reason that our people suffer in this way....
is that our ancestors failed to rule wisely". -General Choi, Hong Hi
------------------------------
Date: Tue, 3 Jun 1997 14:30:47 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Tung-chiang Yang <tcyang@netcom.com>
Subject: Re: LOG base 10 operator
Message-Id: <Pine.GSO.3.96.970603142512.24048G-100000@kelly.teleport.com>
On Tue, 3 Jun 1997, Tung-chiang Yang wrote:
> Oh, I understand the meaning of "$_[0]" (the first argument of the argument
> list of the current subroutine's, from @_) However, is it necessary to
> restrict the operation of 'log10' to one entry only?
No, it's not necessary. It merely parallels the existing log() function.
(And every other Perl mathematical operator, since operations like
addition, bitwise-not, and modulus operate upon single scalars instead of
lists.)
> I wonder if the Perl Log10 routine should also work on all the given
> input arguments, instead of evaluating on the first entry and ignore
> all the rest.
sub log10 (@) { map { $_/log(10) } @_ }
Like that? :-)
You can do that in your own scripts if you want, but you should be aware
that some people will expect to be taking the log of a single scalar, so
the context may bite them.
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Wed, 4 Jun 1997 01:23:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: moving form BSD to SunOS 5.5 (formmail.pl)
Message-Id: <EB897F.MHs@nonexistent.com>
On 3 Jun 1997 17:01:33 +0200, Tina Marie Holmboe (tina@htmlhelp.com) wrote
in comp.lang.perl.misc
<URL: news:5n1bkd$p14@hrotti.ifi.uio.no>:
++
++ b) The script has either compile-time or run-time errors, which means it
++ will output something on STDERR - which the webserver will see as a
++ 'malformed header'. That may make it a Perl-question...
No, it makes it a reading exercise. Any decent webserver will log
the error in the error_log. Go read that. 99% of the time it will
be a file permission problem. Which is mentioned in the FAQ.
(And no, I don't think you should be creating CGI programs on a
server where you don't have read permission of the errorlog.)
Abigail
--
perl5.004 -wMMath::BigInt -e'$=new Math::BigInt+qq;$$783$[$%9889$47$|88768$596577669$%$5$3364$[$$$|838747$[8889739$%$|$673$%$98$76777$=56;;$=$]*(q.25..($=@))=>do{print+chr$%$;$/=$}while$!=$'
------------------------------
Date: 3 Jun 1997 21:55:42 -0400
From: Flkj@jumbo.com
Subject: MS-DOS port of the Perl programming language
Message-Id: <5n2huu$mgf@orion.jumbo.com>
Get NEW MS-DOS port of the Perl programming language Shareware As It's Written!
The latest and greatest MS-DOS port of the Perl programming language shareware and
freeware as soon as it's created! We download new programs DAILY
(10 a.m. EST) from more than 300 sites all over the world.
Check out the new programs everyday in the "TODAY'S FREE COMPUTER
PROGRAMS" section on the all new JUMBO! --- bigger and faster
than ever with over 200,000 files and programs --- more than 1.8 million
links --- including a HUGE multimedia section with sounds, graphics, videos,
streaming music, VRML, animations, clip art, icons,
schockwave, screen savers --everything! --- http://www.jumbo.com.
Get the latest at:
http://www.jumbo.com/pages/programming/dos/perl/
http://www.jumbo.com/pages/programming/mac/languages/
------------------------------
Date: 3 Jun 1997 20:31:34 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Newbie question
Message-Id: <5n1uv6$2bd$1@dartvax.dartmouth.edu>
Bill Thompson wrote:
>
> To get the number of characters in a string, I'm using the following:
>
> sub ChkQID {
> my ($QID) = @_;
> my ($nchars, $i);
>
> $_ = $QID;
> $nchars = tr/\000-~//; # get the number of characters
>
> Is there a better way?
How about:
$nchars = scalar(split(//, $_));
;-)
Chipmunk
------------------------------
Date: Tue, 3 Jun 1997 16:29:49 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Chipmunk <Ronald.J.Kimball@dartmouth.edu>
Subject: Re: Newbie question
Message-Id: <Pine.GSO.3.96.970603162517.28549O-100000@kelly.teleport.com>
On 3 Jun 1997, Chipmunk wrote:
> $nchars = scalar(split(//, $_));
I know you were joking, but that won't do what you (probably) think it
will. It's deprecated, and for good reason.
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Tue, 03 Jun 1997 18:09:44 -0400
From: chris <cwg-spambegone@pobox.com>
Subject: odd problem with readdir
Message-Id: <33949628.7CEF@pobox.com>
Hey..
I am having the strangest problems with readdir.
I have a fragment of code that looks like this:
opendir(TARGET, $incoming) || die "couldn't open $incoming: $!";
@target_contents = readdir(TARGET) || die "couldn't read directory: $!";
print join ("\n", @target_contents), "\n";
All this prints out is '.'
When I do it like this:
opendir(TARGET, $incoming) || die "couldn't open $incoming: $!";
while ($foo = readdir(TARGET)
{
print "$foo\n";
}
it prints out the entire list of files.
Quoting the camel book:
"In list context, it [readdir] returns all the rest of the entries in
the directory..."
I even tried inserting a 'rewinddir TARGET' before the readdir--still no
luck.
In any case, I appreciate any help anyone could give.
DETAILS: running perl 5.002 on a Red Hat 3.0.3 installation.
If you want to send me email, remove the spam fileter...
chris
------------------------------
Date: 3 Jun 1997 23:15:36 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: odd problem with readdir
Message-Id: <5n28io$pkj@fridge-nf0.shore.net>
chris (cwg-spambegone@pobox.com) wrote:
: opendir(TARGET, $incoming) || die "couldn't open $incoming: $!";
: @target_contents = readdir(TARGET) || die "couldn't read directory: $!";
: print join ("\n", @target_contents), "\n";
$d = "/home1/n/nvp";
opendir(T, $d) || die("opendir said: $!");
@files = readdir(T);
closedir(T);
print join("\n", @files),"\n";'
Works for me.
: opendir(TARGET, $incoming) || die "couldn't open $incoming: $!";
: while ($foo = readdir(TARGET)
: {
: print "$foo\n";
: }
Can't work because you have an error.
# watch those parens
while($foo = readdir(TARGET)) { print $foo,"\n"; }
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Tue, 03 Jun 1997 17:49:37 -0500
From: "Junaid Shah [C]" <shahjn@cig.mot.com>
Subject: Opening File Handle to a function.
Message-Id: <33949F81.41C67EA6@cig.mot.com>
Hi,
What I want to do is process the output from a function call. I want to
do the following but I guess I can't, any ideas.
package Test;
sub func {
%args = @_;
---
---
system("$cmd");
}
----
----
open(FILE,"Test->func("filename => "$value") |")
while(<FILE>) {
print $_;
}
close(FILE);
Thanks,
--
----------------------------------------------------------
Junaid Shah Ph:(847)632-7040 Fax:(847)632-6733
Enabling Technologies, Motorola Inc.
----------------------------------------------------------
------------------------------
Date: 3 Jun 1997 23:33:39 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Opening File Handle to a function.
Message-Id: <5n29kj$qjc@fridge-nf0.shore.net>
Junaid Shah [C] (shahjn@cig.mot.com) wrote:
: What I want to do is process the output from a function call. I want to
: do the following but I guess I can't, any ideas.
Ahh, but there must be a way! :-) What's wrong with return?
Perhaps I've misunderstood your question / problem, but here's what I
have:
package Test;
sub new {
my $self = shift;
bless {}, $self;
}
sub funcQ {
my $self = shift;
%args = @_;
foreach (keys %args) { print $_." -> ".$args{$_}."\n"; }
$cmd = '/bin/cat /home1/n/nvp/.login';
open(CMD, $cmd." |") || die("ext prog error: $!");
@response = <CMD>;
close(CMD);
return(@response);
}
# Return true
1;
# And the test program
#!/usr/local/bin/perl5 -w
use lib '.';
use Test;
$foo = new Test;
(@give_it) = $foo->funcQ(foo => 'bar', baz => 'bob');
for(@give_it) { print $_,"\n"; }
--
Nathan V. Patwardhan
nvp@shore.net
------------------------------
Date: Tue, 3 Jun 1997 14:09:09 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Valeriy E. Ushakov" <uwe@ptc.spbu.ru>
Subject: Re: pack template that packs like 'a' but unpacks like 'A'
Message-Id: <Pine.GSO.3.96.970603140056.24048C-100000@kelly.teleport.com>
On Tue, 3 Jun 1997, Valeriy E. Ushakov wrote:
> If the very idea of this new format letter is deemed inapropriate and
> in contradiction with perl spirit, I'd like to be enlightened why.
I'd hesitate to go that far, but I would be reluctant to add letters to
the options for pack/unpack. It's got a lot of options; some would say too
many already!
> At first glance, implementing it requires 3 (!) lines of C code in
> pp.c: two case labels for this new letter in pp_pack and pp_unpack and
> modifying one condition in pp_unpack to handle this new letter the way
> 'A' is.
Well, that sounds painless. But can you explain again why you can't just
pack and unpack with 'a'? That seems to be correct, to my way of thinking,
so I know that something must be wrong with it. :-)
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Tue, 03 Jun 1997 16:54:44 -0400
From: "J.Dawson" <can1jad@is.ups.com>
Subject: Perl -> C
Message-Id: <33948494.5C62@is.ups.com>
Hello,
I am an intranet developer looking to get away from C++ and try to
explore the possiblities of perl. I recently purchased a book for the
developement of the program and found PERL to be extremely useful. In
fact I luv it. However, there is just one problem. I cannot seem to
compile the written perl program. I downloaded a copy of the Perl
Compiler kit and still, it does not work. I have a copy of ActiveWare's
PERL for win32, as I am using Win NT, and when I type in Perl -MO=C,
filename > filename.c, it gives me a cannot find o.pm file error. I am
pretty confused. Is there a perl compiler kit for MS-Dos or is there a
complete version of PERL5.003 for win nt that does this for me? Thank
you...
Email me back at can4axk@is.ups.com or hkng@novice.uwaterloo.ca
------------------------------
Date: Tue, 3 Jun 1997 14:24:03 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Gordon D. Pusch" <pusch@mcs.anl.gov>
Subject: Re: Possible bug handling '--' switch in v5.001n ???
Message-Id: <Pine.GSO.3.96.970603142253.24048F-100000@kelly.teleport.com>
On 3 Jun 1997, Gordon D. Pusch wrote:
> Subject: Possible bug handling '--' switch in v5.001n ???
If you've found a bug in that ancient version of Perl, chances are awfully
good that somebody has fixed it long, long ago. Get and install 5.004 and
you can start finding all new bugs. :-)
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: 3 Jun 1997 21:36:39 GMT
From: Benjamin.M.Hill@claus.dartmouth.edu (Benjamin M. Hill)
Subject: Question: Simple Giving and Getting info to WWW
Message-Id: <5n22p7$3qt$1@dartvax.dartmouth.edu>
I've been working on some simple simulated AI (Just a series of logic
gates that parse a sentence and try to reply coherently, nothign quite
that could beat a turning test yet. :) )
I've got some good rules put down for a "bartender" bot. Now, I want
to try it out online.
There are many chat rooms on the WWW, all of which use form submission
to converse. What I need to find is a perl scrip that can post a
generated form responce to a web page, and another script that can
retrieve a web page.
That's the question. Seems pretty basic, right? Is there a simple way
do do this?
Can someone point me in the right direction?
Please, mail a copy of any responce to "benjamin.m.hill@dartmouth.edu"
Thanks!
------------------------------
Date: 03 Jun 1997 20:28:15 -0500
From: gregory douglas fast <g-fast@ux8.cso.uiuc.edu>
Subject: Refs to globs
Message-Id: <m7g3eqzyx5c.fsf@ux8.cso.uiuc.edu>
In an attempt to create an object-thingie that acted simultaniously
like a class and a filehandle, I saw a suggestion that one use a glob
reference to store both the filehandle and the hash containing the
class's info in the same blessed reference. So I did this:
package Poo:
...
sub new {
my $type = shift;
my $class = ref($type) || $type;
open(GLOB, "stupidfile") || die "can't open $filename";
$GLOB{FILE} = "stupidfile";
bless \*GLOB,$class;
}
which works in a filehandle-y sense:
$a = new Poo;
while(<$a>) { ... # works a-ok
...but which breaks the hashy part: '$a->{FILE}' gives me a
"Not a HASH reference" error.
while I can do a '*blah = $a; print $blah{FILE};', that's kinda
clunky, it can't be my-ed, etc. Is there a better way to do this? Or
would I be better off trying to find a way to bend <> to my will
(whoopee)?
--
-- Greg Fast --- g-fast@uiuc.edu -------------------------------------------
Cooper: "Who's the lady with the log?"
Truman: "Oh, we call her the log lady."
------------------------------------------------------------------------------
------------------------------
Date: Tue, 3 Jun 1997 14:56:50 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: chrisva@tiac.net
Subject: Re: Searching a text file
Message-Id: <Pine.GSO.3.96.970603145245.28549A-100000@kelly.teleport.com>
On Mon, 2 Jun 1997 chrisva@tiac.net wrote:
Newsgroups: comp.lang.perl
If your news administrator still carries comp.lang.perl, please encourage
him or her to check out the frequent posting about bogus newsgroup names
in news.announce.newgroups. You'll be doing yourself and many others a
favor to use comp.lang.perl.misc (and other valid Perl newsgroups)
instead.
news:news.announce.newgroups
> I am just starting out with CGI and trying to create a searchable
> ASCII file. Any suggestions would be greatly appreciated.
Any ASCII file can be searched, normally. :-)
> I pasted the cgi-lib.pl file (earlier
> version) after the script below
You should really be using CGI.pm instead.
If your data file changes relatively infrequently, you might consider
making a way to index it. Then, when (for example) the form indicates that
you're only interested in records containing "AK", you could easily use
seek() to read only those parts of the file that include that datum.
Hope this helps!
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
Date: Wed, 04 Jun 97 02:16:09 GMT
From: skear@albany.net (Ed Kear)
Subject: Re: Server side includes to run Perl scripts from web pages
Message-Id: <5n2j4r$2e6$1@lori.albany.net>
In article <339333D7.2966@babylon5fan.com>, keys@zahadum.com wrote:
>> : I am trying to execute a Perl script to generate a counter on my web page
>> : using the following comment tag in the webpage itself.
>>
>> : <!--#exec cgi="http://cep.lse.ac.uk/fm-cgi-bin/counter.pl"-->
>
>SSI won't take a complete URL, only a virtual path, e.g.
> <!--#exec cgi="/fm-cgi-bin/counter.pl"-->
>and so it only works for scripts on the same server as the page...
>Also, if you continue to get the [an error occured while processing this
>directive] then your server doesn't support the exec cgi command in SSI
>and the only other way you could run that script to my knowledge is from
>an IMG tag, in which case you can only have graphical output...
>
This also works with apache httpd:
<!--#include virtual="/cgi-bin/counter.cgi"-->
Ed Kear | *Round the Bend Productions*
ed@roundthebend.com | Online Travel Guide for Upstate New York
| http://www.roundthebend.com/
------------------------------
Date: Wed, 4 Jun 1997 01:07:44 GMT
From: "John Bosch" <jbosch@tid.cdscc.nasa.gov>
Subject: Talking to a modem
Message-Id: <01bc7083$f4031280$7ec5c3c0@syseng-212.cdscc.nasa.gov>
Hi,
I need to talk to a modem (well it acts like one) on a LINUX based system
with a perl script. I basically need to be able to connect to the modem,
wait for it to say something, send a command then read all the stuff it
sends back waiting for a particaular line before terminating the
connection.
What is the best way to set up this two way conversation with the modem.
open( MODEM, "+</dev/modem" )
won't work.
Also, am I correct in thinking that I would have to append to /dev/modem
not write to it?
--
regards,
John Bosch
Electrical Engineer
Canberra Deep Space Communications Complex
email : jbosch@tid.cdscc.nasa.gov
John.R.Bosch@jpl.nasa.gov
www : http://tid.cdscc.nasa.gov/~jbosch
=====================================================
~!
------------------------------
Date: Tue, 3 Jun 1997 14:10:24 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Claus H. Rasmussen" <webmaster@danlogic.dk>
Subject: Re: Where do I find Perl 5?
Message-Id: <Pine.GSO.3.96.970603140948.24048D-100000@kelly.teleport.com>
On 3 Jun 1997, Claus H. Rasmussen wrote:
> I need to get the Perl 5. Where do I get it?
Your source for All Things Perl is CPAN. Enjoy!
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
-- Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.lightlink.com/fors/
------------------------------
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 566
*************************************