nonMoose override constructor parameter

[email protected] (Erik Colson)
Newsgroups perl.moose
Message-ID <[email protected]>
Hi,

I'm struggling with MooseX::NonMoose.

I have a class which inherits from a nonmoose class and all works fine. For this I have used FOREIGNBUILDARGS as follows.

package A;
...
sub FOREIGNBUILDARGS {
    my $class  = shift;
    my %args   = @_;
    my $title  = exists $args{title} ? $args{title} : "defaultTitle";
    return ( $title );
}

But now I want another class B to extend class A but having another default title. I figured I can do this by:
- overriding FOREIGNBUILDARGS but hence I don't want this because class B should not need any specific nonMoose code in it.
- defining the defaultTitle in a class sub and calling this sub in FOREIGNBUILDARGS for class A. Then override that sub in class B. This seems cleaner but does create some (little) overhead.

Is there any other way to achieve this behavior ?

thx
--
erik
signature.asc (application/pgp-signature, 455 B)
-----BEGIN PGP SIGNATURE-----

iQEcBAEBAgAGBQJOvqEoAAoJEIgjtVOAAL1G+54H/jsRHG2ppxMuhZhCK7wyyeo3
W7bD2mQMtaAiJRoy5jDQK4UOYaxLe1rDWkOK5TzdRj4mgu7//XYwQr0CbHvYfess
k8pO3hVBpM6ixaJFGLCACvdsnf/tdnok/tP11HOU6GZFOyaURaVnbwBQ+0JW9SY5
pc72Z3CYNDYhCmInVwcBLlCW1Ay6RrRNXgS9Dxq36j5INKmrTAFGPjSvrkwQcz16
+POvBuqPfvi4asawA674uH7kMva3+RAYfGntMcqO3+cWTMvtXvqKYzFPANcnzMpw
qNPnJ5d+G79RCeehq0u3srbAIF6yUiRuDkwCmQeGxsvtPV5awNRj0qOPQH+o0z0=
=d0AP
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.