git clone git@github.com:tobyink/misc-versioned-library-example-p5.git
cd misc-versioned-library-example-p5
curl -fsSL --compressed https://git.io/cpm | perl - install
perl -Ilocal example.pl
####
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
use portable::lib './lib';
use portable::alias 'Foo-1.0' => 'FooOld';
use portable::alias 'Foo-1.1' => 'Foo';
# Foo 1.0
my $bar = FooOld->new_bar( name => 'X', desc => 'Y' );
say $bar->desc;
# Foo 1.1 changed 'desc' to 'description'
$bar = Foo->new_bar( name => 'X', description => 'Y' );
say $bar->description;
####
use strict;
use warnings;
return {
version => '1.1',
class => {
'Bar' => {
has => {
'name' => { type => 'Str' },
'description' => { type => 'Str' },
},
},
},
}
####
'Bar' => {
has => {
'name' => { type => 'Str' },
'description' => { type => 'Str' },
},
can => {
'do_something' => sub { my $self = shift; return 42 },
},
},