Skip to content

Instantly share code, notes, and snippets.

@rjbs
Created November 17, 2009 22:20
Show Gist options
  • Save rjbs/237325 to your computer and use it in GitHub Desktop.
Save rjbs/237325 to your computer and use it in GitHub Desktop.
abusing prototype() for API version
# if ($obj->can('foo')) { ... }
# if ($obj->can('foo', $api_version)) { ... }
# if ($obj->can('foo', $api_version, $minor_version)) { ... }
use strict;
use Number::Nary qw(n_codec);
my $major = 10;
my $minor = 5;
my ($enc, $dec) = n_codec('$@%');
my $mj = $enc->($major);
my $mn = $enc->($minor);
prototype($sub) = ($major . ';' . $minor);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment