How can I overload the build in array type?



perl [http://search.cpan.org/~nwclark/perl-5.8.8/lib/overload.pm
overload] provides functionality for operators:

{{{
#!perl
use overload
'+' => \&myadd,
'-' => \&mysub;
# etc
...

}}}

is there a similar module to overload the classes of build in types
(like array), something like:

{{{
#!perl
use typeoverload
'@' => 'My::Array',
'%' => 'My::Hash';
# etc
...

}}}

-

(this question was already discussed within another topic. Just
posting a own thread to be sure the question gets the visibility on
it's own)

..

--
http://dev.lazaridis.com/lang/ticket/17

.



Relevant Pages

  • Regarding copy constructors and mutators
    ... One thing that confused me about Perl (no matter how often I read ... "perldoc overload" page and in the Camel book explain that overloading ... as a reference to an object or as an actual copy of an object. ... time for another clarification: ...
    (comp.lang.perl.misc)
  • Re: How can I use the string variable expansion for OO "$self->attribute"
    ... IL> perl [http://search.cpan.org/~nwclark/perl-5.8.8/lib/overload.pm ... IL> overload] provides functionality for operators: ... as i said before tie is for variables. ...
    (comp.lang.perl.misc)
  • Re: Equality operators
    ... > That should be do-able in pure Perl. ... Just invent a class of fuzzy ... > fuzzy, the overloaded method will be used. ... > can do what the overload documentation calls "overloading constants" ...
    (comp.lang.perl.misc)
  • Re: still crabby about copy constuctor craziness
    ... but the print statement never outputs anything. ... I had not overloaded anything in Perl until I read this ... sub new { ... use overload '++' => 'increment'; ...
    (comp.lang.perl.misc)
  • Re: How can I use the string variable expansion for OO "$self->attribute"
    ... perldoc.perl.org has all the docs and so does your own perl ... tie (perldoc perltie) is for replacing ... overload] provides functionality for operators: ...
    (comp.lang.perl.misc)