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

use parent 'Some::Class' @import_list;

Thread Next
From:
Ovid
Date:
April 29, 2007 16:36
Subject:
use parent 'Some::Class' @import_list;
Message ID:
731465.45516.qm@web60815.mail.yahoo.com
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.

Cheers,
Ovid

--

Buy the book -- http://www.oreilly.com/catalog/perlhks/
Perl and CGI -- http://users.easystreet.com/ovid/cgi_course/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About