Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: Functions to Methods

by Aragorn (Curate)
on Jun 14, 2004 at 13:32 UTC ( #366531=note: print w/ replies, xml ) Need Help??

in reply to Functions to Methods

I can use functions to work with them. If I'd like to treat them like objects I've to change them into objects
... push @$obj, qw ( 12 19 35 37 48 98 25 ); ...
Especially to handle the object as reference to the Array looks odd (of course it's nothing else than an blessed arrayref).
First, you want to use an array as an object. You define an array class. Then you use the 'functional' interface again, which makes it ugly. Why not define a push method and call that?
$obj->push(qw ( 12 19 35 37 48 98 25 ));
The way you're doing it now is a bit halfhearted.


Comment on Re: Functions to Methods
Select or Download Code
Replies are listed 'Best First'.
Re^2: Functions to Methods
by neniro (Priest) on Jun 14, 2004 at 13:41 UTC
    The way you're doing it now is a bit halfhearted.

    You're right. I haven't thought it to this point. I've to wrap all possible functions to methods. I've only seen the first step and missed the whole picture.

    Thank you,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://366531]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2015-11-26 00:12 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (693 votes), past polls