8 use Test::More 'no_plan';
14 BEGIN { $tc = 'with::TestClass' }
16 sub foo { is($_[0], __PACKAGE__, __PACKAGE__ . '::foo was called'); }
17 sub baz { is($_[0], __PACKAGE__, __PACKAGE__ . '::baz was called'); }
20 # "use with \with::TestClass->new(id => 2, %cbs)" forces the evaluation of %cbs
21 # at compile time for constant folding, so we must define it in a BEGIN block.
22 BEGIN { %cbs = (is => \&Test::More::is); }
24 my $o1 = new with::TestClass id => 1, %cbs;
34 use with \with::TestClass->new(id => 2, %cbs);
50 foo $tc, q{1};bar $tc,
59 eval { bar 'main', 0 };
60 ok($@, 'wrong call croaks');