
Gives - Uses Want to add Perl types to subroutines

use Gives;
sub my_func : Gives('LIST') {
...
return @some_list;
}
@val = my_func(); # ok
$val = my_func(); # causes an error

This package uses Want to add some rudimentary context checking to subroutines. It allows you to avoid using a subroutine or method in the wrong context.
It does not check the type returned by the function. If you want to enforce return types, use Variable::Strict::Types. (You may be able to use both packages together.)
You specify the context using the Gives attribute:
sub my_func : Gives( @Contexts ) {
}
where @Contexts is a list of contexts accepted by Want (see the package documentation for valid contexts).

This is an experimental package. There may be bugs.
There may be incompatabilities with Class::Std.

Want Attribute::Context Sub::Context Attribute::Signature Attribute::Types Variable::Strict::Types

Robert Rothenberg <rrwo at cpan.org>
Feedback is always welcome. Please use the CPAN Request Tracker at http://rt.cpan.org to submit bug reports.

Copyright (c) 2006 Robert Rothenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.