[19375] in Perl-Users-Digest
Perl-Users Digest, Issue: 1570 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 20 14:05:35 2001
Date: Mon, 20 Aug 2001 11:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <998330709-v10-i1570@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 20 Aug 2001 Volume: 10 Number: 1570
Today's topics:
Re: -w pragma <ubl@schaffhausen.de>
Re: Caching information about IP subnets (Sargon)
Re: Counters <newsgroup@buybritishweb.co.uk>
Re: Counters <philippe.perrin@sxb.bsf.alcatel.fr>
Re: Help with Piped command, capturing output (Jonathan Cunningham)
Re: How to upload files (Anno Siegel)
Re: install module in current dir? <prlawrence@lehigh.edu>
Re: install module in current dir? <ilya@martynov.org>
Re: install module in current dir? <ilya@martynov.org>
Re: Looking for Script <dennis@noreplies.com>
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
Re: Perl OO needs the opposite of SUPER:: <ren@tivoli.com>
Re: perldoc is like Greek to a beginner?? <bernie@fantasyfarm.com>
Re: perldoc is like Greek to a beginner?? <uri@sysarch.com>
Re: PerlMagick (Eric Bohlman)
Re: permuting extremely large string <johndporter@yahoo.com>
Re: qw(). <krahnj@acm.org>
Re: simple <bcaligari@fireforged.com>
Re: simple <bcaligari@fireforged.com>
Re: simple <johndporter@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 20 Aug 2001 18:02:17 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: -w pragma
Message-Id: <3B814299.666D76DA@schaffhausen.de>
Nkhouri schrieb:
>
> i used the -w pragma in my FCGI program ,i get many harmless warnings
> like
> used of unintialized values . now if i remove the -w from the shebang
> line,
> the program stops responding and writes an error : program terminated
> with exits status 2 . in other words , i cant run the program without
> the -w pragma anymore !
the -w has the extra "feature" that on some shells it cures the problems
with line breaks made by other OSes
->malte
------------------------------
Date: Mon, 20 Aug 2001 15:46:49 GMT
From: doctor@ptd.net (Sargon)
Subject: Re: Caching information about IP subnets
Message-Id: <Jhag7.11783$an2.250170@nnrp1.ptd.net>
This may or not fall into a question that I have regarding subnets.
Currently I am working on a program that dumps information from a database
into files that another program needs to read. Anyway, I am stuck at the
subnet point of the programs.
I need to create an entry in each file called NetBlock. The netblock contains
the range of IP's an user has assigned to them.
Example:
Customer A has 192.68.0.0 - 192.68.0.7
This would be a /29
I need my program to take 192.68.0.0 - 192.68.0.7 and create this output
NetBlock = 192.68.0.0/29
I am not sure what the simplicy way to accomplish this would be.
I though of using simple math calculations by taking the last field of each IP
and subtracting them, however I may not get the right IP amount response.
Example: 7+- 0 = 7 where I would actually need to have it reply as 8.
If anyone can decipher what I am looking to do here and could give me any kind
of idea to jump start this option please let me know.
FYI - This is an automated script to STDIN options or other user interactions
really won't work.
------------------------------
Date: Mon, 20 Aug 2001 16:14:12 +0100
From: "GBs" <newsgroup@buybritishweb.co.uk>
Subject: Re: Counters
Message-Id: <AX9g7.18372$0L6.2713928@news2-win.server.ntlworld.com>
This isn't just a crappy counter though...it's going to be part of a road
sign graphic so i need to be able to display a different digit image
depending on where that digit is in the final count number so that I can put
perspective on the number images.
Does anyone know how to do this then?
Tom
John J. Trammell <trammell@haqq.hypersloth.invalid> wrote in message
news:slrn9o2mh0.rcj.trammell@haqq.hypersloth.net...
> On Mon, 20 Aug 2001 14:58:07 +0100, GBs wrote:
> > This may confuse you, but do you know of a graphical access counter
> > script...
>
> Man, page hit counters are *so* 1999.
>
> --
> Just Another Perl Hacker.
------------------------------
Date: Mon, 20 Aug 2001 17:45:07 +0200
From: Philippe PERRIN <philippe.perrin@sxb.bsf.alcatel.fr>
Subject: Re: Counters
Message-Id: <3B813083.D8946BAB@sxb.bsf.alcatel.fr>
GBs wrote:
> The 0 would be tenthousands0.jpg, the 2 would be thousands2.jpg, the 5 would
> be hundreds5.jpg, the 8 would be tens8.jpg and the nine would be units9.jpg
> so that I could make each number a different colours.
here's an example :
@prefix = ("units", "tens", "hundreds", "thousands", "tenthousands");
$number = "0 2 5 8 9";
@digits = split(/ /, $number);
$i = 0;
foreach $digit (reverse @digits) {
print "$prefix[$i++]$digit.jpg\n";
}
it displays :
units9.jpg
tens8.jpg
hundreds5.jpg
thousands2.jpg
tenthousands0.jpg
--
PhP
($r1,$r2,$r3,$r4)=("19|20","0|1","28|29","5|24");($r5,$r6)=("9|10|15|16|$r1|$r2","9|10|$r3");%h=("1|",$r6,"1=","[1-5]|2[0-4]","1/","0|19","1\\","6|25","2|","0|6|19|25|$r6","2/","1|20","2\\",$r4,"3|","$r2|6|$r1|25|$r6","3/",$r4,"4|","$r2|$r1|$r6","4=","2|3|4|11|12|13|14|21|22|23","4/",$r4,"4\\",15,"5|","$r2|9|15|$r1|20|$r3","5/",10,"6|",$r5,"7|",$r5,"7/",$r3);for($l=1;$l<8;$l++){b:for($i=0;$i<30;$i++){c:foreach(keys
%h){next c if(!(/^$l(.*)$/));$a=$1;if($i=~/^($h{$_})$/){print $a;next
b;}}print " ";}print "\n";}
------------------------------
Date: 20 Aug 2001 09:28:54 -0700
From: dawfun@seanet.com (Jonathan Cunningham)
Subject: Re: Help with Piped command, capturing output
Message-Id: <4d6fd5fc.0108200828.f61ce5b@posting.google.com>
Michael Budash <mbudash@sonic.net> wrote in message news:<mbudash-060499.16190617082001@news.sonic.net>...
>
> open2 is the way. here's a snippet to get you started:
>
> # We need a library function
> use IPC::Open2;
>
> # Set up the pgp command
> $pgpcmd = "/full/path/to/pgp -feast -m -z $passphrase $pubKey";
>
> # Open the PGP program for bidirectional I/O
> $pid = open2(\*READPGP, \*WRITEPGP, $pgpcmd) or die("oops!: $!");
>
> # Send data to be encrypted to PGP
> print WRITEPGP $text_to_encrypt;
>
> # Encrypt the data
> close(WRITEPGP);
>
> # Get the encrypted data from PGP
> $encrypted_text = do { local $/; <READPGP> };
> close(READPGP);
>
> hth-
Excellent suggestion...the explaination of Open2 was very clear,
however the script hangs (deadlocks?) immediately after the PGP
program starts...right when it normally would return "Passphrase is
good" it just sits there. :(
Here is your example applied to my code:
use strict;
use IPC::Open2;
my $passphrase = shift;
my $pubKey = shift;
my $message = shift;
# Set up the pgp command
my $pgpcmd = "pgp -feast -m -z $passphrase $pubKey";
# Open the PGP program for bidirectional I/O
my $pid = open2(\*READPGP, \*WRITEPGP, $pgpcmd) or die("oops!: $!");
# Send data to be encrypted to PGP
print WRITEPGP $message;
# Encrypt the data
close(WRITEPGP);
# Get the encrypted data from PGP
my $encrypted_text = do { local $/; <READPGP> };
close(READPGP);
print $encrypted_text;
Any idears on what might be causing the hang (and better still, how to
get around it)?
Thanks again,
Jonathan
------------------------------
Date: 20 Aug 2001 15:53:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: How to upload files
Message-Id: <9lrbpf$11d$2@mamenchi.zrz.TU-Berlin.DE>
According to Fan Hongtao <fanh@mail.noh.gov>:
> how to upload file into a website outside?
That question is better directed at the webmaster of the remote site.
Anno
------------------------------
Date: Mon, 20 Aug 2001 11:59:15 -0400
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: Re: install module in current dir?
Message-Id: <9lrc4m$kbe@fidoii.CC.Lehigh.EDU>
"Ilya Martynov" <ilya@martynov.org> wrote:
>
> PRL> I want to install DBI in my personal dir...
>
> perl Makefile.PL LIB=/path/to/dir
>
> Also see perldoc ExtUtils::MakeMaker.
Thanks!
Next I want to install DBD::Oracle and instruct it to use the
just-installed DBI, as opposed to our production version in the
standard location. I read throught perldoc ExtUtils::MakeMaker, but I
could not identify which attribute is appropriate for this purpose...
Merely specifying the LIB attribute does not effect the change I need,
DBD::Oracle still links to the old, production version.
Phil
------------------------------
Date: 20 Aug 2001 20:22:48 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: install module in current dir?
Message-Id: <87d75qhfaf.fsf@abra.ru>
PRL> Next I want to install DBD::Oracle and instruct it to use the
PRL> just-installed DBI, as opposed to our production version in the
PRL> standard location. I read throught perldoc ExtUtils::MakeMaker, but I
PRL> could not identify which attribute is appropriate for this purpose...
PRL> Merely specifying the LIB attribute does not effect the change I need,
PRL> DBD::Oracle still links to the old, production version.
perl Makefile.PL LIB=/path/to/dir only installs modules to nonstandart
location. You still need either 'use lib' (see perldoc lib) or set
PERL5LIB env variable (see perldoc perlrun) to point Perl where it
should search for libraries.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: 20 Aug 2001 20:26:24 +0400
From: Ilya Martynov <ilya@martynov.org>
Subject: Re: install module in current dir?
Message-Id: <878zgehf4f.fsf@abra.ru>
PRL> Next I want to install DBD::Oracle and instruct it to use the
PRL> just-installed DBI, as opposed to our production version in the
PRL> standard location. I read throught perldoc ExtUtils::MakeMaker, but I
PRL> could not identify which attribute is appropriate for this purpose...
PRL> Merely specifying the LIB attribute does not effect the change I need,
PRL> DBD::Oracle still links to the old, production version.
IM> perl Makefile.PL LIB=/path/to/dir only installs modules to nonstandart
IM> location. You still need either 'use lib' (see perldoc lib) or set
IM> PERL5LIB env variable (see perldoc perlrun) to point Perl where it
IM> should search for libraries.
BTW you can find this excerpt from my .bash_profile usefull:
export PERL_MM_OPT="LIB=$HOME/perl-lib PREFIX=$HOME"
export PERL5LIB="$HOME/perl-lib"
Env variable PERL_MM_OPT can be used by ExtUtils::MakeMaker to specify
default values for its params. So I can type just 'perl Makefile.PL'
to install modules to my directory.
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
| Ilya Martynov (http://martynov.org/) |
| GnuPG 1024D/323BDEE6 D7F7 561E 4C1D 8A15 8E80 E4AE BE1A 53EB 323B DEE6 |
| AGAVA Software Company (http://www.agava.com/) |
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
------------------------------
Date: Mon, 20 Aug 2001 08:00:03 -0400
From: "Dennis H" <dennis@noreplies.com>
Subject: Re: Looking for Script
Message-Id: <Gpbg7.27677$7F.362418@e420r-sjo2.usenetserver.com>
Then you shouldn't have any problem. A static route has a lower
adminstrative distance than OSPF and will be choosen first. When that route
becomes unavailable it will drop from the routing table and the OSPF route
will take over...
Dennis
"T Mesbah" <tmesbah@hotmail.com> wrote in message
news:6e9d9699.0108180631.5b238d48@posting.google.com...
> 1)We need to use the path defined with the static route first because
> of the bandwith (path defined with Encryptor)
> 2) The backup for this path is frame-relay using OSPF
>
>
> ===== STATIC ROUTE
> | | ===== === ========
> | R1 |--- ENCRY--- ISP1----ENCRY----R3------| |
> | | ===== === | |
> ===== | |
> | | |
> |OSPF |Switch |
> | | |
> ======= | |
> | | ===== == | |
> | R2 |------------ ISP2 -------R4--------| |
> | | ===== == =========
> ======= Frame Relay
>
>
>
>
>
> "Dennis H" <dennis@noreplies.com> wrote in message
news:<vBaf7.56128$rV6.2628169@e420r-atl2.usenetserver.com>...
> > You could do this by making a floating static route... when the main
route
> > goes down the floating static will take over... no need to logon and
> > reconfigure anything...
> >
> >
> >
> > "T Mesbah" <tmesbah@hotmail.com> wrote in message
> > news:6e9d9699.0108170605.2eddec74@posting.google.com...
> > > The reason of using a static route is that we use encryptor on front
> > > of the router and these encryptor block all routing protocols and the
> > > only way to make it working is to use static route. I am looking for
> > > script to remove the static route and use an another path without
> > > caming in at the office and remove them manually.
> > >
> > > Thanks
> > >
> > >
> > > "Ian M" <ian.mulvihill.no.spam@computer.org> wrote in message
> > news:<3b7bc173$0$227$cc9e4d1f@news.dial.pipex.com>...
> > > > "Dennis H" <dennis@noreplies.com> wrote in message
> > > > news:KGOe7.42984$rV6.2110903@e420r-atl2.usenetserver.com...
> > > > >
> > > > >
> > > > > Uhhhh... why?
> > > > >
> > > > >
> > > > > "T Mesbah" <tmesbah@hotmail.com> wrote in message
> > > > > news:6e9d9699.0108151340.4493cafd@posting.google.com...
> > > > > > Hi,
> > > > > >
> > > > > > 1) I have two Cisco router routerA and routerB.
> > > > > > 2) In routerA I have static route "ip route X.X.X.X Y.Y.Y.Y
Z.Z.Z.Z"
> > > > > > to access routerB.
> > > > > >
> > > > > > I am looking for script that ping routerB each 5 minutes and if
> > > > > > routerB is down then the script need to telnet to routerA and
remove
> > > > > > these static route.
> > > > > >
> > > > > > Many Thanks
> > > > >
> > > > >
> > > >
> > > > That's what routing protocols are for. Is this too easy and
efficient?
> > > >
> > > > Either you have a more complicated and unsual reason to do it this
way,
> > or
> > > > misunderstand the (preferable) options. Do you want clarify what
you're
> > > > trying to solve, and we could make some suggestions?
> > > >
> > > >
> > > > Cheers,
> > > > Ian
------------------------------
Date: Mon, 20 Aug 2001 16:14:41 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <to2drhb38osc94@corp.supernews.com>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 13 Aug 2001 15:29:26 GMT and ending at
20 Aug 2001 14:23:02 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 2001 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 134 (40.2% of all posters)
Articles: 222 (16.8% of all articles)
Volume generated: 385.1 kb (14.8% of total volume)
- headers: 178.7 kb (3,592 lines)
- bodies: 198.6 kb (6,556 lines)
- original: 138.1 kb (4,757 lines)
- signatures: 7.5 kb (159 lines)
Original Content Rating: 0.695
Averages
========
Posts per poster: 1.7
median: 1.0 post
mode: 1 post - 89 posters
s: 1.6 posts
Message size: 1776.1 bytes
- header: 824.2 bytes (16.2 lines)
- body: 916.3 bytes (29.5 lines)
- original: 636.8 bytes (21.4 lines)
- signature: 34.6 bytes (0.7 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
9 12.5 ( 8.0/ 4.3/ 2.5) John Porter <johndporter@yahoo.com>
9 20.9 ( 8.6/ 9.9/ 6.5) Ilmari Karonen <usenet11552@itz.pp.sci.fi>
6 14.5 ( 5.7/ 7.5/ 4.6) Ilmari Karonen <usenet11553@itz.pp.sci.fi>
6 7.2 ( 4.0/ 2.5/ 1.1) John J. Trammell <trammell@haqq.hypersloth.invalid>
6 11.8 ( 5.8/ 6.0/ 2.5) "David Hilsee" <davidhilseenews@yahoo.com>
5 10.7 ( 4.6/ 6.1/ 2.4) "Albretch" <lbrtchx@hotmail.com>
5 11.6 ( 4.1/ 7.2/ 5.2) Ronnie Davies <ronnie@r-davies.demon.co.uk>
4 10.3 ( 3.6/ 5.7/ 3.9) Ilmari Karonen <usenet11547@itz.pp.sci.fi>
4 10.9 ( 3.5/ 7.4/ 2.8) T Mesbah <tmesbah@hotmail.com>
4 4.9 ( 3.4/ 1.5/ 1.1) Seung Choi <chaos0920@orgio.net>
These posters accounted for 4.4% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
20.9 ( 8.6/ 9.9/ 6.5) 9 Ilmari Karonen <usenet11552@itz.pp.sci.fi>
14.5 ( 5.7/ 7.5/ 4.6) 6 Ilmari Karonen <usenet11553@itz.pp.sci.fi>
12.5 ( 8.0/ 4.3/ 2.5) 9 John Porter <johndporter@yahoo.com>
11.8 ( 5.8/ 6.0/ 2.5) 6 "David Hilsee" <davidhilseenews@yahoo.com>
11.6 ( 4.1/ 7.2/ 5.2) 5 Ronnie Davies <ronnie@r-davies.demon.co.uk>
11.3 ( 1.8/ 9.4/ 9.3) 2 Sean Quinlan <sean@quinlan.org>
10.9 ( 3.5/ 7.4/ 2.8) 4 T Mesbah <tmesbah@hotmail.com>
10.8 ( 2.9/ 7.9/ 4.8) 4 djcabz <c_barbet@hotmail.com>
10.7 ( 4.6/ 6.1/ 2.4) 5 "Albretch" <lbrtchx@hotmail.com>
10.3 ( 3.6/ 5.7/ 3.9) 4 Ilmari Karonen <usenet11547@itz.pp.sci.fi>
These posters accounted for 4.8% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.975 ( 1.4 / 1.4) 3 "G Harper" <admin@CLIPMEnova1.f2s.com>
0.743 ( 1.1 / 1.5) 4 Seung Choi <chaos0920@orgio.net>
0.722 ( 5.2 / 7.2) 5 Ronnie Davies <ronnie@r-davies.demon.co.uk>
0.690 ( 3.9 / 5.7) 4 Ilmari Karonen <usenet11547@itz.pp.sci.fi>
0.655 ( 6.5 / 9.9) 9 Ilmari Karonen <usenet11552@itz.pp.sci.fi>
0.615 ( 4.6 / 7.5) 6 Ilmari Karonen <usenet11553@itz.pp.sci.fi>
0.612 ( 4.8 / 7.9) 4 djcabz <c_barbet@hotmail.com>
0.571 ( 2.5 / 4.3) 9 John Porter <johndporter@yahoo.com>
0.505 ( 0.8 / 1.7) 3 "Rippo" <info@rippo>
0.455 ( 1.1 / 2.5) 6 John J. Trammell <trammell@haqq.hypersloth.invalid>
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.655 ( 6.5 / 9.9) 9 Ilmari Karonen <usenet11552@itz.pp.sci.fi>
0.615 ( 4.6 / 7.5) 6 Ilmari Karonen <usenet11553@itz.pp.sci.fi>
0.612 ( 4.8 / 7.9) 4 djcabz <c_barbet@hotmail.com>
0.571 ( 2.5 / 4.3) 9 John Porter <johndporter@yahoo.com>
0.505 ( 0.8 / 1.7) 3 "Rippo" <info@rippo>
0.455 ( 1.1 / 2.5) 6 John J. Trammell <trammell@haqq.hypersloth.invalid>
0.428 ( 2.5 / 6.0) 6 "David Hilsee" <davidhilseenews@yahoo.com>
0.397 ( 2.4 / 6.1) 5 "Albretch" <lbrtchx@hotmail.com>
0.382 ( 2.8 / 7.4) 4 T Mesbah <tmesbah@hotmail.com>
0.375 ( 1.2 / 3.1) 3 Ash Turner <ash@turnernewmedia.com.au>
14 posters (10%) had at least three posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
34 comp.lang.perl.modules
29 alt.perl
15 comp.lang.perl
12 comp.text.xml
11 microsoft.public.xml
7 comp.lang.tcl
7 comp.dcom.sys.cisco
4 comp.lang.perl.tk
4 alt.ascii-art
3 comp.infosystems.www.authoring.tools
Top 10 Crossposters
===================
Articles Address
-------- -------
8 T Mesbah <tmesbah@hotmail.com>
4 "Dennis H" <dennis@noreplies.com>
4 Mikko Koljander <koldex@spamcop.net>
3 "Rippo" <info@rippo>
2 Sean Quinlan <sean@quinlan.org>
2 christian chatelain <cchatel@libertysurf.fr>
2 John <jouell@zdnetmail.com>
2 "Ian M" <ian.mulvihill.no.spam@computer.org>
1 "kenneth" <japh_klch@programmer.net>
1 Ilmari Karonen <usenet11554@itz.pp.sci.fi>
------------------------------
Date: 20 Aug 2001 10:16:14 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Perl OO needs the opposite of SUPER::
Message-Id: <m3itfizrr5.fsf@dhcp9-161.support.tivoli.com>
On 18 Aug 2001, johnlin@chttl.com.tw wrote:
> Ren Maddox wrote
>
>> OK. I've taken your example and changed it to use what I consider
>> the more normal solution. The trick is to separate the part that
>> you want the intermediate class(es) to override from the part that
>> you want the final class(es) to override.
>
> Great!!! Your solution is much better than I have ever thought of by
> myself.
Thanks.
> Using your solution, consider the same classes. Suppose that
>
> Report::
> sub gen; (calls report)
> sub save_as_html; (calls report)
> sub print_to_printer; (calls report)
> sub report {return} # please inherit and override
>
> My version is:
>
> Report::
> sub gen; # unchanged
> sub save_as_html; # don't need to change
> sub print_to_printer; # not even changed a single line
> sub report : virtual {return} # just add a "virtual" attribute here
>
> ExtendedReport::
> sub report : virtual { change the behavior } # and call VIRTUAL:: if needed
>
> Done!!! And nothing more.
>
> But, with current Perl's restriction, using your solution:
>
> Report::
> sub pre_gen; # You need to modify the original class
> sub gen; # breaking down subroutines into pieces
> sub post_gen; # which I consider to be ugly :)
> sub pre_save_as_html;
> sub save_as_html;
> sub post_save_as_html;
> sub pre_print_to_printer;
> sub print_to_printer;
> sub post_print_to_printer;
>
[snipped ExtendedReport skeleton]
At first blush, I'm not visualizing why you would need all of this.
If you are expecting virtual report to handle everything, then
pre_report and post_report can handle it. There is no need for
pre_gen, post_gen, etc.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Mon, 20 Aug 2001 11:09:01 -0400
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <ls92ot4kbi8jqd6odn8uk39m7hejn0388h@news.supernews.net>
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
} Bernie Cosell wrote:
} >
} > abigail@foad.org (Abigail) wrote:
} >
} > } Could you give examples from some well known languages, like C, Java
} > } and ADA that proves they are not truely context free?
} >
} > How about something like:
} > ---------------------
} > typedef int x ;
} >
} > x *y();
} > ---------------------
} >
} > Does it parse into an expression with a function call, or a
} > declaration?
}
} For it to be a funcion call, you would need an extra pair of parens:
} (x)*y();
No, no -- the question is whether the parser can figure out whether the
second line is an expression [to be evaluated for its side effect] or a
declaration [of 'y' being a function that returns a pointer to an 'x']
} Simply saying "int" doesn't do a cast, you have to do "(int)"
I think you're not understanding what typedef does in C.
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Mon, 20 Aug 2001 16:13:55 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: perldoc is like Greek to a beginner??
Message-Id: <x7snemhfp7.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@foad.org> writes:
A> Uri Guttman (uri@sysarch.com) wrote on MMCMXI September MCMXCIII in
A> <URL:news:x7wv3zgzwm.fsf@home.sysarch.com>:
A> || >>>>> "AB" == Alan Barclay <gorilla@elaine.furryape.com> writes:
A> ||
A> || AB> In article <x7bslpantv.fsf@home.sysarch.com>,
A> || AB> Uri Guttman <uri@sysarch.com> wrote:
A> || >> and as others have said, there is little chance of simplifying regular
A> || >> expression grammar. it has been around for so many years and nobody has
A> || >> come up with a better/simpler grammar.
A> ||
A> || AB> There have been simpler garmmars, but only at the cost of much of
A> || AB> the power. The implementation of regexes you get when using SQL's
A> || AB> LIKE operator is very simple, but not very powerful.
A> ||
A> || well, obviously i mean a simpler grammar for the same power level. i
A> || have to steal tad's tag line and say you have to pay for the power. to
A> || have perl's regex power, you need to master its grammar (which isn't
A> || THAT hard). it just requires some proper thinking.
A> For regular expressions (as in regular expressions in the Chomsky
A> hierarchy), all you need is two operators: `*' and `|', and parens for
A> precedence). `+', `?', `{,}', `[]', `.', etc is all fluff and not at
A> all needed.
i am aware of that. my comment on perl's regex power was to the features
you mention next. also the extra grammar sugar perl supports makes it
more expressive but harder for newbies to learn. do you want them doing
(a|b|c) instead of [abc]? char class are a shortcut, but a very useful
one. and as someone said it is another (extremely tiny) minilanguage
inside a minilanguage inside a language.
A> Back references make regular expressions more powerfull. And so do
A> things like (?{ }).
and char classes make them clearer so even if they don't affect the
kinds of strings that can be matched, they affect the way they are
written and read. this is the issue, how to express regex things that
humans want. cahr classes were added after they saw that the equivilent |
trick was used very often and became hard to read/write. so the grammar
became more complex to make it more expressive for the humans, not the
computers. most people don't realize that almost all computer language
design is for the humans and not the computer. in fact most coding in
general is for people and not for computers. but that is never
emphasized which is a major loss.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: 20 Aug 2001 15:31:26 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: PerlMagick
Message-Id: <9lrage$c6a$2@bob.news.rcn.net>
Thomas Schneider <thoschne678@hotmail.com> wrote:
> Hi!
> I've got the following problem:
> $Image->Set('pixel[20,20]'=>'red'); # sets the pixel red
> but:
> $x=20, $y=20;
> $Image->Set('pixel[$x,$y,]'=>'red'); # doesn't
> What am I doing wrong?
Expecting variables to be interpolated into a single-quoted string, that's
what.
------------------------------
Date: Mon, 20 Aug 2001 17:18:39 GMT
From: John Porter <johndporter@yahoo.com>
Subject: Re: permuting extremely large string
Message-Id: <3B8145D4.DEFB44BF@yahoo.com>
Ilmari Karonen wrote:
> use Tie::CharArray;
> tie my @chars, 'Tie::CharArray', $string;
> # now permute @chars with the standard Fisher-Yates shuffle
Yes; but wouldn't it be significantly more efficient to
modify the F-Y shuffle to swap characters in the string
directly?
--
John Porter
------------------------------
Date: Mon, 20 Aug 2001 15:12:51 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: qw().
Message-Id: <3B81293E.AB669033@acm.org>
Thomas Bätzler wrote:
>
> On Sun, 19 Aug 2001, Seedkum Aladeem <seedkum-aladeem@home.com> wrote:
>
> >Can someone please tell me why the two programs below do not give the
> >same result?
>
> I guess that's already answered.
>
> But with regard to your code, have you considered replacing
>
> >chomp(@a);
> >foreach $b (@a){
> > $c = " " x 20 . $b;
> > $d = "z";
> > for ($i = 1; $i < 21; $i++){
> > $d = chop($c) . $d;
> > }
> > chop($d);
> > print "$d\n";
> >}
>
> with a simple "print map { ' 'x(21-length $_).$_ } @a;"?
You call that simple? :-)
printf "%20s\n", $_ for @a;
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 20 Aug 2001 17:42:15 +0200
From: "B. Caligari" <bcaligari@fireforged.com>
Subject: Re: simple
Message-Id: <9lrasb022re@enews2.newsguy.com>
"John W. Krahn" <krahnj@acm.org> wrote in message
news:3B8122F7.F7DABF09@acm.org...
> Tassos Chatzithomaoglou wrote:
> >
> > the output i'm getting is like this:
> >
> > str4 str1-str2 str3 str5 str9 str10 str11
> > str4 str1-str2 str3 str5 str9 str10 str11 str12
> > str4 str1-str2 str3 str5 str9 str10 str11 str12 str13 str14
> > str4 str1-str2 str3 str5 str9 str10
> >
> > PS: each line's str is different (str1 on line1 is different from str1
on line2)
> > and each line contains different number of strings (line1 contains 11
strings, line2 contains 12 strings....)
> >
> > How can i implement this in perl?
>
>
> perl -lane'print"$F[3]\t$F[0]-$F[1] $F[2] $F[4] @F[8..22]"'
>
>
everyday one learns something new :-) I like it.
perl -lane'print"$F[3]\t$F[0]-@F[1,2,4,8..22]"'
B.
------------------------------
Date: Mon, 20 Aug 2001 17:44:15 +0200
From: "B. Caligari" <bcaligari@fireforged.com>
Subject: Re: simple
Message-Id: <9lrb030236c@enews2.newsguy.com>
> perl -lane'print"$F[3]\t$F[0]-$F[1] $F[2] $F[4] @F[8..22]"'
>
>
perl -lane'print"$F[3]\t$F[0]-@F[1,2,4,8..$#F]"'
------------------------------
Date: Mon, 20 Aug 2001 16:59:44 GMT
From: John Porter <johndporter@yahoo.com>
Subject: Re: simple
Message-Id: <3B814165.772AE294@yahoo.com>
Tassos Chatzithomaoglou wrote:
>
> I'm sure something similar will have been answered in this newsgroup, but
> i didn't manage to find it :-(.
>
> So here is my question:
>
> I have the following (awfull) awk script :
>
> awk '{print $4 "\t" $1 "-" $2 " " $3 " " $5 " " $9 " " $10 " " $11 " " $12 " " $13 " " $14 " " $15 " " $16 " " $17 " " $18 " " $19 " " $20 " " $21 " " $22 " " $23}'
I would point out that that can be more cleanly written in awk as
print $4 "\t" $1 "-" $2, $3, $5, $9, $10, $11, $12, $13, $14, $15,
$16, [etc.]
assuming $OFS has not been changed from its default.
Now, here's OWTDI in perl:
sub sep::TIESCALAR { bless [ ' ', "\t", '-' ], $_[0] }
sub sep::FETCH { shift @{$_[0]} || ' ' }
while (<>) {
tie $", 'sep';
split;
print "@_[3,0,1,2,4,8..$#_]\n";
}
--
John Porter
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.
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 V10 Issue 1570
***************************************