Last active
December 26, 2015 21:59
-
-
Save ggl/7219790 to your computer and use it in GitHub Desktop.
Class::Tiny multiple inheritance?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Blah; | |
use strict; | |
use warnings; | |
use Class::Tiny qw(blah); | |
sub bla { | |
my ($oh, @ah) = @_; | |
return join(' ', ucfirst($oh->blah), @ah); | |
} | |
1; | |
package Argh; | |
use strict; | |
use warnings; | |
use Class::Tiny qw(argh); | |
sub arg { | |
return uc($_[0]->argh); | |
} | |
1; | |
package Oh; | |
use strict; | |
use warnings; | |
use parent -norequire, 'Blah', 'Argh'; | |
use Class::Tiny qw(oh); | |
1; | |
package main; | |
my $b = Oh->new(blah => 'blablabla', argh => 'aargh!', oh => 'ohh!'); | |
print $b->bla('bla', 'blaaa!', $b->arg, $b->oh) . "\n"; | |
print Oh->isa('Blah') . ' ' . Oh->isa('Argh') . "\n"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment