[12790] in Perl-Users-Digest
Perl-Users Digest, Issue: 200 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 20 12:07:21 1999
Date: Tue, 20 Jul 1999 09:05:08 -0700 (PDT)
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, 20 Jul 1999 Volume: 9 Number: 200
Today's topics:
Re: 3D modeling with Perl? (Kevin Reid)
ANN: perl5 winhelp docs (hlp+chm) (Reini Urban)
Re: basename regexp? <marshalc@americasm01.nt.com>
Re: basename regexp? <xxx@yyy.com>
Re: basename regexp? (elephant)
Re: basename regexp? <gellyfish@gellyfish.com>
fetch url with standard modules? <qwerty@post.utfors.se>
Re: fetch url with standard modules? <gellyfish@gellyfish.com>
Re: fetch url with standard modules? (Benjamin Franz)
Re: fetch url with standard modules? (David Cantrell)
Re: How should I sort by different fields? <gellyfish@gellyfish.com>
How to open database just once? yangsu@ustc.edu
Re: How to open database just once? <tchrist@mox.perl.com>
Re: lexical $_ with threads question? <derek_sherlock@hp.com>
Re: lexical $_ with threads question? <tchrist@mox.perl.com>
multi-cast <dkr@freerealtime.com>
Re: problem with searching database (Larry Rosler)
question about ppm.pl brz@hotmail.com
Re: question about ppm.pl <gellyfish@gellyfish.com>
Re: Reading binary files (Randal L. Schwartz)
Re: regular Expression (Tad McClellan)
Re: Subroutines in a deperate file (Tad McClellan)
tee-ing STDOUT to a file? <eedjoes@eed.ericsson.se>
Re: tee-ing STDOUT to a file? <tchrist@mox.perl.com>
Re: that great DNS lookup script (Benjamin Franz)
Wanted Programing js34508@my-deja.com
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 20 Jul 1999 11:42:50 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: 3D modeling with Perl?
Message-Id: <1dv7itz.1v8qgra1m17q0N@[192.168.0.1]>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> > I have written a program that does 3D graphics mostly in Perl; it
> > displays a ball bouncing in a cubical box. You can probably adapt the
> > code to your needs; however, it was written to run on Mac OS, so it uses
> > some of the Mac OS's graphics primitives.
>
> > use Mac::Windows;
> > use Mac::QuickDraw;
>
> Why not use OpenGL module? It runs at least under X and OS/2 PM.
> Kenneth might have updated it to Win* as well...
1. I am not using X, OS/2, or any variant of Windows. (I use Mac OS
exclusively.)
2. I was not aware that module existed.
3. I have no idea how to use OpenGL.
4. I had this program lying around from a previous project, so I just
sent it in case he would find it of use.
5. Even if I had known about that module, I would not have used it in
this program, because I wrote it in part to learn about 3D graphics.
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: Tue, 20 Jul 1999 15:39:43 GMT
From: rurban@xarch.tu-graz.ac.at (Reini Urban)
Subject: ANN: perl5 winhelp docs (hlp+chm)
Message-Id: <379497ef.459052883@judy.x-ray.local>
I recently updated my perl5 winhelp and also created a perl5.chm,
compressed html. i need it for my perl IDE, for context sensible help.
(multiedit)
unfortunately pod2html and my own pod2rtf.pl (updated to 1.40) are still
"broken", so a certain amount of manual fixes were necessary and i
didn't bother to fix the two scripts to be able to let users to create
the winhelp docs on their site. though this would need less space and
easier updates.
the location is http://xarch.tu-graz.ac.at/home/rurban/software/perl/
or via ftp also at ftp://xarch.tu-graz.ac.at/pub/autocad/urban/perl/
the files: perlhlp5-1.40.zip [980 KB] and/or perl5.chm [1.8 MB]
note, that are still my older perl winhelp files as well
the smaller perl5 winhelp contains just the typical 5.005 docs without
perltoc, the larger perl5.chm also most of the modules docs from CPAN
for 5.005/win32.
pod2html is "broken" because it doesn't clear html tokens from links
targets. pod2rtf is broken because paragraphs are treated as 80 col
lines, and certain important targets such as all control operators
(while, for, if) are not indexed, and the links to perlvar are broken.
anyway, the docs are "quite okay" for me.
btw. does the activeware perl now contain usable (= searchable) docs?
did they fix pod2html or pod2rtf? (obviously not)
pod2tex + tex2rtf is quite useful as well, but i went the pod2rtf way.
--
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html
------------------------------
Date: Tue, 20 Jul 1999 10:04:49 -0500
From: Marshall Culpepper <marshalc@americasm01.nt.com>
Subject: Re: basename regexp?
Message-Id: <37949011.C9628DF5@americasm01.nt.com>
Jona Andersen wrote:
> Hi,
>
> I need to know the name of my script.
> $0 you'd say right? I know, but I just want the name, not the full
> pathname.
> I'd rather not use a shell
> Now I don't speak too fluently regular expressions (nor perl, for that
> matter),
> So, how do I strip the full path?
>
> Thanks,
>
> Joe
$script=$0;
$script=~ s/\/+\w+\///;
print $script
#$script is now the name of your script
:)
~Marshall
----------------------------------
just another guy trying to save the world
----------------------------------
------------------------------
Date: Tue, 20 Jul 1999 08:34:21 -0700
From: "Lauren" <xxx@yyy.com>
Subject: Re: basename regexp?
Message-Id: <7n250t$ocu$1@nntp2.atl.mindspring.net>
Jona Andersen <jona@ds10.hobby.nl> wrote in message
news:37948E1E.28C77299@ds10.hobby.nl...
> Now I don't speak too fluently regular expressions (nor perl, for that
> matter),
> So, how do I strip the full path?
If you promise to read up on regular expressions and learn Perl, an answer
is:
s/[^\\]+$//; #You'll have to replace the '\\' with the directory delimiter
of your OS
If you're unwilling to learn Perl, then all hope is lost...
>
> Thanks,
Welcome,
> Joe
Lauren
------------------------------
Date: Wed, 21 Jul 1999 01:34:46 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: basename regexp?
Message-Id: <MPG.11ff422372eb926d989b52@news-server>
Jonathan Stowe writes ..
>> I need to know the name of my script.
>> $0 you'd say right? I know, but I just want the name, not the full
>> pathname.
>
>Well you can either use the module File::Basename or do something like:
>
>($progname) = $0 =~ m%/([^/]+)$%;
my Linux perl gives just the script name (the basename) with $0 .. my
ActiveState perl on NT gives me the whole filename
is this just an ActiveState thing .. anyone else ? .. should we be
reporting a bug ?
clearly if it's just a windows thing then that regex needs to be changed
--
jason - remove all hyphens for email reply -
------------------------------
Date: 20 Jul 1999 16:52:15 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: basename regexp?
Message-Id: <37949b2f@newsread3.dircon.co.uk>
elephant <e-lephant@b-igpond.com> wrote:
> Jonathan Stowe writes ..
>>> I need to know the name of my script.
>>> $0 you'd say right? I know, but I just want the name, not the full
>>> pathname.
>>
>>Well you can either use the module File::Basename or do something like:
>>
>>($progname) = $0 =~ m%/([^/]+)$%;
>
> my Linux perl gives just the script name (the basename) with $0 .. my
> ActiveState perl on NT gives me the whole filename
>
> is this just an ActiveState thing .. anyone else ? .. should we be
> reporting a bug ?
>
> clearly if it's just a windows thing then that regex needs to be changed
>
The differences are almost certainly down to the command interpreter or
shell in question .... This is a good reason to be using File::Basename.
/J\
--
"Conservatives have called on Sports Minister, Tony Banks, to resign
after calling William Hague a foetus" - BBC News Website
------------------------------
Date: Mon, 19 Jul 1999 17:24:20 +0200
From: "Dr. Who" <qwerty@post.utfors.se>
Subject: fetch url with standard modules?
Message-Id: <37934324.C008E69A@post.utfors.se>
.. Is it possible to fetch an url with only the modules that comes with
perl?
I know how LWP works, but I'll probably have to mutate into a 3v|L h4X0r
to install that module - It's one of those free webhotels
Is there another way? ..maybe with Socket.pm? or IO? :)
Br
//Dr W
------------------------------
Date: 20 Jul 1999 16:46:28 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: fetch url with standard modules?
Message-Id: <379499d4@newsread3.dircon.co.uk>
Dr. Who <qwerty@post.utfors.se> wrote:
> .. Is it possible to fetch an url with only the modules that comes with
> perl?
> I know how LWP works, but I'll probably have to mutate into a 3v|L h4X0r
>
> to install that module - It's one of those free webhotels
> Is there another way? ..maybe with Socket.pm? or IO? :)
>
There is an example in the perlipc manpage of a webget thingy ...
/J\
--
"I don't have access to the intelligence" - Michael Howard
------------------------------
Date: Tue, 20 Jul 1999 15:48:10 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: fetch url with standard modules?
Message-Id: <_S0l3.5$pb6.2328@typhoon-sf.snfc21.pbi.net>
In article <37934324.C008E69A@post.utfors.se>, Dr. Who <@no.no> wrote:
>.. Is it possible to fetch an url with only the modules that comes with
>perl?
>I know how LWP works, but I'll probably have to mutate into a 3v|L h4X0r
>
>to install that module - It's one of those free webhotels
>Is there another way? ..maybe with Socket.pm? or IO? :)
#!/usr/bin/perl
# # # # # # ##### ###### # ######
# # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # #
# # # # # # # # # # #### ###### # # ######
# # # # # # # # # # # # # ####### # #
# # # # # # # # # # # # # # # # #
## ## ## ## ## ## ##### # # # # ######
#########################################################
# A WWW http grabber. #
# Basically, given an http address it will get you #
# the resource. #
# #
# Usage: wwwgrab http://site.name.edu/ [filename] #
# #
# ex. wwwgrab http://www.engr.wisc.edu/~ballard/ #
# will get you the source behind my homepage and #
# wwwgrab http://www.engr.wisc.edu/~ballard/pics/me.gif #
# will get you a .gif image of my picture. #
# #
#########################################################
# Written by Jeff Ballard (ballard@cae.wisc.edu) 7/2/95 #
# URL: http://www.engr.wisc.edu/~ballard/ #
#########################################################
# #
# Feel free to contact me with any questions/comments/ #
# and such. #
# #
#########################################################
# This program is freeware. *NO* warranty is expressed,#
# implied, nor granted to you in any way. Use of this #
# program is at your own risk. Your milage may vary. #
# This progarm was packed by weight, not by volume. #
# Some settling may have occurred during shipment. #
#########################################################
# Much thanks to Brendan Kehoe <brendan@cygnus.com> #
# URL: http://www.zen.org/~brendan/ #
# for his help in getting rid of the constants #
#########################################################
# Required for perl5.
use Socket;
# Given an http address, rip it into its coresponding parts.
($_, $savefilename) = @ARGV;
if (!$_) {
print "Usage: $0 http://www.any.site/location [outputfilename]\n";
print " Where [outputfilename] is the optional filename to create.\n";
print " (ommitting this means that it will mean that the data will be\n";
die " sent to STDOUT. If this file exists, it will be overwritten)\n";
}
/http:\/\/([^\/]*)\/*([^ ]*)/;
$site = $1;
$file = "/".$2;
if (!$site) {
die "$0: Fatal Error. You appear to have munged your URL address.\nIt must be in the form of http://www.any.site/location\n";
}
$_ = $site;
/^([^:]*):*([^ ]*)/;
$site = $1;
$port = $2;
$port = 80 unless $port;
$hostname = $site;
#print STDERR "[$site] [$port] [$file]\n";
# Open a socket and get the data
($sockaddr,$there,$response,$tries) = ("Snc4x8");
$there = pack($sockaddr,2,$port, &getaddress($hostname));
($a, $b, $c, $d) = unpack('C4', $hostaddr);
$proto = (getprotobyname ('tcp'))[2];
if (!socket(S,AF_INET,SOCK_STREAM,$proto)) { die "$0: Fatal Error. $!\n"; }
if (!connect(S,$there)) { die "$0: Fatal Error. $!\n"; }
select(S);$|=1;
select(STDOUT);
print S "GET $file HTTP/1.0\r\nPragma: no-cache\r\nUser-Agent: WebWalker/0.1 (Linux)\r\nFrom: webmaster\@netimages.com\r\n\r\n";
if ($savefilename) {
open(OUT,">".$savefilename) || die "$0: Fatal error. Cannot create $savefilename.\n";
}
while($line = <S>) {
if ($savefilename) {
print OUT $line;
} else {
print $line;
}
}
close(S);
if ($savefilename) {
close(OUT);
}
sub getaddress {
local($host) = @_;
local(@ary);
@ary = gethostbyname($host);
return(unpack("C4",$ary[4]));
}
------------------------------
Date: Tue, 20 Jul 1999 15:54:27 GMT
From: NukeEmUp@ThePentagon.com (David Cantrell)
Subject: Re: fetch url with standard modules?
Message-Id: <37949ac0.98289132@news.insnet.net>
On Mon, 19 Jul 1999 17:24:20 +0200, "Dr. Who" <qwerty@post.utfors.se>
said:
>.. Is it possible to fetch an url with only the modules that comes with
>perl?
>I know how LWP works, but I'll probably have to mutate into a 3v|L h4X0r
>
>to install that module - It's one of those free webhotels
If it's free, I'm surprised that they let you use perl at all. It's
one hell of a security risk letting unknown code run on your server.
>Is there another way? ..maybe with Socket.pm? or IO? :)
It's certainly _possible_. You need to create a socket connection to
the web server, send an HTTP request, and deal with the results. Not
hard really. A good starting point is to connect to port 80 on the
server using a telnet client and type the appropriate request, which
you can learn about from the relevant RFCs.
[Copying newsgroup posts to me by mail is considered rude]
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: 20 Jul 1999 16:16:05 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How should I sort by different fields?
Message-Id: <379492b5@newsread3.dircon.co.uk>
Floyd Morrissette <Webdesigner@NewWebSite.com> wrote:
> In article <379475ff@newsread3.dircon.co.uk>,
> Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>
>>
>> Why ? Why make someone connect to the internet, start a web browser
> and
>> so on when the document is or rather should be on their hard disk.
> Infact
>> simply pointing out that an answer can be found in the FAQ could be
>> construed as being more helpful as by the time they have found the
> answer
>> therein they will have also be exposed to the very of answers that can
> be
>> found and thus may not need to come back and ask another question.
>
> The fact that they read this message means there is a good chance they
> are already connected to the internet and if they click on the link then
> a browser starts for them. It may not be true of everybody but I think
> most.
>
That does not follow. Usenet news need need be conveyed over the internet
at all - it has traditionally been carried by UUCP and NNTP is a relatively
newcomer. Alternatively they might be using an Off-line browser or
perhaps will have bulk downloaded the messages and disconnected. I dont know
what you mean by 'if they click on the link' - there *is no link* merely
a URL in plain text : of course *you* might be using some browser that
supplies some form of newsreading capabilities but you cant assume that.
/J\
--
"The Tory Party is like a wonky shopping trolley - it pulls to the
left, it pulls to the right, but you just can't get it to go forward"
- John Prescott
------------------------------
Date: Tue, 20 Jul 1999 15:39:40 GMT
From: yangsu@ustc.edu
Subject: How to open database just once?
Message-Id: <7n257q$vc5$1@nnrp1.deja.com>
My thought is that I can have some function like init() which
will be called just once when the program runs. because the
database operation is frequent and I don't want to waste time
open the database connection again and again.
I also hope I can have a cleanup function available when the program
exits. This is done only once. (so it is similar to java servlet)
yang
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 20 Jul 1999 09:54:57 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to open database just once?
Message-Id: <37949bd1@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
yangsu@ustc.edu writes:
:My thought is that I can have some function like init() which
:will be called just once when the program runs. because the
:database operation is frequent and I don't want to waste time
:open the database connection again and again.
BEGIN{}, or also in later versions with extermely similar but not
identical semantics, INIT{}.
:I also hope I can have a cleanup function available when the program
:exits. This is done only once. (so it is similar to java servlet)
END{}
--tom
--
("I pray for") "The strength to change what I can, the inability to accept what
I can't, and the incapacity to tell the difference."
- Calvin
------------------------------
Date: Tue, 20 Jul 1999 09:51:11 -0600
From: Derek Sherlock <derek_sherlock@hp.com>
Subject: Re: lexical $_ with threads question?
Message-Id: <37949AEF.B964CD98@hp.com>
Hi again,
dan@tuatha.sidhe.org wrote:
>
> Derek Sherlock <derek_sherlock@hp.com> wrote:
> > Hi,
>
> > Thanks. That explains it. Sort of.
>
> > But, despite the paragraph you quoted, experimentation shows that
> > you CAN local() $_. The effect on visibility and lifetime seems
> > to be identical to that of local()'ing a true global, except that
> > it does not use the global namespace (i.e. it remains separate &
> > distinct from $main::_). But the local()'d value is still visible
> > to subroutines you call, so the localization is temporal (like
> > local()), and not lexical (like my()).
>
> What's happening is that you've got a lexical $_ (the default one) and a
> package $_, which you've local()'d. Your second example here:
>
> > use Thread;
> > local $a;
> > $a = 'hey';
>
> should really have a my before the $a to match the $_ example.
If I used "my" before $a in my second example, I would then get
an error because you can't localize a lexical. Well, except a
"magic" one, aparently. :)
Aaargh. My brain is about to explode! Let's see... So the $_
I localized is in fact a thread specific global, but when I use an
explicit package in the name, I get a non-thread-specific global,
and without explicit (or implicit by foreach) localization, I
am still looking at a lexical.
Sidetrack question:
What happens to lexical variables that already exist when a thread
is created. The thread gets it's own stack, of course. Does this
implicitly give it its own inherited copy of all the lexical
variables? I assume it must, otherwise, making $_ and @_ lexical
would have been a pointless excercise?
For that matter, if there are already global thread-specific
$_ and @_ implimented, why bother with lexical ones. Doesn't the
existance of the global thread-specific one already solve the
thread-safety problem?
Cheers,
Derek.
>
> Also, we really ought to be catching the write to $main::_ and affecting
> the current thread's $_, but that's apparently not happening. (Since $_
> *is* $main::_ in non-threaded perl, threaded perl ought to behave the
> same)
>
> > This is wierd stuff!
>
> > I've also experimented with separate threads, and am convinced
> > that the sort-of-lexical sort-of-global $_ really is thread
> > safe.
>
> Yep. When a thread is started it gets its own version of $_ with the value
> of $_ as it stood when the thread was started.
>
> I should point out that it *is* possible to affect another thread's $_,
> but you need a reference to it to do that.
>
> > I hope $_ does some day become a true per-thread global, as you
> > suggest it might. It would make all of this stuff much less
> > confusing!
>
> Yep, no doubt.
>
> > I wish there were a thread-centric perl book available.
>
> It'd probably be best to wait until threads settle down and get out of the
> alpha/beta stage before a book is written. And this all may (probably
> will) change with Topaz, since the current threading model is fairly
> inefficient.
>
> Dan
--
_ _
/ ) +-----------------------------------------+ ( \
/ / | | \ \
_( /_ | _ Derek Sherlock _ | _) )_
(((\ \> |/ ) Hewlett Packard - WSL ( \| </ /)))
(\\ \_/ / / Email : derek_sherlock@hp.com \ \_/ ////)
\ / Tel: 970-898-7582 Fax: 970-898-7388 \ /
\ _/ \_ /
/ / +-----------------------------------------+ \ \
/ / \ \
------------------------------
Date: 20 Jul 1999 10:02:43 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: lexical $_ with threads question?
Message-Id: <37949da3@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Derek Sherlock <derek_sherlock@hp.com> writes:
:What happens to lexical variables that already exist when a thread
:is created.
Nothing in particular.
#!/usr/local/bin/filsperl
use Thread;
my $private = 27;
printf "thread %d has private value $private\n",
Thread->self->tid();
sub bump_priv {
lock($private);
$private++;
printf "thread %d has private value $private\n",
Thread->self->tid();
};
$t1 = Thread->new(\&bump_priv);
$t2 = Thread->new(\&bump_priv);
$t1->join();
$t2->join();
printf "thread %d has private value $private\n",
Thread->self->tid();
Produces:
thread 0 has private value 27
thread 1 has private value 28
thread 2 has private value 29
thread 0 has private value 29
--tom
--
"Lies written in ink can never disguise facts written in blood. Blood debts
must be repaid in kind. The longer the delay, the greater the interest."
--Chinese author Lu Xun, 1926
------------------------------
Date: Tue, 20 Jul 1999 15:02:26 +0000
From: Doug Robinson <dkr@freerealtime.com>
Subject: multi-cast
Message-Id: <37948F82.92FE50F5@freerealtime.com>
Hello
Can anyone direct me to some documentation,
hopefully with an example, of the use of Multi-cast
Broadcasting in Perl?
Thanks for your time!
dkr
The Office of Doug Robinson. These types are not "abstract"; they are as
dkr@freerealtime.com real as int and float. - Doug McIlroy
------------------------------
Date: Tue, 20 Jul 1999 08:58:42 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: problem with searching database
Message-Id: <MPG.11fe3c89a7e1ddeb989d02@nntp.hpl.hp.com>
In article <37948554.D9AF17EA@americasm01.nt.com> on Tue, 20 Jul 1999
09:19:00 -0500, Marshall Culpepper <marshalc@americasm01.nt.com> says...
...
> #!/usr/bin/perl -w
Good start, but the rest of it isn't so good. For example, even in
short examples, we like to show people to 'use strict;'.
> open(FILE,"file");
And we *insist* on showing the test for failure to open the file.
> while(<FILE>){
> ($name,$age,$country)=split(/:/);
> $numofpeople++ if $age ==20 and $country="foobar";#counts number of
> people that are 20 and live in foobar :)
On the one line of code that really matters, there are several errors.
1. Assignment of a constant, instead of a comparison.
2. Failure to chomp first, so a correct comparison can never succeed.
3. A comment at the end that wraps onto the next line when posted.
> }
> print $numofpeople;
>
> this assumes your data file has 1 record on each line, with each field
> seperated by a colon
> i.e
> Joe:20:foobar
>
> ~Marshall
>
> --
> ----------------------------------
> just another guy trying to save the world
> ----------------------------------
You'll have a much better chance of saving the world if you TEST YOUR
CODE before posting it. (In Biblical terms, what you have done is 'put
a stumbling block before the blind'.)
If you choose to post a complete code example, here is a proper
response, adapted from yours. I finesse opening the input file and
supplying test data by putting the data directly into the text.
#!/usr/local/etc/perl -w
use strict;
my ($Age, $Country, $num_of_people) = (20, 'foobar', 0);
while (<DATA>) {
chomp;
my ($name, $age, $country) = split /:/;
#counts number of people that are $Age and live in $Country :)
$num_of_people++ if $age == $Age and $country eq $Country;
}
print $num_of_people;
__END__
Joe:20:foobar
Sam:20:baz
Moe:21:foobar
Jim:20:foobar
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 20 Jul 1999 15:38:19 GMT
From: brz@hotmail.com
Subject: question about ppm.pl
Message-Id: <7n2558$vb4$1@nnrp1.deja.com>
hi all:
just installed the 518 build of active perl. how do i use ppm.pl?
i checked out the faq, ran ppm.bat, and at the prompt i typed search,
verify, etc etc, got this error back:
PPM> verify
Error verifying URI: Could not locate a PPD file for URI
Error verifying Archive-Tar: Could not locate a PPD file for Archive-Tar
Error verifying XML-Element: Could not locate a PPD file for XML-Element
Error verifying libwin32: Could not locate a PPD file for libwin32
Error verifying Compress-Zlib: Could not locate a PPD file for Compress-
Zlib
Error verifying MIME-Base64: Could not locate a PPD file for MIME-Base64
Error verifying XML-Parser: Could not locate a PPD file for XML-Parser
Error verifying libwww-perl: Could not locate a PPD file for libwww-perl
Error verifying PPM: Could not locate a PPD file for PPM
Error verifying HTML-Parser: Could not locate a PPD file for HTML-Parser
PPM> quit
Quit!
what is this with PPD file?
thanks for any pointers
brz
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 20 Jul 1999 17:02:31 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: question about ppm.pl
Message-Id: <37949d97@newsread3.dircon.co.uk>
brz@hotmail.com wrote:
> hi all:
>
> just installed the 518 build of active perl. how do i use ppm.pl?
> i checked out the faq, ran ppm.bat, and at the prompt i typed search,
> verify, etc etc, got this error back:
>
> PPM> verify
> Error verifying URI: Could not locate a PPD file for URI
> Error verifying Archive-Tar: Could not locate a PPD file for Archive-Tar
Hmm.
Run PPM and then type 'set':
PPM> set
Commands will be confirmed.
Temporary files will be deleted.
Case-insensitive searches will be performed.
Package installations will continue if a dependency cannot be installed.
Tracing info will not be written.
Screens will not pause.
Current PPD repository paths:
ActiveState Package Repository: http://www.ActiveState.com/packages
Packages will be installed under: C:\Perl
Packages will be built under: C:\TEMP
I figure you are not connected to the internet when you type verify
but it might be that there is no current repository path which you might
need to type back in. The reason that verify needs to be connected to
the internet is that it will look at the PPD (Perl Package Description)
files in the repository to determine if there is an update available.
/J\
--
"Conservatives have called on Sports Minister, Tony Banks, to resign
after calling William Hague a foetus" - BBC News Website
------------------------------
Date: 20 Jul 1999 08:59:02 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Reading binary files
Message-Id: <m1wvvvxqgp.fsf@halfdome.holdit.com>
>>>>> "Kim" == Kim Saunders <kims@emmerce.com.au> writes:
Kim> a quick question: Can someone pls help me out with a bit of code to read
Kim> data from a binary file (an image), and then print it out to STDOUT??? Just
Kim> can't find it ANYWAY, pls email me the 3 or whatever lines!
<abigail>
system 'cat','image';
</abigail>
:-)
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Tue, 20 Jul 1999 04:30:39 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: regular Expression
Message-Id: <f3c1n7.d15.ln@magna.metronet.com>
Stephan Pelikan (a9702466@unet.univie.ac.at) wrote:
: I want to analyse an string on pairs of "(" and ")":
: "(abc def)" -> should return (abc def)
: "((abc def) (ghi jkl))" -> should return ((abc def) (ghi jkl))
: "((abc def) (ghi jkl)) (mno pqr)" -> should return ((abc def) (ghi jkl))
: I worked hard, but my knowledge of regular expressions is limited.
That is obvious, since it is *mathematically impossible* to
do what you want with regular expressions.
They do not have enough power to handle arbitrarily nested constructs.
(it _can_ be done, though it is often ugly, if you can live with
a "maximum nesting depth" restriction.
)
: I hope someone of you knows how to formulate it.
Anybody who checks the Perl FAQ before posting to the Perl
newsgroup already knows that it cannot be done (with regexen):
Perl FAQ, part 6:
"Can I use Perl regular expressions to match balanced text?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 20 Jul 1999 04:26:39 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Subroutines in a deperate file
Message-Id: <vrb1n7.d15.ln@magna.metronet.com>
Kevin Bilbee (kbilbee@wgn.net) wrote:
: I am trying to put my commonly used subroutines in a seperate file, but when
: I run my script I get the following error message.
: /home/kbilbee/public_html/cgi-bin/lib/subprint.pl did not return a true
: value at main.pl line 4.
: Does anybody know what I am doing incorrectly?
: Main routine
: ----------------------------------------------------------------------------
: #!/usr/lib/bin/perl
use diagnostics; # let perl tell you what if found wrong
# or, just go look up the message in perldiag.pod
[snip rest of code]
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 20 Jul 1999 17:28:34 +0200
From: Joern Stein <eedjoes@eed.ericsson.se>
Subject: tee-ing STDOUT to a file?
Message-Id: <379495A2.A6791F40@eed.ericsson.se>
Hi there,
I need to divert STDOUT and STDERR to a file and to the screen. Since
there are calls to other programs, whose output has to be tee'd as well,
using something like multiple print commands are out of the question.
I have tried using IO:Tee like this:
use IO::Tee;
my $t2 = IO::Tee->new(">test", \*STDOUT);
open SAVEOUT, ">&STDOUT";
open STDOUT, $t2;
print "Hello World\n";
close STDOUT;
but that prints only to the screen and not to the file. Any ideas out
there how to accomplish the task?
--
Cheers
Joern
------------------------------
Date: 20 Jul 1999 09:39:26 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: tee-ing STDOUT to a file?
Message-Id: <3794982e@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, Joern Stein <eedjoes@eed.ericsson.se> writes:
:I need to divert STDOUT and STDERR to a file and to the screen. Since
:there are calls to other programs, whose output has to be tee'd as well,
:using something like multiple print commands are out of the question.
Would it be too easy to just do:
open(STDOUT, "|tee outputfile");
--tom
--
last|perl -pe '$_ x=/(..:..)...(.*)/&&"'$1'"ge$1&&"'$1'"lt$2'
That's gonna be tough for Randal to beat... :-)
--Larry Wall in <1991Apr29.072206.5621@jpl-devvax.jpl.nasa.gov>
------------------------------
Date: Tue, 20 Jul 1999 15:34:06 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: that great DNS lookup script
Message-Id: <OF0l3.3$pb6.1645@typhoon-sf.snfc21.pbi.net>
In article <bQ%k3.883$6T3.39627@sapphire.mtt.net>,
kayec <delete.the.nospam.kayec@gov.ns.ca> wrote:
>Sometime ago i was pointed to a very fast DNS lookup script that did
>multiple lookups at a time... very fast, very impressive.
>
>Since then i've had a few problems and would like a copy of the
>original script again...
<URL:http://www.deja.com/getdoc.xp?AN=455581292>
--
Benjamin Franz
------------------------------
Date: Tue, 20 Jul 1999 15:42:55 GMT
From: js34508@my-deja.com
Subject: Wanted Programing
Message-Id: <7n25dr$vff$1@nnrp1.deja.com>
Looking for someone to write scripts, mainly working with flat txt
files and formating output of files to specfic html. Cross
referenceing and comparing flat txt files.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
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 V9 Issue 200
*************************************