#! /usr/bin/perl
use warnings;
use strict;
use feature qw{ say };
{ package MyRole;
use Role::Tiny;
sub where { 'Role' }
sub role { 'yes' }
}
{ package MyClass;
sub new { bless {}, shift }
sub where { 'Class' }
}
{ package MyComposed;
use Role::Tiny::With;
with 'MyRole';
sub new { bless {}, shift }
sub where { 'Composed' }
}
my $c = 'MyComposed'->new;
say $c->$_ for qw( where role );
####
Composed
yes
####
{ package MyHeir;
use parent -norequire => 'MyClass';
use Role::Tiny::With;
with 'MyRole';
}
my $h = 'MyHeir'->new;
say $h->$_ for qw( where role );
####
Role
yes
####
my $o = 'MyClass'->new;
'Role::Tiny'->apply_roles_to_object($o, 'MyRole');
say $o->$_ for qw( where role );
####
{ package MyAround;
use Role::Tiny;
requires 'where';
around where => sub { 'Around' };
sub role { 'yes' }
}
my $o2 = 'MyClass'->new;
'Role::Tiny'->apply_roles_to_object($o2, 'MyAround');
say $o2->$_ for qw( where role );
####
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,