[33088] in Perl-Users-Digest
Perl-Users Digest, Issue: 4364 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Feb 5 16:09:21 2015
Date: Thu, 5 Feb 2015 13:09:05 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 5 Feb 2015 Volume: 11 Number: 4364
Today's topics:
Re: Am I adding an unnecessary step? <rweikusat@mobileactivedefense.com>
Re: Am I adding an unnecessary step? <hjp-usenet3@hjp.at>
Re: Am I adding an unnecessary step? <rweikusat@mobileactivedefense.com>
Re: Am I adding an unnecessary step? <hjp-usenet3@hjp.at>
Re: Am I adding an unnecessary step? <jblack@nospam.com>
Re: Am I adding an unnecessary step? <rweikusat@mobileactivedefense.com>
Re: Am I adding an unnecessary step? <hjp-usenet3@hjp.at>
Re: Am I adding an unnecessary step? <rweikusat@mobileactivedefense.com>
Re: Am I adding an unnecessary step? <hjp-usenet3@hjp.at>
First time installing a CPAN module; questions on skipp <see.my.sig@for.my.address>
Re: First time installing a CPAN module; questions on s <gravitalsun@hotmail.foo>
Re: First time installing a CPAN module; questions on s <justin.1410@purestblue.com>
Re: First time installing a CPAN module; questions on s <rweikusat@mobileactivedefense.com>
Re: First time installing a CPAN module; questions on s <rweikusat@mobileactivedefense.com>
Re: First time installing a CPAN module; questions on s <hjp-usenet3@hjp.at>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 05 Feb 2015 18:09:35 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: Am I adding an unnecessary step?
Message-Id: <87wq3wp6w0.fsf@doppelsaurus.mobileactivedefense.com>
Mart van de Wege <mvdwege@gmail.com> writes:
> Rainer Weikusat <rweikusat@mobileactivedefense.com> writes:
>> Mart van de Wege <mvdwege@gmail.com> writes:
[...]
>>> There is nothing wrong with arrays and references on their own. The
>>> way you use combinations of both lead to lots of misunderstandings;
>>> especially for people just moving to perl or just beginning at all.
>>
>> Some examples of such 'misunderstandings' including why they're relevant
>> would be very enlightening here. But even with them, this is a weak
>> claim: Anything someone hasn't learned yet will be problematic for said
>> someone, universally 'throughout the universe'.
>>
> Yes, but Perl5 has a few pitfalls that users of other languages and
> newbies should be made aware of as soon as possible, before they get in
> a situation where misunderstandings will bite them in the ass.
>
> The main stumbling block is the fact that Perl5 does not have
> multidimensional arrays, meaning that for simple algorithms that need
> such the user is immediately confronted with learning references and how
> to use them; an intermediate-to-advanced concept in a lot of other
> languages.
The underlying issues here is that 'computer memory' is (usually)
organized as a vector/ 1D-array. While people might be inclined to
believe that 'a multidimensional array' is an elementary data structure,
in reality, "it ain't so": It's an advanced concept not directly
supported by the machine and because of this, it has to be emulated in
software.
At this point, 'we' get to one of the great mysteries of the human mind
(to the unmathematical me, at least): What I have available is support
for 1D-arrays and want I want to do is 'matrix operations' and not
manual memory management. Hence, the obvious solution (AFAIK also used
by every programming language under the sun) is to use an 1D array whose
size is the product of the sizes of all dimensions and then linearize my
n-D coordinates onto that. Extremely simple-minded implementation with a
small test program (there's doubtlessly something more sophisticated on
CPAN):
----------
package DimArray;
use constant DIMS => 0;
use constant A => 1;
our $check_access = 0;
sub check_access
{
my $self = shift;
my $dims;
$dims = $self->[DIMS];
die("too many indices") if @_ > @$dims;
for (0 .. $#_) {
die("index $_ out of range")
if $_[$_] < 0 || $_[$_] >= $dims->[$_];
}
}
sub new {
my ($class, @dims) = @_;
my @self;
$self[DIMS] = \@dims;
$self[A] = [];
return bless(\@self, $class);
}
sub aref : lvalue
{
my ($self, $ofs);
&check_access if $check_access;
$self = shift;
$ofs += $self->[DIMS][$_] * $_[$_] for 0 .. $#_ - 1;
$self->[A][$ofs + $_[$#_]];
}
sub set
{
my $self = shift;
@{$self->[A]} = @_;
}
package main;
my $sa = DimArray->new(2, 2, 2);
$sa->aref(1, 1) = -5;
print($sa->aref(1,1), "\n");
$sa->set(1, 2, 3, 4, 5, 6, 7, 8);
$sa->aref(0, 1, 1) = 13;
print($sa->aref(1, 1, 0), "\n", $sa->aref(0, 1, 1), "\n");
{
local $check_access = 1;
$sa->aref(1, 1, 10);
}
-----------
but instead of doing this and getting on with their calculations, what
people usually come up with is use arrays to the nth power (for this
case, an array holding references to arrays holding references to
arrays) and when trying to implement this, they end up with memory
management code eating all their hair ('frisst einem die Haare vom Kopf'
is a German semi-proverb for something much too complicated/ cumbersome
to be useful).
Why this?
> And your example of arrayref syntax is a fine one: unless you understand
> exactly what is going on, knowing when the use of -> is optional seems
> arbitrary.
In an artificial language, everything is arbitrary.
------------------------------
Date: Thu, 5 Feb 2015 20:11:00 +0100
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: Am I adding an unnecessary step?
Message-Id: <slrnmd7g24.p5e.hjp-usenet3@hrunkner.hjp.at>
On 2015-02-03 18:21, Rainer Weikusat <rweikusat@mobileactivedefense.com> wrote:
> ${${$$a[0]}[0]}{a}
>
> for accessing the value associated with a in
>
> $a = [[{ a => b }, {c => d}]]
>
> This is difficult to read and understand and very cumbersome to type if
> it occurs frequently, especially when using a non-US or even non-English
> keyboard layout. This was later rectified by allowing use of -> for such
> cases, leading to
>
> $a->[0]->[0]->{a}
>
> and even later by making the -> optional between bracketed subscripts,
> yielding
>
> $a->[0][0]{a}
[[citation needed]]
References were new in Perl 5.000, the latter syntax is documented for
Perl 5.003 (the oldest Perl5 version I can still find) and none of the
Changes files between 5.000 and 5.003 mention the new syntax, so I'm
fairly sure that this already worked in 5.000. So as far as official
releases are concerned, these three variants weren't "first", "later"
and "even later", they were available at the same time.
hp
--
_ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
|_|_) | | Man feilt solange an seinen Text um, bis
| | | hjp@hjp.at | die Satzbestandteile des Satzes nicht mehr
__/ | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
------------------------------
Date: Thu, 05 Feb 2015 19:33:32 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: Am I adding an unnecessary step?
Message-Id: <87h9v0p303.fsf@doppelsaurus.mobileactivedefense.com>
"Peter J. Holzer" <hjp-usenet3@hjp.at> writes:
> On 2015-02-03 18:21, Rainer Weikusat <rweikusat@mobileactivedefense.com> wrote:
>> ${${$$a[0]}[0]}{a}
>>
>> for accessing the value associated with a in
>>
>> $a = [[{ a => b }, {c => d}]]
>>
>> This is difficult to read and understand and very cumbersome to type if
>> it occurs frequently, especially when using a non-US or even non-English
>> keyboard layout. This was later rectified by allowing use of -> for such
>> cases, leading to
>>
>> $a->[0]->[0]->{a}
>>
>> and even later by making the -> optional between bracketed subscripts,
>> yielding
>>
>> $a->[0][0]{a}
>
> [[citation needed]]
>
> References were new in Perl 5.000, the latter syntax is documented for
> Perl 5.003 (the oldest Perl5 version I can still find)
http://mirrors.develooper.com/perl/historical-perl/
http://ftp.mj2.org/pub/historical/InfoMagic-CD/perl_tcl_tk/199409/perl/src/5.0/
The perl-5.000.tar.gz perlref.pod actually states that
3. The case of individual array elements arises often enough
that it gets cumbersome to use method 2. As a form of syntactic
sugar, the two lines like that above can be written:
$arrayref->[0] = "January";
$hashref->{"KEY} = "VALUE";
The left side of the array can be any expression returning a
reference, including a previous dereference. Note that
$array[$x] is NOT the same thing as "$array->[$x]" here:
$array[$x]->{"foo"}->[0] = "January";
This is one of the cases we mentioned earlier in which
references could spring into existence when in an lvalue
context. Before this statement, $array[$x] may have been
undefined. If so, it's automatically defined with a hash
reference so that we can look up "{"foo"}" in it. Likewise
"$array[$x]->{"foo"}" will automatically get defined with an
array reference so that we can look up "[0]" in it.
One more thing here. The arrow is optional BETWEEN brackets
subscripts, so you can shrink the above down to
$array[$x]{"foo"}[0] = "January";
And the tests contained in the perl5alpha3 tar-file (t/op/ref.t) suggest
that -> already existed by then, however, the "this becomes cumbersome
for ..." strongly suggests that the 'block returning references' syntax
predated -> (how could $person have noticed it becoming cumbersome
otherwise), as do the tests themselves, in particular,
# Test nested anonymous lists.
$ref = [[],2,[3,4,5,]];
print scalar @$ref == 3 ? "ok 14\n" : "not ok 14\n";
print $$ref[1] == 2 ? "ok 15\n" : "not ok 15\n";
print ${$$ref[2]}[2] == 5 ? "ok 16\n" : "not ok 16\n";
print scalar @{$$ref[0]} == 0 ? "ok 17\n" : "not ok 17\n";
print $ref->[1] == 2 ? "ok 18\n" : "not ok 18\n";
print $ref->[2]->[0] == 3 ? "ok 19\n" : "not ok 18\n";
Testing ${$$ref[2]}[2] and $ref->[2]->[0] is the same thing minus the
arrow syntax and the actual 2nd index. It couldn't find a test for
ommitting the arrow between bracketed subscripts.
------------------------------
Date: Thu, 5 Feb 2015 20:50:54 +0100
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: Am I adding an unnecessary step?
Message-Id: <slrnmd7icu.p5e.hjp-usenet3@hrunkner.hjp.at>
On 2015-02-04 08:12, Mart van de Wege <mvdwege@gmail.com> wrote:
> Rainer Weikusat <rweikusat@mobileactivedefense.com> writes:
>>
>>> Arrays and references are definitely one of Perl's legitimate ugly
>>> warts.
>>
>> I've read this about references a couple of times already, but only ever
>> as unsubstantiated assertion and usually from people with a strong air
>> of "programming language A sucks because it is different from
>> programming language B and I was already forced to learn B". I strongly
>> suspect that 'B' was usually Java and that this was the usual knee-jerk
>> rejection of anything unfamiliar because it's unfamiliar humans are
>> prone to.
>
> I'm none of those. I have no problem with references per se, but the way
> they interact with, for example, arrays, as in you *need* reference
> syntax to even do multidimensional arrays,
No, you don't. You can write stuff like
$a[0][1] = 2;
There is a reference involved, but no "reference syntax".
OTOH, you do need reference syntax even for passing one-dimensional
arrays to a function. Because of list-flattening, you can't write
sub foo {
my (@a, @b) = @_;
... $a[$i] ... $b[$j] ...
}
foo(@x, @y);
You need to explicitely pass references to arrays:
sub foo {
my ($a, $b) = @_;
... $a->[$i] ... $b->[$j] ...
}
foo(\@x, \@y);
> and the inconsistency of when the -> dereference operator is mandatory
Not much inconsistent about it. It is mandatory where the expression
would be ambiguous without it and can be omitted where it is unambiguous
(and the rule is simple: You can omit it between adjacent index
operators).
> is definitely not the very example of elegance.
The lack of elegance has, however, little to do with references, but
with list-flattening in the first case and with namespaces/sigils in the
second.
> It is true that a lot of complaints are echo-chamber rantings, but
> that's no reason to go the other way and deny that Perl5 has any warts
> at all.
Oh, Perl5 has plenty of warts. It's just that one person's wart is
another person's beauty mark.
hp
--
_ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
|_|_) | | Man feilt solange an seinen Text um, bis
| | | hjp@hjp.at | die Satzbestandteile des Satzes nicht mehr
__/ | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
------------------------------
Date: Thu, 5 Feb 2015 14:13:23 -0600
From: John Black <jblack@nospam.com>
Subject: Re: Am I adding an unnecessary step?
Message-Id: <MPG.2f3d8adb28d338bc989817@news.eternal-september.org>
In article <87wq3wp6w0.fsf@doppelsaurus.mobileactivedefense.com>,
rweikusat@mobileactivedefense.com says...
>
> Mart van de Wege <mvdwege@gmail.com> writes:
> > Rainer Weikusat <rweikusat@mobileactivedefense.com> writes:
> >> Mart van de Wege <mvdwege@gmail.com> writes:
> >
> > The main stumbling block is the fact that Perl5 does not have
> > multidimensional arrays, meaning that for simple algorithms that need
> > such the user is immediately confronted with learning references and how
> > to use them; an intermediate-to-advanced concept in a lot of other
> > languages.
>
> The underlying issues here is that 'computer memory' is (usually)
> organized as a vector/ 1D-array. While people might be inclined to
> believe that 'a multidimensional array' is an elementary data structure,
> in reality, "it ain't so": It's an advanced concept not directly
> supported by the machine and because of this, it has to be emulated in
> software.
>
> At this point, 'we' get to one of the great mysteries of the human mind
> (to the unmathematical me, at least): What I have available is support
> for 1D-arrays and want I want to do is 'matrix operations' and not
> manual memory management. Hence, the obvious solution (AFAIK also used
> by every programming language under the sun) is to use an 1D array whose
> size is the product of the sizes of all dimensions and then linearize my
> n-D coordinates onto that. Extremely simple-minded implementation with a
> small test program (there's doubtlessly something more sophisticated on
> CPAN):
>
> ----------
> package DimArray;
>
> use constant DIMS => 0;
> use constant A => 1;
>
> our $check_access = 0;
>
> sub check_access
> {
> my $self = shift;
> my $dims;
>
> $dims = $self->[DIMS];
> die("too many indices") if @_ > @$dims;
>
> for (0 .. $#_) {
> die("index $_ out of range")
> if $_[$_] < 0 || $_[$_] >= $dims->[$_];
> }
> }
>
> sub new {
> my ($class, @dims) = @_;
> my @self;
>
> $self[DIMS] = \@dims;
> $self[A] = [];
>
> return bless(\@self, $class);
> }
>
> sub aref : lvalue
> {
> my ($self, $ofs);
>
> &check_access if $check_access;
>
> $self = shift;
> $ofs += $self->[DIMS][$_] * $_[$_] for 0 .. $#_ - 1;
>
> $self->[A][$ofs + $_[$#_]];
> }
>
> sub set
> {
> my $self = shift;
> @{$self->[A]} = @_;
> }
>
> package main;
>
> my $sa = DimArray->new(2, 2, 2);
>
> $sa->aref(1, 1) = -5;
>
> print($sa->aref(1,1), "\n");
>
> $sa->set(1, 2, 3, 4, 5, 6, 7, 8);
>
> $sa->aref(0, 1, 1) = 13;
>
> print($sa->aref(1, 1, 0), "\n", $sa->aref(0, 1, 1), "\n");
>
> {
> local $check_access = 1;
> $sa->aref(1, 1, 10);
> }
> -----------
>
> but instead of doing this and getting on with their calculations, what
> people usually come up with is use arrays to the nth power (for this
> case, an array holding references to arrays holding references to
> arrays) and when trying to implement this, they end up with memory
> management code eating all their hair ('frisst einem die Haare vom Kopf'
> is a German semi-proverb for something much too complicated/ cumbersome
> to be useful).
I never cease to be amazed with how much time you seem to have on your hands... :-)
John Black
------------------------------
Date: Thu, 05 Feb 2015 20:40:17 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: Am I adding an unnecessary step?
Message-Id: <874mr0ozwu.fsf@doppelsaurus.mobileactivedefense.com>
John Black <jblack@nospam.com> writes:
> rweikusat@mobileactivedefense.com says:
[...]
> I never cease to be amazed with how much time you seem to have on your hands... :-)
You'd probably be seriously un-amazed had you anywhere as little time on
your hands as I do. But I type pretty fast ...
------------------------------
Date: Thu, 5 Feb 2015 21:40:58 +0100
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: Am I adding an unnecessary step?
Message-Id: <slrnmd7lau.hoh.hjp-usenet3@hrunkner.hjp.at>
On 2015-02-05 19:33, Rainer Weikusat <rweikusat@mobileactivedefense.com> wrote:
> "Peter J. Holzer" <hjp-usenet3@hjp.at> writes:
>> On 2015-02-03 18:21, Rainer Weikusat <rweikusat@mobileactivedefense.com> wrote:
>>> ${${$$a[0]}[0]}{a}
>>>
>>> for accessing the value associated with a in
>>>
>>> $a = [[{ a => b }, {c => d}]]
>>>
>>> This is difficult to read and understand and very cumbersome to type if
>>> it occurs frequently, especially when using a non-US or even non-English
>>> keyboard layout. This was later rectified by allowing use of -> for such
>>> cases, leading to
>>>
>>> $a->[0]->[0]->{a}
>>>
>>> and even later by making the -> optional between bracketed subscripts,
>>> yielding
>>>
>>> $a->[0][0]{a}
>>
>> [[citation needed]]
>>
>> References were new in Perl 5.000, the latter syntax is documented for
>> Perl 5.003 (the oldest Perl5 version I can still find)
>
> http://mirrors.develooper.com/perl/historical-perl/
> http://ftp.mj2.org/pub/historical/InfoMagic-CD/perl_tcl_tk/199409/perl/src/5.0/
>
> The perl-5.000.tar.gz perlref.pod actually states that
>
> 3. The case of individual array elements arises often enough
> that it gets cumbersome to use method 2. As a form of syntactic
> sugar, the two lines like that above can be written:
>
> $arrayref->[0] = "January";
> $hashref->{"KEY} = "VALUE";
[...]
> And the tests contained in the perl5alpha3 tar-file (t/op/ref.t) suggest
> that -> already existed by then,
As I expected.
> however, the "this becomes cumbersome for ..." strongly suggests that
> the 'block returning references' syntax predated -> (how could $person
> have noticed it becoming cumbersome otherwise),
You know, some people actually think about possible use cases before
implementing a feature.
hp
--
_ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
|_|_) | | Man feilt solange an seinen Text um, bis
| | | hjp@hjp.at | die Satzbestandteile des Satzes nicht mehr
__/ | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
------------------------------
Date: Thu, 05 Feb 2015 20:51:04 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: Am I adding an unnecessary step?
Message-Id: <87zj8snkuf.fsf@doppelsaurus.mobileactivedefense.com>
"Peter J. Holzer" <hjp-usenet3@hjp.at> writes:
> On 2015-02-05 19:33, Rainer Weikusat <rweikusat@mobileactivedefense.com> wrote:
>> "Peter J. Holzer" <hjp-usenet3@hjp.at> writes:
>>> On 2015-02-03 18:21, Rainer Weikusat <rweikusat@mobileactivedefense.com> wrote:
>>>> ${${$$a[0]}[0]}{a}
>>>>
>>>> for accessing the value associated with a in
>>>>
>>>> $a = [[{ a => b }, {c => d}]]
>>>>
>>>> This is difficult to read and understand and very cumbersome to type if
>>>> it occurs frequently, especially when using a non-US or even non-English
>>>> keyboard layout. This was later rectified by allowing use of -> for such
>>>> cases, leading to
>>>>
>>>> $a->[0]->[0]->{a}
>>>>
>>>> and even later by making the -> optional between bracketed subscripts,
>>>> yielding
>>>>
>>>> $a->[0][0]{a}
>>>
>>> [[citation needed]]
>>>
>>> References were new in Perl 5.000, the latter syntax is documented for
>>> Perl 5.003 (the oldest Perl5 version I can still find)
>>
>> http://mirrors.develooper.com/perl/historical-perl/
>> http://ftp.mj2.org/pub/historical/InfoMagic-CD/perl_tcl_tk/199409/perl/src/5.0/
>>
>> The perl-5.000.tar.gz perlref.pod actually states that
>>
>> 3. The case of individual array elements arises often enough
>> that it gets cumbersome to use method 2. As a form of syntactic
>> sugar, the two lines like that above can be written:
>>
>> $arrayref->[0] = "January";
>> $hashref->{"KEY} = "VALUE";
> [...]
>> And the tests contained in the perl5alpha3 tar-file (t/op/ref.t) suggest
>> that -> already existed by then,
>
> As I expected.
>
>> however, the "this becomes cumbersome for ..." strongly suggests that
>> the 'block returning references' syntax predated -> (how could $person
>> have noticed it becoming cumbersome otherwise),
>
> You know, some people actually think about possible use cases before
> implementing a feature.
You're suspicion is correct insofar as I described this in the order I
discovered it, however, I'm pretty certain that this was also the order
of implementation, for reasons already given (and I was already pretty
certain about this before writing the first text about 'reference
syntax'). This is, of course, a conjecture, as is "all the code
manifested itself in parallell without any need for experimentation ...
------------------------------
Date: Thu, 5 Feb 2015 22:06:19 +0100
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: Am I adding an unnecessary step?
Message-Id: <slrnmd7mqb.hoh.hjp-usenet3@hrunkner.hjp.at>
On 2015-02-05 18:09, Rainer Weikusat <rweikusat@mobileactivedefense.com> wrote:
> Mart van de Wege <mvdwege@gmail.com> writes:
>> The main stumbling block is the fact that Perl5 does not have
>> multidimensional arrays, meaning that for simple algorithms that need
>> such the user is immediately confronted with learning references and how
>> to use them; an intermediate-to-advanced concept in a lot of other
>> languages.
>
> The underlying issues here is that 'computer memory' is (usually)
> organized as a vector/ 1D-array. While people might be inclined to
> believe that 'a multidimensional array' is an elementary data structure,
> in reality, "it ain't so": It's an advanced concept not directly
> supported by the machine and because of this, it has to be emulated in
> software.
>
> At this point, 'we' get to one of the great mysteries of the human mind
> (to the unmathematical me, at least): What I have available is support
> for 1D-arrays and want I want to do is 'matrix operations' and not
> manual memory management. Hence, the obvious solution (AFAIK also used
> by every programming language under the sun) is to use an 1D array whose
> size is the product of the sizes of all dimensions and then linearize my
> n-D coordinates onto that.
Not everybody needs to do matrix multiplication. There are plenty of
nested datastructures which don't form an n-dimensional cuboid. I'd even
bet that us "unmathematical" types need those irregular structures much
more often.
> but instead of doing this and getting on with their calculations, what
> people usually come up with is use arrays to the nth power (for this
> case, an array holding references to arrays holding references to
> arrays) and when trying to implement this, they end up with memory
> management code eating all their hair ('frisst einem die Haare vom Kopf'
> is a German semi-proverb for something much too complicated/ cumbersome
> to be useful).
>
> Why this?
For some languages, like Perl, because the latter is already directly
supported and the hair-eating memory management code has already been
written by Other People(TM). Why should I write some code allocating
arrays and multiplying indexes if I can just write $a->[$i][$j][$k]?
In others, like C, which supports both styles, the former is simpler but
the latter is significantly more flexible. And, back in the times when
people still cared about that, it was also faster on many architectures
(memory access was slow, but a multiplication even slower - I remember
that we had to implement a data structure both ways in a programming
course. The example was intended to show a tradeoff between memory usage
and speed. But we didn't implement it in VAX assembler like the
instructor had done, but in 8086 assembler. Oops, the Iliffe vector was
both smaller and faster, lesson blown. But we learned another important
lesson: All the world is not a VAX!)
Finally, for a language designer, since Iliffe vectors can functionally
replace real multidimensional arrays, but not vice versa, it makes some
sense to implement only the former if you want to keep the number of
data types low.
hp
--
_ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
|_|_) | | Man feilt solange an seinen Text um, bis
| | | hjp@hjp.at | die Satzbestandteile des Satzes nicht mehr
__/ | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
------------------------------
Date: Thu, 05 Feb 2015 01:37:22 -0800
From: Robbie Hatley <see.my.sig@for.my.address>
Subject: First time installing a CPAN module; questions on skipped tests.
Message-Id: <vcWdnaJ1ZblZpE7JnZ2dnUVZ572dnZ2d@giganews.com>
I got a hankering to have statistics function calls available
so I don't have to write my own routines for mean, median, mode,
standard deviation, etc. So I downloaded a CPAN module:
Statistics::Descriptive as a "*.tar.gz" file.
This was my first time trying to install a CPAN module.
I unpacked the tar.gz, extracted the folder to
"/CPAN/Statistics-Descriptive-3.0608", read the README,
and ran the build, test, and install steps.
During the test phase, I got:
%./Build test
t/00-load.t ....................... 1/1 # Testing Statistics::Descriptive 3.0608, Perl 5.014004, /usr/bin/perl
t/00-load.t ....................... ok
t/cpan-changes.t .................. skipped: Test::CPAN::Changes required for this test
t/descr.t ......................... ok
t/descr_smooth_methods.t .......... ok
t/freq_distribution-1-rt-34999.t .. ok
t/median_absolute_deviation.t ..... ok
t/mode.t .......................... ok
t/outliers.t ...................... ok
t/pod-coverage.t .................. skipped: Test::Pod::Coverage 1.08 required for testing POD coverage
t/pod.t ........................... skipped: Test::Pod 1.22 required for testing POD
t/quantile.t ...................... ok
t/smoother.t ...................... ok
t/smoother_exponential.t .......... ok
t/smoother_weightedexponential.t .. ok
t/style-trailing-space.t .......... skipped: Test::TrailingSpace required for trailing space test.
All tests successful.
Files=15, Tests=117, 1 wallclock secs ( 0.02 usr 0.09 sys + 0.55 cusr 0.70 csys = 1.37 CPU)
Result: PASS
I ran the install phase even though some of the tests were skipped.
The install appeared to run correctly:
%./Build install
Building Statistics-Descriptive
Installing /usr/lib/perl5/site_perl/5.14/Statistics/Descriptive.pm
Installing /usr/lib/perl5/site_perl/5.14/Statistics/Descriptive/Smoother.pm
Installing /usr/lib/perl5/site_perl/5.14/Statistics/Descriptive/Smoother/Exponential.pm
Installing /usr/lib/perl5/site_perl/5.14/Statistics/Descriptive/Smoother/Weightedexponential.pm
Installing /usr/share/man/man3/Statistics.Descriptive.3pm
Installing /usr/share/man/man3/Statistics.Descriptive.Smoother.3pm
Installing /usr/share/man/man3/Statistics.Descriptive.Smoother.Exponential.3pm
Installing /usr/share/man/man3/Statistics.Descriptive.Smoother.Weightedexponential.3pm
Installing /usr/share/doc/perl/html/html3/site/lib/Statistics/Descriptive.html
Installing /usr/share/doc/perl/html/html3/site/lib/Statistics/Descriptive/Smoother.html
Installing /usr/share/doc/perl/html/html3/site/lib/Statistics/Descriptive/Smoother/Exponential.html
Installing /usr/share/doc/perl/html/html3/site/lib/Statistics/Descriptive/Smoother/Weightedexponential.html
Are there drawbacks to installing even though some tests were skipped?
Does it effect what gets installed during the install phase,
or is every part of the module installed regardless?
Is it worthwhile to install the missing modules listed by the test?
--
Cheers,
Robbie Hatley
Midway City, CA, USA
perl -le 'print "\154o\156e\167o\154f\100w\145ll\56c\157m"'
http://www.well.com/user/lonewolf/
------------------------------
Date: Thu, 05 Feb 2015 12:57:04 +0200
From: George Mpouras <gravitalsun@hotmail.foo>
Subject: Re: First time installing a CPAN module; questions on skipped tests.
Message-Id: <mavi91$27fk$1@news.ntua.gr>
> or is every part of the module installed regardless?
> Is it worthwhile to install the missing modules listed by the test?
>
you are ok
------------------------------
Date: Thu, 5 Feb 2015 12:32:29 +0000
From: Justin C <justin.1410@purestblue.com>
Subject: Re: First time installing a CPAN module; questions on skipped tests.
Message-Id: <tf4cqb-saj.ln1@zem.masonsmusic.co.uk>
On 2015-02-05, Robbie Hatley <see.my.sig@for.my.address> wrote:
> I got a hankering to have statistics function calls available
> so I don't have to write my own routines for mean, median, mode,
> standard deviation, etc. So I downloaded a CPAN module:
> Statistics::Descriptive as a "*.tar.gz" file.
I don't know what OS you're working on, but if you're on Linux your
distro may have a pre-packaged binary. For example, on Debian (I'd
expect Ubuntu and derivatives to be the same), you could install
that module with:
sudo apt-get install libstatistics-descriptive-perl
Unless you require a more recent version than your distro has
available this is likely the most simple method of getting the
modules you want.
Perl modules, under debian are always 'lib' then 'module name'
(susbtituting '::' for '-') and ending with '-perl'. For example:
libarchive-zip-perl is Archive::Zip
libdbd-mysql-perl is DBD::MySQL
A bonus of using your distro's pre-packaged version is that any
dependency issues and confilicts have been resolved for you.
One last reason to prefer the distro's package is that there is
a risk of breaking your system if you install a newer version of
a module the system relies upon, and it's not fully backward
compatible.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Thu, 05 Feb 2015 15:19:40 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: First time installing a CPAN module; questions on skipped tests.
Message-Id: <87vbjgqtbn.fsf@doppelsaurus.mobileactivedefense.com>
Robbie Hatley <see.my.sig@for.my.address> writes:
> I got a hankering to have statistics function calls available
> so I don't have to write my own routines for mean, median, mode,
> standard deviation, etc. So I downloaded a CPAN module:
> Statistics::Descriptive as a "*.tar.gz" file.
>
> This was my first time trying to install a CPAN module.
You might want to consider using 'the cpan shell' for this which also
provides 'nice features' like installing dependencies automatically. The
traditional way of doing so is
perl -MCPAN -e shell
As usual for 'open sausageware', whenever someone would otherwise be
required to learn something which seems a little outlandish in his eyes,
he'll sets of to "reimplement it all from scratch and Do It Right This
Time[tm]", so, a number of alternatives exist, happily deprecating each
other in circles, but I didn't use any of these so far.
> During the test phase, I got:
I'd usually skip that entirely: If the code doesn't work for me, I'll
notice this soon enough, and whether or not it works in some artificial
environment solely intended for demonstrating that it does is no concern
of mine.
[...]
> t/cpan-changes.t .................. skipped: Test::CPAN::Changes
> required for this test
It is standard practice to include a Changes file in your
distribution. The purpose the Changes file is to help a user
figure out what has changed since the last release. People have
devised many ways to write the Changes file. A preliminary
specification has been created (CPAN::Changes::Spec) to
encourage module authors to write clear and concise Changes.
This module will help users programmatically read and write
Changes files that conform to the specification.
[CPAN::Changes documentation]
Sounds useless to me.
[...]
> t/pod-coverage.t .................. skipped: Test::Pod::Coverage 1.08 required for testing POD coverage
Test::Pod::Coverage is used to create a test for your
distribution, to ensure that all relevant files in your
distribution are appropriately documented in pod.
...
> t/pod.t ........................... skipped: Test::Pod 1.22 required for testing POD
Test::Pod lets you check the validity of a POD file, and report its
results in standard Test::Simple fashion.
...
> t/style-trailing-space.t .......... skipped: Test::TrailingSpace required for trailing space test.
Test::TrailingSpace - test for trailing space in source files.
People who mistakenly believe that vim would be vi tend to obsess over
whitespace because the editor throws it into their face as if it was
anyhow important. Unless you have to accommodate them, this 'issue' can be
ignored.
------------------------------
Date: Thu, 05 Feb 2015 16:10:11 +0000
From: Rainer Weikusat <rweikusat@mobileactivedefense.com>
Subject: Re: First time installing a CPAN module; questions on skipped tests.
Message-Id: <87iofgqqzg.fsf@doppelsaurus.mobileactivedefense.com>
Justin C <justin.1410@purestblue.com> writes:
> On 2015-02-05, Robbie Hatley <see.my.sig@for.my.address> wrote:
>> I got a hankering to have statistics function calls available
>> so I don't have to write my own routines for mean, median, mode,
>> standard deviation, etc. So I downloaded a CPAN module:
>> Statistics::Descriptive as a "*.tar.gz" file.
>
> I don't know what OS you're working on, but if you're on Linux your
> distro may have a pre-packaged binary. For example, on Debian (I'd
> expect Ubuntu and derivatives to be the same), you could install
> that module with:
[...]
> One last reason to prefer the distro's package is that there is
> a risk of breaking your system if you install a newer version of
> a module the system relies upon, and it's not fully backward
> compatible.
To put this into perspective: This is certainly possible, however, I've
been installing CPAN modules on versions of Debian since 1998 and this
has yet to happen to me.
------------------------------
Date: Thu, 5 Feb 2015 19:41:44 +0100
From: "Peter J. Holzer" <hjp-usenet3@hjp.at>
Subject: Re: First time installing a CPAN module; questions on skipped tests.
Message-Id: <slrnmd7ebc.p5e.hjp-usenet3@hrunkner.hjp.at>
On 2015-02-05 09:37, Robbie Hatley <see.my.sig@for.my.address> wrote:
> %./Build test
> t/00-load.t ....................... 1/1 # Testing Statistics::Descriptive 3.0608, Perl 5.014004, /usr/bin/perl
> t/00-load.t ....................... ok
> t/cpan-changes.t .................. skipped: Test::CPAN::Changes required for this test
> t/descr.t ......................... ok
> t/descr_smooth_methods.t .......... ok
> t/freq_distribution-1-rt-34999.t .. ok
> t/median_absolute_deviation.t ..... ok
> t/mode.t .......................... ok
> t/outliers.t ...................... ok
> t/pod-coverage.t .................. skipped: Test::Pod::Coverage 1.08 required for testing POD coverage
> t/pod.t ........................... skipped: Test::Pod 1.22 required for testing POD
> t/quantile.t ...................... ok
> t/smoother.t ...................... ok
> t/smoother_exponential.t .......... ok
> t/smoother_weightedexponential.t .. ok
> t/style-trailing-space.t .......... skipped: Test::TrailingSpace required for trailing space test.
> All tests successful.
> Files=15, Tests=117, 1 wallclock secs ( 0.02 usr 0.09 sys + 0.55 cusr 0.70 csys = 1.37 CPU)
> Result: PASS
>
>
> I ran the install phase even though some of the tests were skipped.
[...]
> Are there drawbacks to installing even though some tests were skipped?
Probably not. The programmer had to write code to explicitely skip those
checks, so they probably considered them in some way optional.
In this case it looks like all the skipped tests check some static
aspect of the module (does the Changes file conform to some guidelines,
is every method documented, are there trailing spaces in the source
code, ...). They are useful for the author before releasing the module,
but it doesn't really make much sense for the user to run them again.
There are other modules, where tests which can be skipped test some
optional functionality depending on the environment (e.g. access to the
internet, a database, etc.), third party software, or other factors.
This might be a problem if your environment changes between installation
and use (for example, you might plan to use a module together with a
certain database, but install the database after the module. Then you
might find out that the module doesn't actually work (correctly) with
your database only during use, not at install time).
> Does it effect what gets installed during the install phase,
> or is every part of the module installed regardless?
Normally the tests don't affect what is installed.
> Is it worthwhile to install the missing modules listed by the test?
If you write modules, Test::Pod and Test::Pod::Coverage are probably
helpful. If you want to publish them on CPAN, Test::CPAN::Changes might
also be a good idea. I'm not sure what problems Test::TrailingSpace is
supposed to help preventing (but I just discovered Test::Tabs - if you
have co-workers which use editors with strange tab settings, that might
be very useful).
hp
--
_ | Peter J. Holzer | Fluch der elektronischen Textverarbeitung:
|_|_) | | Man feilt solange an seinen Text um, bis
| | | hjp@hjp.at | die Satzbestandteile des Satzes nicht mehr
__/ | http://www.hjp.at/ | zusammenpaßt. -- Ralph Babel
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 4364
***************************************