Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Raku question: "Moose is Perl", but it sure ain't Raku.

by duelafn (Vicar)
on Feb 12, 2020 at 12:46 UTC ( #11112864=note: print w/replies, xml ) Need Help??


in reply to Raku question: "Moose is Perl", but it sure ain't Raku.

There may be a better way, but you can do this by overriding new (and removing the title attribute from Employee::Former):

class Employee::Former is Employee { method new(*%params) { %params<title> //= 'Team Member'; return callwith(|%params); } method name_and_title { my $old = callsame; return "$old (Former)"; } }

Good Day,
    Dean

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11112864]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2020-05-31 16:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (175 votes). Check out past polls.

    Notices?