And indeed, they ought to die. Or be reimplemented. Or something,
but quite simply, don't use them. They'll break, they won't dwim,
and chances are they won't play nice with future/past versions of
Perl. Forget they even exist.
Details?
I'm using them with no problems in 5.005_03 (the real
I had already reached the same conclusion after I saw that
everyone would have to remember to say "my Dog $spot;" every time or the
whole thing falls apart.
Falls apart? How?
If you want something reasonably close, you could do what a lot of the
Template Toolkit code does and use arrays
On Tue, 23 Jan 2001, John Hughes wrote:
And indeed, they ought to die. Or be reimplemented. Or something,
but quite simply, don't use them. They'll break, they won't dwim,
and chances are they won't play nice with future/past versions of
Perl. Forget they even exist.
Details?
I'm
On Tue, 23 Jan 2001, John Hughes wrote:
I had already reached the same conclusion after I saw that
everyone would have to remember to say "my Dog $spot;" every time or the
whole thing falls apart.
Falls apart? How?
Because you miss one out and its a very difficult to find bug in your
(exists doesn't work).
Neither does delete.
Ok. But what should it do? What does it do for an array?
And overloading doesn't really work properly.
Details?
And reloading modules with phashes doesn't work right.
I steer clear of reloading, almost anything screws up.
And sub-hashes
On Tue, 23 Jan 2001, John Hughes wrote:
(exists doesn't work).
Neither does delete.
Ok. But what should it do? What does it do for an array?
But we're talking about hashes! At the very least it should make it so
that exists() returns false.
And overloading doesn't really work
At 11:36 23/01/2001 +0100, John Hughes wrote:
Neither does delete.
Ok. But what should it do? What does it do for an array?
perldoc -f delete
"In the case of an array, if the array elements happen to be at the end,
the size of the array will shrink to the highest element that tests true
for
On Tue, Jan 23, 2001 at 10:06:13AM +, Matt Sergeant wrote:
The only gain might be in a large DOM tree where there may be
thousands of objects. But then you're really better off using an
array based class instead (as I found out).
This is getting a bit off-topic, but I'm empirically found
On Tue, 23 Jan 2001, Robin Berjon wrote:
At 11:36 23/01/2001 +0100, John Hughes wrote:
Neither does delete.
Ok. But what should it do? What does it do for an array?
perldoc -f delete
"In the case of an array, if the array elements happen to be at the end,
the size of the array will
At 12:50 23/01/2001 +, Matt Sergeant wrote:
Thats only 5.6+ though. So its only useful for internal applications (if
at all).
True, but we've been using 5.6 (built from AS source) in production for
quite a while now very happily. Also, I'm seeing more and more customers
having it or ready to
On Tue, 23 Jan 2001, John Hughes wrote:
I had already reached the same conclusion after I saw that
everyone would have to remember to say "my Dog $spot;" every time or the
whole thing falls apart.
Falls apart? How?
If you forget the "Dog" part somewhere, it's slower than a normal
Until reading Conway's "Object Oriented Perl"
http://www.manning.com/Conway/
(section 4.3, pp 126-135) I hadn't heard about pseudo-hashes. I now
desire a data structure with non-numeric keys, definable iteration
order, no autovivification, and happy syntax. (And, of course,
fast-n-small :-)
On Mon, 22 Jan 2001, [EMAIL PROTECTED] wrote:
Well you've already seen I'm a detractor :-)
* Is anyone now using (under mod_perl) something they consider to be
superior but with similar functionality and interface?
Yes, a class which is a blessed array.
--
Matt/
/||** Director
At 18:05 22/01/2001 -0500, [EMAIL PROTECTED] wrote:
the Perl6 RPC "Pseudo-hashes must die!" and
And indeed, they ought to die. Or be reimplemented. Or something, but quite
simply, don't use them. They'll break, they won't dwim, and chances are
they won't play nice with future/past versions of
On Mon, 22 Jan 2001 [EMAIL PROTECTED] wrote:
(section 4.3, pp 126-135) I hadn't heard about pseudo-hashes. I now
desire a data structure with non-numeric keys, definable iteration
order, no autovivification, and happy syntax. (And, of course,
fast-n-small :-) Having Conway's blessing is nice
[EMAIL PROTECTED] (Perrin Harkins) wrote:
On Mon, 22 Jan 2001 [EMAIL PROTECTED] wrote:
(section 4.3, pp 126-135) I hadn't heard about pseudo-hashes. I now
desire a data structure with non-numeric keys, definable iteration
order, no autovivification, and happy syntax. (And, of course,
"Drew" == Drew Taylor [EMAIL PROTECTED] writes:
Drew I would like to return a single data structure, but order IS
Drew important (hence the current setup). I was thinking of using
Drew an array, where each element is a hash reference. So I would
Drew return something like this:
On 8 Jun 2000, Stephen Zander wrote:
"Drew" == Drew Taylor [EMAIL PROTECTED] writes:
Drew I would like to return a single data structure, but order IS
Drew important (hence the current setup). I was thinking of using
Drew an array, where each element is a hash reference. So I
Hello,
This doesn't directly relate to mod_perl, but I'd like to make this as
memory efficient as possible since it runs under mod_perl. :-)
I have a question about data structures. Currently, I am doing SQL
queries and returning an array ref and a hash ref. The array is to
preserve order, and
On Tue, 6 Jun 2000, Drew Taylor wrote:
I have a question about data structures. Currently, I am doing SQL
queries and returning an array ref and a hash ref. The array is to
preserve order, and the hash contains various bits of data about that
not to be dense, but can't you just issue an
Using tied hashes, you could conceivably make your own ordered hash class
and use that as the data structure you return. You'd still basically have
two data structures (for performance) but the fact that it is two data
structures would be hidden behind the tied hash which would be programmed
Using tied hashes, you could conceivably make your own ordered hash class
and use that as the data structure you return. You'd still basically have
two data structures (for performance) but the fact that it is two data
structures would be hidden behind the tied hash which would be programmed
At 12:39 PM 6/6/00 -0400, Drew Taylor wrote:
Hello,
This doesn't directly relate to mod_perl, but I'd like to make this as
memory efficient as possible since it runs under mod_perl. :-)
I have a question about data structures. Currently, I am doing SQL
queries and returning an array ref and a
On Tue, 6 Jun 2000, Eric Cholet wrote:
Using tied hashes, you could conceivably make your own ordered hash class
and use that as the data structure you return. You'd still basically have
two data structures (for performance) but the fact that it is two data
structures would be hidden
"Ken Y. Clark" wrote:
On Tue, 6 Jun 2000, Drew Taylor wrote:
I have a question about data structures. Currently, I am doing SQL
queries and returning an array ref and a hash ref. The array is to
preserve order, and the hash contains various bits of data about that
not to be dense,
Gunther Birznieks wrote:
Using tied hashes, you could conceivably make your own ordered hash class
and use that as the data structure you return. You'd still basically have
two data structures (for performance) but the fact that it is two data
structures would be hidden behind the tied hash
Eric Cholet wrote:
Using tied hashes, you could conceivably make your own ordered hash class
and use that as the data structure you return. You'd still basically have
two data structures (for performance) but the fact that it is two data
structures would be hidden behind the tied hash
On Tue, 6 Jun 2000, Drew Taylor wrote:
"Ken Y. Clark" wrote:
On Tue, 6 Jun 2000, Drew Taylor wrote:
I have a question about data structures. Currently, I am doing SQL
queries and returning an array ref and a hash ref. The array is to
preserve order, and the hash contains
Ken Miller wrote:
Well, if the keys are unique, you could just return a hashref, and then
access it using sorted keys:
foreach( sort keys %$HR ) {
## insert useful stuff here
}
If only I could just use sort. :-) The order could be completely
arbitrary, based on search parameters,
. | _| |
\|| _.-~-._.-~-._.-~-._@" _|\_|___|___|
-Original Message-
From: Drew Taylor [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 06, 2000 14:56
To: Ken Miller
Cc: modperl
Subject: Re: Data structure question
Ken Miller wrote:
Well, if the keys are unique, you could just r
Stas Bekman wrote:
and in perl5.6 it's called pseudohash (well it was known before but is
supported in 5.6)
http://www.perl.com/pub/doc/manual/html/pod/perldelta.html#Pseudo_hashes_are_supported
I know about pseudohashes - thanks to Damien again! :-). They look very
cool, but to be honest
Jerrad Pierce wrote:
you can use sort, of the values are hashes or indexes:
foreach ( sort { $a-{name} cmp $b-{name} keys %hash )
or
foreach ( sort { $a-[0] cmp $b-[0] keys %hash )
In this case I can't use sort since the order is completely arbitrary,
based on the SQL issued. Hence the
On Tue, 6 Jun 2000, Drew Taylor wrote:
I know about tied hashes - Thanks Damien for your excellent book! - but
there is a performance penalty. How big is this penalty? Is it worth
using tied hashes? Versus an array of hash refs?
They're a lot slower than normal data structures, or even normal
On Tue, 6 Jun 2000, Perrin Harkins wrote:
On Tue, 6 Jun 2000, Drew Taylor wrote:
I know about tied hashes - Thanks Damien for your excellent book! - but
there is a performance penalty. How big is this penalty? Is it worth
using tied hashes? Versus an array of hash refs?
They're a lot
Hi Drew,
How about writing a custom sort routine, based on the order you would be
using in the array, and returning that as a code ref? Sorting the hash
would be as simple as:
Common.pm:
sub
darren chamberlain wrote:
Hi Drew,
How about writing a custom sort routine, based on the order you would be
using in the array, and returning that as a code ref? Sorting the hash
would be as simple as:
In this case, it's overkill: the DB has already put the data together in
the order I
Stas Bekman wrote:
On Tue, 6 Jun 2000, Perrin Harkins wrote:
On Tue, 6 Jun 2000, Drew Taylor wrote:
I know about tied hashes - Thanks Damien for your excellent book! - but
there is a performance penalty. How big is this penalty? Is it worth
using tied hashes? Versus an array of
37 matches
Mail list logo