Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package MyClass;
- use Moose
- use Try::Tiny;
- use namespace::autoclean;
- BEGIN {
- if ( try { require Foo; 1 } ) {
- *bar = sub {
- my $self = shift;
- Foo::foo($self->baz);
- };
- } else {
- *bar = sub {
- ... # fallback implementation
- };
- }
- }
Add Comment
Please, Sign In to add comment