Skip to content

Instantly share code, notes, and snippets.

@aanoaa
Created November 1, 2010 08:14
Show Gist options
  • Save aanoaa/657812 to your computer and use it in GitHub Desktop.
Save aanoaa/657812 to your computer and use it in GitHub Desktop.
inheritance test in moose
#!/usr/bin/env perl
package Foo;
use Moose;
has package => (
is => 'ro',
isa => 'Str',
default => __PACKAGE__
);
__PACKAGE__->meta->make_immutable;
package Bar;
use Moose;
extends 'Foo';
__PACKAGE__->meta->make_immutable;
package main;
use strict;
use warnings;
my $foo = Bar->new;
print $foo->package, "\n"; # why 'Foo'?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment