Skip to content

Instantly share code, notes, and snippets.

@yappo
Created January 27, 2009 03:56
Show Gist options
  • Save yappo/53162 to your computer and use it in GitHub Desktop.
Save yappo/53162 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Test::More tests => 2;
do {
package Class1;
use Mouse;
has A => (
is => 'ro',
default => 'A',
);
has B => (
is => 'ro',
default => sub { $_[0]->A . ':B' },
);
package Class2;
use Mouse;
has B => (
is => 'ro',
default => 'A',
);
has A => (
is => 'ro',
default => sub { 'A:' . $_[0]->B },
);
};
my $obj1 = Class1->new;
is $obj1->B, 'A:B';
my $obj2 = Class2->new;
is $obj2->A, 'A:B';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment