Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > moving class indepdent methods out of class definitions

Reply
Thread Tools

moving class indepdent methods out of class definitions

 
 
Rainer Weikusat
Guest
Posts: n/a
 
      03-07-2013
.... and into places where they can be reused by other classes,
including the possibility to 'overload' them in derived classes (not
necessarily sensible for class-independent code): Put them into a
package which exports them. Import them into the class package. That's
'roles in a nutshell' and the answer is actually so trivial (and
obvious) that I'm wondering why 'experienced perl programmers' ask
such questions.
 
Reply With Quote
 
 
 
 
Rainer Weikusat
Guest
Posts: n/a
 
      03-08-2013
Ben Morrow <(E-Mail Removed)> writes:

[...]

> Quoth Rainer Weikusat <(E-Mail Removed)>:
>> ... and into places where they can be reused by other classes,
>> including the possibility to 'overload' them in derived classes (not
>> necessarily sensible for class-independent code): Put them into a
>> package which exports them. Import them into the class package. That's
>> 'roles in a nutshell' and the answer is actually so trivial (and
>> obvious) that I'm wondering why 'experienced perl programmers' ask
>> such questions.

>
> [If you are referring to me, I have made no claims to be an experienced
> Perl programmer.]
>
> That's doable, certainly, and is indeed a simple-minded implementation
> of roles.


It is a way to move class independent code out of classes into
packages which enable this code to be used as methods by any class
which provides a 'suitable interface' for accessing 'instance state'
which works with plain Perl 5. I'll mark this as a 'possibly useful
idea' for future problems but so far, I haven't missed it.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
moving methods from class to instance of other class lars van gemerden Python 4 06-28-2012 06:15 PM
Is there a way to find the class methods of a class, just like'methods' finds the instance methods? Kenneth McDonald Ruby 5 09-26-2008 03:09 PM
Free Moving Estimate, Local Movers, Long Distance Moving, PackingSupplies, Storage Rental, Home Moving, Apartment Moving, Office Moving,Commercial Moving linkswanted ASP .Net 0 01-06-2008 04:45 AM
member templated definitions out of class scope George C++ 1 11-08-2007 07:55 PM
Implemenation Indepdent Way to Move LSByte of Char to MSB of Int, etc no spam C Programming 29 01-24-2005 04:06 AM



Advertisments