Skip to content

Instantly share code, notes, and snippets.

@andyjones
Created January 22, 2015 12:35
Show Gist options
  • Save andyjones/343b88e0b57079525222 to your computer and use it in GitHub Desktop.
Save andyjones/343b88e0b57079525222 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use Test::More;
use Test::Fatal;
use Class::MOP;
use Class::MOP::Class;
{
package Foo;
use constant FOO_CONSTANT => 'Foo-CONSTANT';
}
my $Foo = Class::MOP::Class->initialize('Foo');
ok( $Foo->has_method('FOO_CONSTANT'),
'This succeeds when it is called before adding the bork method' );
my $bork_blessed = bless sub { }, 'Non::Meta::Class';
$Foo->add_method('bork', $bork_blessed);
ok( $Foo->has_method('FOO_CONSTANT'),
q{... this fails with the error message Can't locate object method "body" via package "Non::Meta::Class"} );
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment