Skip to content

Instantly share code, notes, and snippets.

@schwern
Created June 29, 2009 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schwern/137778 to your computer and use it in GitHub Desktop.
Save schwern/137778 to your computer and use it in GitHub Desktop.
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