public
Last active

Class::Tiny multiple inheritance?

  • Download Gist
miclasstiny.pl
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
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";

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.