Created
June 29, 2009 20:21
-
-
Save schwern/137778 to your computer and use it in GitHub Desktop.
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
package Foo; | |
use strict; | |
use warnings; | |
use parent 'signatures'; | |
require Method::Signatures; | |
sub proto_unwrap { | |
my $class = shift; | |
return Method::Signatures->parse_sub( proto => $_[0] ); | |
} | |
1; | |
-------------------------------------- | |
package Bar; | |
require Foo; | |
sub import { | |
my $class = shift; | |
my $caller = caller; | |
Foo->setup_for($caller); | |
} | |
1; | |
------------------------------------------- | |
#!/usr/bin/perl -w | |
use Bar; | |
{ | |
sub foo() {} | |
} | |
{ | |
sub bar($foo=42) {} | |
} | |
{ | |
sub named( :$foo ) { | |
return $foo . " and stuff"; | |
} | |
} | |
print foo(); | |
print bar(); | |
print named( foo => "things" ); | |
__END__ | |
Malformed prototype for main::named: :$foo at /Users/schwern/tmp/test.plx line 22. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment