develooper Front page | perl.perl5.porters | Postings from April 2007

use parent 'Some::Class' @import_list;

Thread Next
April 29, 2007 16:36
use parent 'Some::Class' @import_list;
Message ID:
One thing I keep getting frustrated by is the following:

  use base 'Some::Class', @import_list;

That fails because everything in @import_list is interpreted as a
package name.  However, I find that a number of modules expect an
actual import list to customize the behavior of the class you're about
to instantiate.  As a result, I propose the following syntax:

  use parent 'Some::Class', @import_list;

That would be just like 'use base', but it allows import lists.  If you
(shudder) need multiple inheritance:

  use parent 'Some::Class', @import_list;
  use parent 'Class::Data::Inheritable'

This gets us much more flexibility.

The reason I post this to p5p is that I am loathe to introduce yet
another lower-case, top-level package name without touching base with
p5p on this idea.



Buy the book --
Perl and CGI --

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About