[30523] in Perl-Users-Digest
Perl-Users Digest, Issue: 1766 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 4 17:51:38 2008
Date: Mon, 4 Aug 2008 11:09:09 -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 Mon, 4 Aug 2008 Volume: 11 Number: 1766
Today's topics:
Re: CLPM - a help group? <worrall+unet@cs.bris.ac.uk>
Re: FAQ 4.2 Why is int() broken? <hjp-usenet2@hjp.at>
Re: FAQ 4.2 Why is int() broken? <hjp-usenet2@hjp.at>
Re: FAQ 4.2 Why is int() broken? <hjp-usenet2@hjp.at>
Re: FAQ 4.2 Why is int() broken? <szrRE@szromanMO.comVE>
Re: FAQ 4.36 How can I expand variables in text strings <whynot@pozharski.name>
having some trouble with character substitution/regX <pauls@nospam.off>
highly restrictive sub-classing xhoster@gmail.com
Re: highly restrictive sub-classing <smallpond@juno.com>
Re: Is there a way to spawn a program from perl that is <hjp-usenet2@hjp.at>
Re: match pattern ********* <someone@example.com>
Re: Trying to use my own module directory, but Perl doe <joe@inwap.com>
Re: Trying to use my own module directory, but Perl doe <ben@morrow.me.uk>
Re: Trying to use my own module directory, but Perl doe <hjp-usenet2@hjp.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 04 Aug 2008 10:40:10 -0700
From: Adam Worrall <worrall+unet@cs.bris.ac.uk>
Subject: Re: CLPM - a help group?
Message-Id: <%9Hlk.17313$mh5.1803@nlpi067.nbdc.sbc.com>
brian d foy wrote:
> In article <icg994pb2vv6t2dc5j5a725lhiv8a0tg6t@4ax.com>,
> <sln@netherlands.com> writes:
>
> > Whats the charter of this newsgroup?
> > Is it strictly Q&A?
According to the original charter, one may discuss anything Perl:
<ftp://ftp.isc.org/pub/usenet/control/comp/comp.lang.perl.gz>
From news@compass.com Thu May 23 13:40:31 1991
Path: rpi!think.com!compass!news
From: news@compass.com (news)
Newsgroups: comp.lang.perl.ctl
Subject: newgroup comp.lang.perl
Message-ID: <5624@compass.com>
Date: 23 May 91 16:14:05 GMT
Control: newgroup comp.lang.perl
Distribution: world
Organization: Compass, Inc., Wakefield, MA
Lines: 1
Approved: news@compass.com
Discussion of Larry Wall's Perl system.
And the .misc charter:
<ftp://ftp.isc.org/pub/usenet/control/comp/comp.lang.perl.misc.gz>
From tale@uunet.uu.net Mon May 8 16:46:29 1995
Path: uunet!tale
From: tale@uunet.uu.net (David C Lawrence)
Newsgroups: comp.lang.perl.misc
Subject: newgroup comp.lang.perl.misc
Control: newgroup comp.lang.perl.misc
Approved: tale@uunet.uu.net
Message-ID: <799965812.15343@uunet.uu.net>
Date: Mon, 8 May 1995 20:43:32 GMT
Lines: 12
Xref: uunet control:1996186
comp.lang.perl.misc is an unmoderated newsgroup which passed its
vote for creation by 328:48 as reported in news.announce.newgroups
on 1 May 1995.This group supersedes comp.lang.perl, which will be
removed on 8 Aug 1995.
For your newsgroups file:
comp.lang.perl.misc The Perl language in general.
The charter, culled from the call for votes:
Existing traffic in comp.lang.perl will migrate to
comp.lang.perl.misc, which will remain an unmoderated newsgroup for
discussion of issues of all sorts relating to perl.
> I've never seen an official charter for this group, but it certainly
> isn't a help desk. It's for general discussion of Perl. That might be
> questions, answers, essays, or whatever else people decide to post.
Please explain, who actually decides that it isn't a help? I never saw
Larry Wall state that in this group. It's not in the charter, which
actually says the opposite:
Existing traffic in comp.lang.perl will migrate to
comp.lang.perl.misc, which will remain an unmoderated newsgroup for
discussion of issues of all sorts relating to perl.
"discussion of issues of all sorts relating to perl", and help questions
fall into this category.
> People post the thoughtful stuff in blogs now, so you don't see much of
> that in usenet anymore.
Sigh... ain't that the truth.
> > Am I posting to the wrong group? Just what is this group for?
It's for "discussion of issues of all sorts relating to perl."
> It depends on what you are trying to acheive.
No, the only requirement to post here is if it's a Perl related question.
> If you're looking to learn perl, you probably want to move
> over to learn.perl.org and look at its discussion lists.
>
> If you want detailed discussions of the gory details of Perl, you might
> try PerlMonks.
I would say use the lists or nntp.perl.org, this news group, and the
'Monks list.
> clpm is what it is, despite what anyone tries to make it.
What I dislike it the arm-chair legislation that some people love to
impose; this notion that "this is not a help desk", for instance, is
bunk. It's not a _personal_ help desk, but in a sense, it is a public
volunteer based help desk, as people come and ask questions and often
someone answers them. I don't know how else you can describe a "help desk."
> If it doesn't, there's not much chance of making it into something else.
I think the ruling populous did that a long time ago.
- Adam
------------------------------
Date: Mon, 4 Aug 2008 13:44:42 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 4.2 Why is int() broken?
Message-Id: <slrng9dqta.gjl.hjp-usenet2@hrunkner.hjp.at>
On 2008-08-02 23:02, John W Kennedy <jwkenne@attglobal.net> wrote:
> Dave Stratford wrote:
>> In article <slrng8rg3a.pia.hjp-usenet2@hrunkner.hjp.at>,
>> Peter J. Holzer <hjp-usenet2@hjp.at> wrote:
>>
>>> Actually, I didn't write what "a typical computer" uses, just what
>>> happens when a binary system is used (which is what perl uses on most
>>> (all?) platforms - COBOL uses normally uses decimal).
>>
>> Obviously written by someone who doesn't know cobol at all well.
True. I only programmed in COBOL for about a year more than 20 years ago
(Microfocus Level II COBOL, IIRC).
>> Cobol has been able to use binary since at least 1974. That
>> 'normally' is completely wrong, by default cobol wants to use binary.
>> (at least since 1974 it has!)
>
> The COBOL language did not distinguish binary from decimal until 1985.
> Before that, most compilers for hardware that supported both bases
> supplied some kind of language extension. In IBM, the tradition was to
> use COMPUTATIONAL for binary and COMPUTATIONAL-3 for decimal
> (COMPUTATIONAL-1 and COMPUTATIONAL-2 already being used for floating
> point as a legacy from pre-360 systems).
I'm sure the compiler we used had a binary integer COMPUTATIONAL type,
maybe even a binary floating point type, but there was little reason to
use them in the type of application we were developing. In any case the
computational types felt like something tacked on as an afterthought - I
wouldn't have seen them as "default".
> In any case, all he said was "normally", which is true. Only an idiot
> uses binary for dollars and cents if decimal is available to him.
Right. You can, though - it just takes a little more thought.
hp
------------------------------
Date: Mon, 4 Aug 2008 14:22:20 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 4.2 Why is int() broken?
Message-Id: <slrng9dt3s.gjl.hjp-usenet2@hrunkner.hjp.at>
On 2008-08-01 21:00, szr <szrRE@szromanMO.comVE> wrote:
> Peter J. Holzer wrote:
>> On 2008-07-31 17:04, szr <szrRE@szromanMO.comVE> wrote:
>>> Peter J. Holzer wrote:
>>>> On 2008-07-29 15:57, szr <szrRE@szromanMO.comVE> wrote:
>>>>> Peter J. Holzer wrote:
>>>>>> On 2008-07-28 17:56, szr <szrRE@szromanMO.comVE> wrote:
>>>>>>> Granted, it's a calculator, but I have often wondered why it
>>>>>>> seems to be able to handle such calculations better than a CPU
>>>>>>> that's over 400 times faster.
[...]
>>>>>> Calculators are also rarely used for computations where accuracy
>>>>>> is much of an issue - 8 or 12 digits are enough. But they are
>>>>>> used by people who expect
>>>>>> 0.1 * 10 to be 1.0 but aren't overly surprised if 1/3*3 is
>>>>>> 0.9999999.
>>>>>
>>>>> Testing on a TI-89 (which does have a hefty amount of precision)
>>>>> entering "1/3*3.0" yields "1." and so does "0.1*10", and Perl seems
>>>>> to give the same results. On what hardware, language, or such, do
>>>>> you end up getting 0.99999.. from 1/3*3.0 ?
>>>>
>>>> For example on my HP-48 calculator. It uses 12 decimal places, so
>>>> 1/3 is
>>>> 0.333333333333. 0.333333333333 * 3 is clearly 0.999999999999.
>>>
>>> A TI-86 also uses 12 decimal places. But it depens how you enter
>>> things:
>>>
>>> 1/3
>>> .333333333333
>>> .333333333333 * 3
>>> .999999999999
>>>
>>> But:
>>>
>>> 123456789012345678901
>>> 1/3
>>> .333333333333
>>> Ans*3
>>> 1
>>>
>>> The 2nd example uses the build in "Ans" variable which always
>>> contains the result of the last computation, which can be more
>>> accurate than simply re-typing what was displayed.
>>>
>>> what happens if you enter "(1/3) * 3" instead of "0.333333333333 *
>>> 3" on your HP-48 ?
>>
>> I didn't enter 0.333333333333 * 3. I entered "1 ENTER 3 / 3 *". The
>> HP-48 uses Reverse Polish Notation. It also displays all digits
>> (unless told to display a rounded result), so that wouldn't make a
>> difference anyway.
>
> I hated those type of calculators. I think the difference is calculators
> like the TI 86/89 seems to have a threshold for determining if a number
> repeats ad infinitum. On the 86, if I type 0.333... with 12 decimal
> digits (12 "3"'s after the ".") and multiply by 3, it's ".999999999999",
> but if I add a 13th "3" and multiple by 3 it comes out as "1".
From what you wrote earlier I concluded that the TI-86 uses 14 decimal
digits internally, and displays only 12 (which is similar to the TI
calculators of 25 years ago, which used 11 digits internally and
displayed 8). So for the calculator 0.333333333333 and 0.3333333333333
are different numbers for the calculator, even if both are displayed as
0.333333333333. Multiply both by 3 and you get 0.999999999999 and
0.9999999999999 respectively. If the calculator displays 12 digits, it
can display 0.999999999999 exactly, but it needs to round
0.9999999999999: Since the first digit to be omitted is "9" it needs to
be rounded up, so the rounded value is 1.0. But the value which is
stored is still the correct value 0.9999999999999.
> It seems calculators like yours do not do this.
Right. The HP-48 displays the full result by default. It doesn't round
unless told.
> The TI-89 seems to be far better with this, though.
As I said, the TI-89 does symbolic algebra. But you could try:
1/3
Ans*3
Ans-1
(force to numeric representation after each step if the calculator
doesn't do it automatically)
And check the result.
>>> Mathetically, the TI-89 seems to get it more right, as (1/3)*3 = 1 is
>>> mathematically correct, as the 3 in the demoninator in of the first
>>> number and 3 in the numinator of the 2nd number (3/1) cancel each
>>> other out,
>>
>> Since the TI-89 can do symbolic algebra it may actually notice this
>> never compute 1/3.
>
> Either that or it uses a threshold algorithm like I described (either
> way the 89 seems to handle this far better than the 86.)
I don't think there's a threshold algorithm. Your example didn't show
one and it wouldn't work anyway.
>>> leaving 1/1 which is better writen as just plain ol' 1. Then 1-1
>>> is, of course, 0.
>>>
>>> I'm not sure why the TI-86 has such a strange result when "-1" is
>>> thrown in,
>>
>> I have been trying to explain it to you in just about every posting in
>> this thread. I give up.
>
> This was from only one reply up, so how could it have been from every
> posting?
Because the whole thread is about the fact that any floating point
representation has a fixed number of digits in a given base and can
therefore represent only a finite number of different values. It doesn't
matter whether you use base 2 or base 10 or base 42, whether you use 10
or 12 or 53 digits: Almost every result of a division must be rounded,
and therefore a/b*b is generally *not* a.
A decimal representation only has the psychological advantage of being
closer to what people expect.
> It just didn't occur to me that the 86 was internally had a
> value like 0.99999... which is smaller than zero.
It couldn't be anything else.
hp
------------------------------
Date: Mon, 4 Aug 2008 15:32:41 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: FAQ 4.2 Why is int() broken?
Message-Id: <slrng9e17p.gjl.hjp-usenet2@hrunkner.hjp.at>
On 2008-07-30 19:50, John W Kennedy <jwkenne@attglobal.net> wrote:
> Peter J. Holzer wrote:
>> On 2008-07-30 14:03, John W Kennedy <jwkenne@attglobal.net> wrote:
>>> However, Intel is dragging its feet on adding decimal floating point,
>>> per IEEE-754r.
>
>> If there truly is demand for this, then that's good for IBM. They can
>> sell lots of Power6 boxes.
>
> And z/Architecture.
z/Architecture isn't exactly mass-market.
> The very existence of this thread (and the fact that it grows out of a
> FAQ entry) is an illustration of the demand.
I think the demand cannot have been that great or it would have been
met. How many programming languages provide a native decimal type? Or
even a well-integrated library ("use decimal" in Perl similar to "use
bigint" etc. wouldn't be a big deal - but does it exist?). The 8-bit and
16-bit microprocessors of the 1970's often had special instructions to
help with decimal (BCD) arithmetic. Later designs didn't have them, or
if they kept them for binary compatibility (like the x86 series) they
were very slow and never used. (IEEE-754r may change that, but I
wouldn't hold my breath).
> At least since the first release of MS BASIC, this has been a problem;
> mathematical naļfs believe that reality is decimally quantized, and
> they always will, and, on the other hand, even fairly sophisticated
> people, including program-language designers, have problems dealing
> with noninteger fixed-point.
One of the reasons why decimal arithmetic never really caught on in
computing may be that the mathematicaly (or rather numerically) naive
not only have a problem with binary floating-point, they don't think
about these matters at all (if they did, they wouldn't be naive). So
they don't ask for decimal arithmetic (which would be easy to provide).
Those who do think about these matters conclude that either there's an
easy workaround (like scaling by a power of 10) or the problem wouldn't
actually become any simpler with decimal arithmetic, So they don't ask
for it either, much less implement it.
> (The original COBOL designers screwed the pooch so badly on this point
> that it took until 2002 to come up with an /optional/ fix.)
What's screwed about COBOL fixed point arithmetic?
hp
------------------------------
Date: Mon, 4 Aug 2008 09:42:25 -0700
From: "szr" <szrRE@szromanMO.comVE>
Subject: Re: FAQ 4.2 Why is int() broken?
Message-Id: <g77bhj01es@news4.newsguy.com>
Peter J. Holzer wrote:
> On 2008-08-01 21:00, szr <szrRE@szromanMO.comVE> wrote:
>> Peter J. Holzer wrote:
>>> On 2008-07-31 17:04, szr <szrRE@szromanMO.comVE> wrote:
>>>> Peter J. Holzer wrote:
>>>>> On 2008-07-29 15:57, szr <szrRE@szromanMO.comVE> wrote:
>>>>>> Peter J. Holzer wrote:
>>>>>>> On 2008-07-28 17:56, szr <szrRE@szromanMO.comVE> wrote:
>>>>>>>> Granted, it's a calculator, but I have often wondered why it
>>>>>>>> seems to be able to handle such calculations better than a CPU
>>>>>>>> that's over 400 times faster.
> [...]
>>>>>>> Calculators are also rarely used for computations where accuracy
>>>>>>> is much of an issue - 8 or 12 digits are enough. But they are
>>>>>>> used by people who expect
>>>>>>> 0.1 * 10 to be 1.0 but aren't overly surprised if 1/3*3 is
>>>>>>> 0.9999999.
>>>>>>
>>>>>> Testing on a TI-89 (which does have a hefty amount of precision)
>>>>>> entering "1/3*3.0" yields "1." and so does "0.1*10", and Perl
>>>>>> seems to give the same results. On what hardware, language, or
>>>>>> such, do you end up getting 0.99999.. from 1/3*3.0 ?
>>>>>
>>>>> For example on my HP-48 calculator. It uses 12 decimal places, so
>>>>> 1/3 is
>>>>> 0.333333333333. 0.333333333333 * 3 is clearly 0.999999999999.
>>>>
>>>> A TI-86 also uses 12 decimal places. But it depens how you enter
>>>> things:
>>>>
>>>> 1/3
>>>> .333333333333
>>>> .333333333333 * 3
>>>> .999999999999
>>>>
>>>> But:
>>>>
>>>> 123456789012345678901
>>>> 1/3
>>>> .333333333333
>>>> Ans*3
>>>> 1
>>>>
>>>> The 2nd example uses the build in "Ans" variable which always
>>>> contains the result of the last computation, which can be more
>>>> accurate than simply re-typing what was displayed.
>>>>
>>>> what happens if you enter "(1/3) * 3" instead of "0.333333333333 *
>>>> 3" on your HP-48 ?
>>>
>>> I didn't enter 0.333333333333 * 3. I entered "1 ENTER 3 / 3 *". The
>>> HP-48 uses Reverse Polish Notation. It also displays all digits
>>> (unless told to display a rounded result), so that wouldn't make a
>>> difference anyway.
>>
>> I hated those type of calculators. I think the difference is
>> calculators like the TI 86/89 seems to have a threshold for
>> determining if a number repeats ad infinitum. On the 86, if I type
>> 0.333... with 12 decimal digits (12 "3"'s after the ".") and
>> multiply by 3, it's ".999999999999", but if I add a 13th "3" and
>> multiple by 3 it comes out as "1".
>
> From what you wrote earlier I concluded that the TI-86 uses 14 decimal
> digits internally, and displays only 12 (which is similar to the TI
> calculators of 25 years ago, which used 11 digits internally and
> displayed 8). So for the calculator 0.333333333333 and 0.3333333333333
> are different numbers for the calculator, even if both are displayed
> as 0.333333333333. Multiply both by 3 and you get 0.999999999999 and
> 0.9999999999999 respectively.
Well, they are different numbers simply by having a different number of
digits.
> If the calculator displays 12 digits, it can display 0.999999999999
> exactly, but it needs to round 0.9999999999999: Since the first
> digit to be omitted is "9" it needs to be rounded up, so the
> rounded value is 1.0. But the value which is stored is still the
> correct value 0.9999999999999.
Yeah, I think that's pretty much what it does.
>> It seems calculators like yours do not do this.
>
> Right. The HP-48 displays the full result by default. It doesn't round
> unless told.
That can in fact be a good thing in some situations.
>> The TI-89 seems to be far better with this, though.
>
> As I said, the TI-89 does symbolic algebra. But you could try:
>
> 1/3
>
> Ans*3
>
> Ans-1
On the TI-89:
_________________________
1/3 1/3 Typed as: 1/3
1/3*3 1 Typed as: ans(1)*3
-1 -1 Typed as: ans(1)-1
_________________________
But, typing 1/3 it in with decimal points:
_________________________
1.
--- .333333333333 Typed as: 1./3.
3.
.333333333333*3 1. Typed as: ans(1)*3
.999999999999 - 1 Typed as: ans(1)-1
-1.E-14
_________________________
> (force to numeric representation after each step if the calculator
> doesn't do it automatically)
It goes to numeric when ever a decimal is thrown in. The 2nd example
works if you use "1/3+0.0", "1/3*1.0", etc, isntead of "1./3.". When no
decimal point is included around 1/3, then yeah it does seem to use
symbolic algebra, which imho is pretty nifty - get the best of both
worlds.
> And check the result.
See above examples :-)
>>>> Mathetically, the TI-89 seems to get it more right, as (1/3)*3 = 1
>>>> is mathematically correct, as the 3 in the demoninator in of the
>>>> first number and 3 in the numinator of the 2nd number (3/1) cancel
>>>> each other out,
>>>
>>> Since the TI-89 can do symbolic algebra it may actually notice this
>>> never compute 1/3.
>>
>> Either that or it uses a threshold algorithm like I described (either
>> way the 89 seems to handle this far better than the 86.)
>
> I don't think there's a threshold algorithm. Your example didn't show
> one and it wouldn't work anyway.
By "threshold", I meant the threshold where a calculator considers a
repetitive number to be infinitely-repetitive and act accordingly:
On a TI-86:
_____________________
.333333333333*3
.999999999999
.3333333333333*3
1
_____________________
I've seen such threshold algorithms used in math libs in the past. Hell,
I remember once writing a little bit of code for fun that did that sort
of thing for a dec2frac function of a Fraction class in C++. I'm going
to see if I can dig it up.
>>>> leaving 1/1 which is better writen as just plain ol' 1. Then 1-1
>>>> is, of course, 0.
>>>>
>>>> I'm not sure why the TI-86 has such a strange result when "-1" is
>>>> thrown in,
>>>
>>> I have been trying to explain it to you in just about every posting
>>> in this thread. I give up.
>>
>> This was from only one reply up, so how could it have been from every
>> posting?
>
> Because the whole thread is about the fact that any floating point
> representation has a fixed number of digits in a given base and can
> therefore represent only a finite number of different values. It
> doesn't matter whether you use base 2 or base 10 or base 42, whether
> you use 10 or 12 or 53 digits: Almost every result of a division must
> be rounded, and therefore a/b*b is generally *not* a.
Understood.
> A decimal representation only has the psychological advantage of being
> closer to what people expect.
Yeah, which is usually what they did on pencil and paper. Any one doing
that math that way would expect, for instance, that a/b*b == a, but
you're right that in binary this is not always the case because it
cannot be represented exactly.
>> It just didn't occur to me that the 86 was internally had a
>> value like 0.99999... which is smaller than zero.
>
> It couldn't be anything else.
That came out wrong. I meant 0.9999999... internally *while* displaying
1 (1 is greator than 0 while 0.99999... is not - that was the source of
the confusion before.)
--
szr
------------------------------
Date: Mon, 04 Aug 2008 10:14:05 +0300
From: Eric Pozharski <whynot@pozharski.name>
Subject: Re: FAQ 4.36 How can I expand variables in text strings?
Message-Id: <tqmim5xmel.ln2@carpet.zombinet>
brian d foy <brian.d.foy@gmail.com> wrote:
> In article <fc8cm5xnc2.ln2@carpet.zombinet>, Eric Pozharski
> <whynot@pozharski.name> wrote:
>> npc <npc@zomg.tk> wrote:
>> > On Fri, 01 Aug 2008 06:03:03 -0700, PerlFAQ Server wrote:
>> >> 4.36: How can I expand variables in text strings?
>> > I don't understand this faq entry. I'm probably misunderstanding
>> > it.
>> Never mind. It's a ping-pong FAQ.
> I'm not familiar with " ping-pong FAQ". Can you explain that?
That was paraphrased from C<ping-pong thread>. I admit, that this
particular entry doesn't go that far though.
>> [To FAQ maintainers]
>> >> $string = 'Say hello to $foo and $bar';
>> Did I miss something?
>> s/'/"/g;
> Yes, you missed the point of the question. It's a literal string that
> is exactly as it is typed. It is not a double quoted string because
> that would interpolate, so wouldn't be a literal string with a
> sequence of characters that look like a scalar variable name.
A-ha, now I see what I've missed. However than, please note that that
entry misses a bit of explanation why using C<qq()> doesn't count as
expansion.
--
Torvalds' goal for Linux is very simple: World Domination
------------------------------
Date: Mon, 04 Aug 2008 11:02:51 -0700
From: pauls <pauls@nospam.off>
Subject: having some trouble with character substitution/regX
Message-Id: <w9udnZ2Vftv22QrVnZ2dnUVZ_ojinZ2d@seanet.com>
I have a file that includes some directory paths and I want to use PERL
to change the file paths
I want to substitute this line of text:
.include '/doob/fred/bicmos/rev8/models/2010.11.07/hop/'
with this line of text:
.include 'D:/spi_models/TI/Hspice/'
and thought I would use the following code to do the job:
if (/include/)
{
s'/doob/fred/bicmos/rev8/models/2010.11.07/hop/'D:/spi_models/Tee/Hspice/';
}
but, the result is that the substitution does not occur.
Any ideas as to why, and how to fix it?
Thanks!
P.
------------------------------
Date: 04 Aug 2008 16:56:29 GMT
From: xhoster@gmail.com
Subject: highly restrictive sub-classing
Message-Id: <20080804125631.140$MA@newsreader.com>
I have a lot of scripts that use a memory-hungry module, but most of them
use only a small subset of that module's features, and it should be
possible to implement that subset in a more memory efficient way.
I want to "subclass" the memory hungry module. Many of the methods, ones
which are rarely used and can't be made memory efficient, will not be
implemented in the subclass.
I could define subs in the subclass for each such method, invoking croak or
die so the call doesn't get dispatched up the @ISA list. But I want the
default to lie the other way around, methods are unimplemented unless other
specified.
I guess I could walk the superclass's symbol table, automatically defining
a croaking sub for every subroutine in that symbol table unless they are in
my "implemented" list. But that seems rather hackish. Is there a better
way to do that?
Other options would be to *not* put the superclass in @ISA, and manually
redispatch calls to the superclass when that is the proper thing to do,
with unimplemented ones getting exceptions from Perl rather than explicit
ones. Is there some pitfall in doing this?
Or I could just do a complete code-fork and have the two modules completely
unrelated other than happening to have many method names in common. This
loses improvements made to the superclass. But since any new methods would
have to be manually inspected for compatibility before adding them to the
redispatch list anyway, I am not sure this is really a meaningful problem.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.
------------------------------
Date: Mon, 4 Aug 2008 11:07:14 -0700 (PDT)
From: smallpond <smallpond@juno.com>
Subject: Re: highly restrictive sub-classing
Message-Id: <8c739496-87d0-4148-bca4-47161592c6c4@x41g2000hsb.googlegroups.com>
On Aug 4, 12:56 pm, xhos...@gmail.com wrote:
> I have a lot of scripts that use a memory-hungry module, but most of them
> use only a small subset of that module's features, and it should be
> possible to implement that subset in a more memory efficient way.
>
> I want to "subclass" the memory hungry module. Many of the methods, ones
> which are rarely used and can't be made memory efficient, will not be
> implemented in the subclass.
>
> I could define subs in the subclass for each such method, invoking croak or
> die so the call doesn't get dispatched up the @ISA list. But I want the
> default to lie the other way around, methods are unimplemented unless other
> specified.
>
> I guess I could walk the superclass's symbol table, automatically defining
> a croaking sub for every subroutine in that symbol table unless they are in
> my "implemented" list. But that seems rather hackish. Is there a better
> way to do that?
>
> Other options would be to *not* put the superclass in @ISA, and manually
> redispatch calls to the superclass when that is the proper thing to do,
> with unimplemented ones getting exceptions from Perl rather than explicit
> ones. Is there some pitfall in doing this?
>
> Or I could just do a complete code-fork and have the two modules completely
> unrelated other than happening to have many method names in common. This
> loses improvements made to the superclass. But since any new methods would
> have to be manually inspected for compatibility before adding them to the
> redispatch list anyway, I am not sure this is really a meaningful problem.
>
> Xho
>
This is similar to CGI::Simple, which replaces CGI with lighter weight
code.
It takes the approach of not using CGI at all.
I guess it would depend on how much you wanted to call code from the
original module. If it is very little, then probably better to make
a clean break.
--S
------------------------------
Date: Mon, 4 Aug 2008 14:44:57 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Is there a way to spawn a program from perl that is independent?
Message-Id: <slrng9due9.gjl.hjp-usenet2@hrunkner.hjp.at>
On 2008-08-04 04:16, comp.lang.c++ <ced@blv-sam-01.ca.boeing.com> wrote:
> In Unix, you could background the other script in
> a subshell:
>
> 0 == system "(/path/to/other_script &)"
> or die "system failed: $?";
>
> But getting the return status of the backgrounded
> task would be messy
If you use open with mode '-|' or '|-' it isn't messy at all: close
returns the return status. It also avoids the additional shell. You need
to take care about the input or output, which may add some
complications.
hp
------------------------------
Date: Mon, 04 Aug 2008 13:50:38 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: match pattern *********
Message-Id: <OODlk.159415$gc5.49101@pd7urf2no>
Tad J McClellan wrote:
> Hartmut Camphausen <JustMe@somewhere.de> wrote:
>
>> (2) use the ...{}-quantifier, eg.
>>
>> /\*{5}/
>>
>> to match exactly 5 asterisks, or
>
>
> Or, if you are backslash-averse as I am, you can write it as:
>
> /[*]{5}/
Yes, but in Perl before 5.10 the backslashed version is more efficient.
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
------------------------------
Date: Mon, 04 Aug 2008 03:47:42 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Trying to use my own module directory, but Perl doesn't see @EXPORT
Message-Id: <5pidnU9iMe3QQwvVnZ2dnUVZ_vSdnZ2d@comcast.com>
David Filmer wrote:
> On Aug 3, 6:27 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
>> Shouldn't that be
>> package Filmer::Foo;
>
> Maybe it should be (I dunno) but it makes no difference when I try
> this suggestion, except the error message becomes
>
>>>> Undefined subroutine &Filmer::Foo::bar called at ...
Sounds like you neglected to mark bar() as being exportable in the module.
-Joe
------------------------------
Date: Mon, 4 Aug 2008 15:38:07 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Trying to use my own module directory, but Perl doesn't see @EXPORT
Message-Id: <frgjm5-su1.ln1@osiris.mauzo.dyndns.org>
Quoth David Filmer <usenet@davidfilmer.com>:
> On Aug 3, 6:29 pm, Ben Morrow <b...@morrow.me.uk> wrote:
>
> > You have created the file Filmer/Foo.pm but in this file you declare the
> > package Foo. 'use' assumes that file will declare the package
> > Filmer::Foo, so if you want ->import (and thus Exporter) to work, that
> > is what you will need to call the package.
>
> Ben - I sense the answer to my question is here, but I cannot quite
> see it. Would you kindly elaborate?
When you write
use Filmer::Foo qw/a b c/;
what Perl actually does is
- searches @INC for the file Filmer/Foo.pm, and loads it;
- calls Filmer::Foo->import(qw/a b c/), if such a method exists.
Exporter provides you with an implementation of ->import that exports
subs according to @EXPORT, @EXPORT_OK, &c.
See also perldoc -f use, perlmod, &c.
Ben
--
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk
------------------------------
Date: Mon, 4 Aug 2008 14:52:14 +0200
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: Trying to use my own module directory, but Perl doesn't see @EXPORT
Message-Id: <slrng9dus7.gjl.hjp-usenet2@hrunkner.hjp.at>
On 2008-08-04 04:35, David Filmer <usenet@davidfilmer.com> wrote:
> On Aug 3, 6:27 pm, Gunnar Hjalmarsson <nore...@gunnar.cc> wrote:
>> Shouldn't that be
>> package Filmer::Foo;
>
> Maybe it should be (I dunno) but it makes no difference when I try
> this suggestion, except the error message becomes
>
>>>> Undefined subroutine &Filmer::Foo::bar called at ...
Works for me:
yoyo:~ 14:48 163% mkdir -p /usr/local/lib/site_perl/Filmer
yoyo:~ 14:49 164% cat > /usr/local/lib/site_perl/Filmer/Foo.pm
package Filmer::Foo;
BEGIN {
use Exporter ();
our @ISA = qw(Exporter);
our @EXPORT = qw{ &bar };
}
sub bar {
return "Hello World\n";
}
1;
yoyo:~ 14:49 165% cat > tmp/foo
#!/usr/bin/perl
use Filmer::Foo;
print bar();
yoyo:~ 14:50 167% chmod +x tmp/foo
yoyo:~ 14:50 168% ./tmp/foo
Hello World
hp
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 1766
***************************************