Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

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.


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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-02-25 16:21 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (314 votes). Check out past polls.