forked from rafl/devel-declare
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure we keep working with Devel::CallParser loaded
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use warnings; | ||
use strict; | ||
|
||
BEGIN { | ||
eval { require Devel::CallParser }; | ||
if($@ ne "") { | ||
require Test::More; | ||
Test::More::plan(skip_all => "Devel::CallParser unavailable"); | ||
} | ||
} | ||
|
||
use Test::More tests => 1; | ||
|
||
use Devel::CallParser (); | ||
|
||
sub method { | ||
my ($usepack, $name, $inpack, $sub) = @_; | ||
no strict "refs"; | ||
*{"${inpack}::${name}"} = $sub; | ||
} | ||
|
||
use Devel::Declare method => sub { | ||
my ($usepack, $use, $inpack, $name) = @_; | ||
return sub (&) { ($usepack, $name, $inpack, $_[0]); }; | ||
}; | ||
|
||
method bar { | ||
return join(",", @_); | ||
}; | ||
|
||
is +__PACKAGE__->bar(qw(x y)), "main,x,y"; | ||
|
||
1; |