stop using excludes within moose, since it's no longer necessary
[gitmo/Moose.git] / t / cmop / random_eval_bug.t
CommitLineData
38bf2a25 1use strict;
2use warnings;
3
4use Test::More;
5
6use Class::MOP;
7
8=pod
9
064a13a3 10This tests a bug which is fixed in 0.22 by localizing all the $@'s around any
11evals.
12
13This a real pain to track down.
38bf2a25 14
15Moral of the story:
16
17 ALWAYS localize your globals :)
18
19=cut
20
21{
22 package Company;
23 use strict;
24 use warnings;
25 use metaclass;
26
27 sub new {
28 my ($class) = @_;
29 return bless {} => $class;
30 }
31
32 sub employees {
33 die "This didnt work";
34 }
35
36 sub DESTROY {
37 my $self = shift;
38 foreach
39 my $method ( $self->meta->find_all_methods_by_name('DEMOLISH') ) {
40 $method->{code}->($self);
41 }
42 }
43}
44
45eval {
46 my $c = Company->new();
47 $c->employees();
48};
49ok( $@, '... we die correctly with bad args' );
50
51done_testing;