Skip to content

Instantly share code, notes, and snippets.

@melo
Last active July 7, 2017 23:36
Show Gist options
  • Save melo/48d9b6fd5cecff24bd296f8ecbef1025 to your computer and use it in GitHub Desktop.
Save melo/48d9b6fd5cecff24bd296f8ecbef1025 to your computer and use it in GitHub Desktop.
Perl setup
package MyClass;
use MySetup;
use Function::Parameters ();
use Moo ();
use namespace::sweep ();
use Scalar::Util ();
use Try::Tiny ();
use Import::Into;
sub import {
my $pkg = caller;
Function::Parameters->import({ func => 'function', method => 'method' });
Scalar::Util->import::into($pkg, qw(blessed));
Try::Tiny->import::into($pkg);
namespace::sweep->import(-cleanee => $pkg);
Moo->import::into($pkg);
goto &MySetup::import;
}
sub unimport {
splice(@_, 0, 1, 'Moo');
goto \&Moo::unimport;
}
1;
package MySetup;
use 5.014;
use strict ();
use warnings ();
use utf8 ();
use feature ();
use experimental ();
sub import {
warnings->import();
strict->import();
utf8->import();
feature->import(':5.14');
experimental->import('switch');
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment