[Pdx-pm] Subroutine Signatures

publiustemp-pdxpm at yahoo.com publiustemp-pdxpm at yahoo.com
Tue Dec 7 12:43:42 CST 2004


Hi all,

I've released a module to the CPAN which allows subroutine signatures
and multi-method dispatch
(http://search.cpan.org/~ovid/Sub-Signatures-0.11/).  Note this is
*alpha* code.  It is not yet ready for prime time.  Ignoring the fancy
terms, it allows you to do this:

  use Sub::Signatures 'strict';

  sub foo($bar, HASH $baz) {
    return exists $baz->{$bar};
  }

  sub foo($bar, ARRAY $baz) {
    return grep { $_ eq $bar } @$baz;
  }

Note that those two subs have the same name yet will be called based
upon the type and number of arguments (actually, the module defaults to
a 'loose' mode where dispatch is based solely on the number of
arguments.)

With one exception, all feedback I've received has been from people who
have apparently have not used the module.  If anyone is willing to try
this module out (not on production code, obviously :) and give me
feedback, I'd be quite grateful!

Cheers,
Ovid

=====
Silence is Evil            http://users.easystreet.com/ovid/philosophy/decency.html
Ovid                       http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/


More information about the Pdx-pm-list mailing list