Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
use v5.14;
use strict;
use warnings;
package My::Role
{
use Moose::Role;
my $some_val;
sub has_my {
my ( $self, $value ) = @_;
$some_val //= $value;
return $some_val;
}
sub has_our {
my ( $self, $value ) = @_;
our $other_val //= $value;
return $other_val;
}
}
package Object1
{
use Moose;
with 'My::Role';
}
package Object2
{
use Moose;
with 'My::Role';
}
my $first = Object1->new;
my $second = Object2->new;
$first->has_my(7);
say $second->has_my;
$first->has_our(7);
say $second->has_our;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.