Guest User

Untitled

a guest
Apr 25th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. package MyClass;
  2. use Moose
  3.  
  4. use Try::Tiny;
  5.  
  6. use namespace::autoclean;
  7.  
  8. BEGIN {
  9. if ( try { require Foo; 1 } ) {
  10. *bar = sub {
  11. my $self = shift;
  12. Foo::foo($self->baz);
  13. };
  14. } else {
  15. *bar = sub {
  16. ... # fallback implementation
  17. };
  18. }
  19. }
Add Comment
Please, Sign In to add comment