[12692] in Perl-Users-Digest
Perl-Users Digest, Issue: 101 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 10 11:07:19 1999
Date: Sat, 10 Jul 1999 08:05:07 -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 Sat, 10 Jul 1999 Volume: 9 Number: 101
Today's topics:
Re: \d \s ?? <no@spam.net>
Re: Assigning args with regular expressions (elephant)
cant install WWW::Search on NT smnayeem7346@my-deja.com
Re: Emulating C++ Class Templates <pkg@studbox.uni-stuttgart.de>
Re: environment variables <gellyfish@gellyfish.com>
Re: FAQ 5.7: How can I use a filehandle indirectly? <tchrist@mox.perl.com>
Re: FAQ 5.7: How can I use a filehandle indirectly? <tchrist@mox.perl.com>
Re: FAQ 5.7: How can I use a filehandle indirectly? (Michael Rubenstein)
Re: Formatting a number to a currency string <docdata@mustangone.com>
Re: Hacker fouls off All-Star site (Bart Lateur)
Re: Hacker fouls off All-Star site (Mike Bristow)
Re: Help -- Weird Increments (MacPerl) <john@your.abc.net.au>
Re: Help -- Weird Increments (MacPerl) (Bart Lateur)
Re: Perl and secure shell <gellyfish@gellyfish.com>
Re: Perl Script bound to TCP Port <gellyfish@gellyfish.com>
Re: Suggestions: efficient way to compare large text fi <jdjacksn@earthlink.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 10 Jul 1999 06:59:48 -0600
From: "J" <no@spam.net>
Subject: Re: \d \s ??
Message-Id: <3nHh3.89$xEh.179235840@news.frii.net>
The * is a quantifier in a regular expression. In this case it means "match
the previous character 0 or more times". Read up on RegEx'es in the Llama or
Camel books, or get Freidels book if you want to go crazy with them.
-- Jeff
Cayce Collins <cayce@thurston.com> wrote in message
news:7m34gr$6an$1@quark.scn.rain.com...
> I am begining my perl walk into the clouds, and need help with this
> following line:
>
> if(/^($input_for{'username'})(\s*)Hours:(\d*)(\s*)Minutes:(\d*)(\s*)/){
>
> what does the \s* and \d* mean ?
>
>
------------------------------
Date: Sat, 10 Jul 1999 23:53:24 +1000
From: e-lephant@b-igpond.com (elephant)
Subject: Re: Assigning args with regular expressions
Message-Id: <MPG.11f1fb5b1a6dd3f3989b29@news-server>
Andrew Johnson writes ..
>In article <MPG.11f1a37628535c3b989b28@news-server>,
> elephant <e-lephant@b-igpond.com> wrote:
>! Ronald J Kimball writes ..
>! >theoddone33 <anonymous@web.remarq.com> wrote:
>! >
>! >> So the $1 $2, etc variables keep their values even outside
>! >> the regular expression, eh? Thanks!
>! >
>! >The $1 $2 etc variables *only* have their values outside the regular
>! >expression. Inside the regular expression, you have to use \1 \2 etc.
>!
>! I'd like to see the LHS caveat on this statement so that people don't
>! think that they should be doing this
>!
>! s/(some example)/blah \1/;
>
>yes, but he did say 'inside the regular expression', which is correct,
>the RHS of s/// is outside of the regular expression.
which was why I didn't say that it was incorrect .. just that it had the
potential to be misleading
--
jason - remove all hyphens for email reply -
------------------------------
Date: Sat, 10 Jul 1999 13:04:32 GMT
From: smnayeem7346@my-deja.com
Subject: cant install WWW::Search on NT
Message-Id: <7m7gct$5la$1@nnrp1.deja.com>
I have been trying to install the WWW::Search
module onto my winNT platform. I have ActivePerl
and installed VC++ just to be able to install this
module, but now its giving the following error
when i write perl Makefile.PL
Ambiguous call resolved as CORE::warn(), qualify
as such or use & at
f:/Perl/site/lib/HTML/TreeBuild
er.pm line 160.
Warning: prerequisite LWP 5.3 not found at (eval
1) line 220.
Writing Makefile for WWW::Search
after this I cannot run nmake, it gives an error.
Where do I find LWP 5.3? I only found 5.22 on the
ftp site. and is that the only problem?
thanks
smnayeem
smnayeem@agni.com
Agni Systems Ltd.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sat, 10 Jul 1999 13:47:28 +0200
From: Pete Gilbert <pkg@studbox.uni-stuttgart.de>
Subject: Re: Emulating C++ Class Templates
Message-Id: <378732D0.8EF8956B@studbox.uni-stuttgart.de>
williajp@my-deja.com wrote:
>
> I want to derive classes A2 and B2 from, respectively, A1 and B1, where
> A1 and B1 share a common parent class. The new code is identical in
> both derivations. That is, A2 and B2 override and add the same
> methods. I cannot modify any code in the A1 and B1 class hierarchies
> and do not want to write a bunch of forwarding functions since A1 and
> B1 are so large.
>
> So, I'd like to write a class C that would be equivalent to A2 when its
> parent is A1, but would be equivalent to B2 if its parent is B1. In
> C++, I'd make C a class template whose template parameter is its parent
> class. How can I get the same effect in Perl?
>
> Thanks,
>
> Jim Williams
in the following code the constructor for class C takes a new class name
and a list of parents (to which C itself is prepended) like so:
my $generated_class = new C("class_name_to_make", "parent_one",
"parent_two");
it then uses eval to create a @class_name_to_make::ISA and a sub
@class_name_to_make::new
I am not sure this is wise, but it seems to work.
#!perl -w
package A1;
sub new {
my $class = shift;
return bless {}, $class;
}#end new
sub printme {
my $self = shift;
print "i am an A1", %$self, @_;
}
package B1;
sub new {
my $class = shift;
return bless {}, $class;
}#end new
sub printme {
my $self = shift;
print "i am an B1", %$self, @_;
}
package C;
sub new {
my $template_class = shift;
my $new_class = shift;
my @parent_classes = @_;
eval "\@$new_class"."::ISA = qw($template_class @parent_classes);" .
" sub $new_class"."::new { my \$class = shift; return bless {},
\$class; }";"
return new $new_class;
}#end new
sub sayhi {
print shift, "hi\n";
}
package main;
my $A2 = new C(A2, A1);
my $B2 = new C(B2, B1);
$A2->printme("once\n");
$B2->printme("once\n");
$A2->sayhi();
$B2->sayhi();
--
Pete Gilbert *** email: pkg@studbox.uni-stuttgart.de
------------------------------
Date: 10 Jul 1999 09:35:27 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: environment variables
Message-Id: <7m744v$2k1$1@gellyfish.btinternet.com>
On Fri, 09 Jul 1999 23:40:26 -0400 Gene Dolgin wrote:
> does anyone know for which browsers http_from will still work?
>
I dont know perhaps you might ask in a group with the word browser in
the name.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 10 Jul 1999 07:53:22 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <37875052@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
miker3@ix.netcom.com (Michael Rubenstein) writes:
:>Um, "thusly" isn't a word. "Thus" is already an adverb.
:
:As is "thusly," at least according to the Oxford English
:Dictionary. It means the same as "thus."
I guess style guides that call it an error of illiteracy are
to be avoided, then.
--tom
--
"vi is my shepherd; i shall not font. in the name of the edlin, and the ex,
and the holy post. :wq" -- sig of lilith@the.satanic.org
------------------------------
Date: 10 Jul 1999 08:50:14 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <37875da6@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, miker3@ix.netcom.com (Michael Rubenstein) writes:
:As is "thusly," at least according to the Oxford English
:Dictionary. It means the same as "thus."
It is therein marked as being of colloquial adverbial usage, where it
finds itself in the august company of such similarly marked terms as
"indeedy", "ratherish", and "vurry", and well as their more adjectival
cohorts, "all-overish", "bettermost", "come-at-able", "decentish",
"invalidy", "judgmatical", "moreish", "nicey", "phrasey", "prestigey",
"shambolic", "statusy", "swellish", "twistical", and "ucky".
I don't meant to be judgmaticalistical and call it super invalidy
in vurry ripped and clipped jargon, but it's just not a decentish or
statusy thing to be writing thusly in the bettermost fora. Sure, that
kind of phrasey lingo might thusly sound more come-at-able to some of
the more swellish kiddies, but it's a ratherish shambolic stunt that
thusly leaves the vurry, vurry nicey reader in search of something, well,
moreish; you know, something a tad more primmy and prestigey. It's hard
to avoid getting an ucky taste all-overish when thusly stumbling through
twistical turns of tongue. Yes indeedy, Bob!
--tom
--
That means I'll have to use $ans to suppress newlines now.
Life is ridiculous.
--Larry Wall in Configure from the perl distribution
------------------------------
Date: Sat, 10 Jul 1999 14:56:31 GMT
From: miker3@ix.netcom.com (Michael Rubenstein)
Subject: Re: FAQ 5.7: How can I use a filehandle indirectly?
Message-Id: <37875cad.55481177@nntp.ix.netcom.com>
On 10 Jul 1999 07:53:22 -0700, Tom Christiansen
<tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting mailed to cited author]
>
>In comp.lang.perl.misc,
> miker3@ix.netcom.com (Michael Rubenstein) writes:
>:>Um, "thusly" isn't a word. "Thus" is already an adverb.
>:
>:As is "thusly," at least according to the Oxford English
>:Dictionary. It means the same as "thus."
>
>I guess style guides that call it an error of illiteracy are
>to be avoided, then.
Of course they should be. At least by those who
don't understand the difference between an error of
illiteracy and not being a word,
don't understand the difference between formal
written English and colloquial English (thusly is
described as being colloquial),
don't understand that the purpose of a style guide is
to help one in writing, not to beat up on others who
choose an informal style,
don't understand that style guides should be
consulted when writing, not when reading.
--
Michael M Rubenstein
------------------------------
Date: Sat, 10 Jul 1999 09:29:55 -0400
From: Doc Data <docdata@mustangone.com>
Subject: Re: Formatting a number to a currency string
Message-Id: <37874AD2.3FFEC697@mustangone.com>
I saw that in the faq but it would appear that it only adds commas and currency
format also requires 2 zero-filled decimal places.
Michael Budash wrote:
> In article <3786A180.30332D72@mustangone.com>, Doc Data
> <docdata@mustangone.com> wrote:
>
> >How can I format a number to a string in currency format?
> >
> >Thanks
>
> if i understand your question, here's the answer straight from the perlfaq:
>
> >How can I output my numbers with commas added?
> >
> >This one will do it for you:
> >
> > sub commify {
> > local $_ = shift;
> > 1 while s/^(-?\d+)(\d{3})/$1,$2/;
> > return $_;
> > }
> >
> > $n = 23659019423.2331;
> > print "GOT: ", commify($n), "\n";
> >
> > GOT: 23,659,019,423.2331
> >
> >You can't just:
> >
> > s/^(-?\d+)(\d{3})/$1,$2/g;
> >
> >because you have to put the comma in and then recalculate your position.
>
> hth-
> --
> | Michael Budash Consulting | 707-252-7670 voice |
> | Perl, Javascript, PHP, MySQL | 603-250-8679 fax |
> | Official Extropia Developer | mbudash@sonic.net |
--
Doc Data, Webmaster for...
. M1 Hobbies (http://www.M1Hobbies.com)
. Food Court Central (http://www.FoodCourtCentral.com)
. Aeromaster Decals (http://www.AeroMaster.com)
. Kendall Model Company (http://www.KMCMiami.com)
. Sumner Class Destroyers at DOL (http://www.plateau.net/usndd/classumnr.html)
. TholianWeb Services (http://www.TholianWeb.com)
. MustangOne (http://www.MustangONE.com)
------------------------------
Date: Sat, 10 Jul 1999 10:14:52 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Hacker fouls off All-Star site
Message-Id: <37871cf0.13180132@news.skynet.be>
Uri Guttman wrote:
>LWP. it is what chris used. it is what most any decent perl hacker would
>use.
That depends on what you call "decent". ;-)
Bart.
------------------------------
Date: Sat, 10 Jul 1999 10:39:34 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: Hacker fouls off All-Star site
Message-Id: <slrn7oe8n6.inq.mike@lindt.fat.dotat.at>
On Sat, 10 Jul 1999 10:14:52 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
>Uri Guttman wrote:
>
>>LWP. it is what chris used. it is what most any decent perl hacker would
>>use.
>
>That depends on what you call "decent". ;-)
In this case, lazy.
--
Mike Bristow, Geek-At-Large. GK/RM0501
one tequila - two tequila - three tequila - FLOOR !!!
------------------------------
Date: Sat, 10 Jul 1999 02:14:28 -0800
From: johnny99 <john@your.abc.net.au>
Subject: Re: Help -- Weird Increments (MacPerl)
Message-Id: <931601670.3699@www.remarq.com>
Yes, locking is not enabled in MacPERL, it would seem --
this particular script, however, was written for UNIX, and
contains not only script for servers which lock, but
separate subroutines for servers, and presumably,
situations, without locking. Let's not worry about locking
for now, eh?
Er -- I still have my problem. I want to open a file, get
the contents, which will consist of a number, treat the
contents as a number, increment it by one, and write the
results out to the same filename.
Your kind help so far has alerted me to the probability that
this stuff in the script may contain some functions not
implemented in MacPerl:
seek (NUMBER, 0, 0);
print NUMBER "$num";
truncate (NUMBER, tell(NUMBER));
because this stuff is obviously the stuff about finding
where in the file I'm reading, rewinding it, chopping stuff
off the end, etc.
Can someone tell me which of these functions isn't working
for me? Actually that wouldn't fix it, would it? Can someone
instead tell me in a little more detail how to do the
equivalent of this:
data.txt consists of a number
I get the number from data.txt
I do stuff to it in Perl and get a new number
I replace the entire contents of data.txt with the new
number
I'm a little bemused that this task is so hard -- that I
have to do all this "rewind the file to the right place"
stuff. As soon as I've read the file, it's history. I want
to trash it and write a new one, or do the equivalent of a
"save as". Was the writer of this script being extra careful
for some reason to do with UNIX, or am I missing something
obivous because it's late?
johnny "when was the last time you saw duc
**** Posted from RemarQ - http://www.remarq.com - Discussions Start Here (tm) ****
------------------------------
Date: Sat, 10 Jul 1999 11:06:41 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Help -- Weird Increments (MacPerl)
Message-Id: <378828bb.900770@news.skynet.be>
johnny99 wrote:
> seek (NUMBER, 0, 0);
> print NUMBER "$num";
> truncate (NUMBER, tell(NUMBER));
>Can someone tell me which of these functions isn't working
>for me?
Hmm... I've tried something like this on a PC, and it didn't work
either. I dunno, I guess tell() doesn't work right when used in this
manner. What you can do, and which (probably) works, is
seek (NUMBER, 0, 0);
truncate (NUMBER, 0);
print NUMBER "$num";
Eh... any reason for the quotes around $num?
Bart.
------------------------------
Date: 10 Jul 1999 09:39:15 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl and secure shell
Message-Id: <7m74c3$2k5$1@gellyfish.btinternet.com>
On Fri, 09 Jul 1999 22:02:35 GMT Jalil Feghhi wrote:
> Is there any support for secure shell in Perl, especially for Windows?
>
If there is a module that offers support for SSH then it will be found at
CPAN <http://www.perl.com/CPAN> I cant recall having seen one though.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 10 Jul 1999 09:34:35 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl Script bound to TCP Port
Message-Id: <7m743b$2ju$1@gellyfish.btinternet.com>
In comp.lang.perl.misc Jonathan Abourbih <jonathaa@interchg.ubc.ca> wrote:
>
> My problem is that when someone telnets into this port, they get no response
> from my host until the connection is closed.
Check out the perlvar manpage for $OUTPUT_AUTOFLUSH and also perlfaq5:
=head2 How do I flush/unbuffer an output filehandle? Why must I do this?
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 10 Jul 1999 08:41:28 -0500
From: Jamie Jackson <jdjacksn@earthlink.net>
Subject: Re: Suggestions: efficient way to compare large text files?
Message-Id: <37874D88.C1792F33@earthlink.net>
Use Perl
mercurius_1@yahoo.com wrote:
> Using active server pages written in either Javascript or Perl, I would
> like to be able to compare two plain text files of 5-15 pages in length
> -- an original and a revised file. When additions are made to the
> revised file, I want to be able to distinguish this new text from the
> original (so it can be colored differently).
>
> Does anyone have any suggestions on how best to do this in an efficient
> way? I've used strcmp in the past for smaller tasks, but I wonder how
> well that will work in a long document that may be up to 15 pages in
> length. Suggestions on how best to compare the old/new versions of the
> document would be very much appreciated.
>
> Thank you.
> Mercury
>
> 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 101
*************************************