Exporter-Handy

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    Define a module with exports

      package My::Utils;
      use Exporter::Handy -exporter_setup => 1;

      export(qw( foo $x @STUFF -strict_and_warnings ), ':baz' => ['foo'] );

      sub foo { ... }

      sub strict_and_warnings {
        strict->import;
        warnings->import;
      }

    Create a new module which exports all that, and more

      package My::MoreUtils;
      use My::Utils -exporter_setup => 1;
      sub util_fn3 : Export(:baz) { ... }

    Use the module

README.md  view on Meta::CPAN

Define a module with exports

    package My::Utils;
    use Exporter::Handy -exporter_setup => 1;

    export(qw( foo $x @STUFF -strict_and_warnings ), ':baz' => ['foo'] );

    sub foo { ... }

    sub strict_and_warnings {
      strict->import;
      warnings->import;
    }

Create a new module which exports all that, and more

    package My::MoreUtils;
    use My::Utils -exporter_setup => 1;
    sub util_fn3 : Export(:baz) { ... }

Use the module

lib/Exporter/Handy.pm  view on Meta::CPAN

}


# === EXPORT OPTIONS ====

# PRAGMATA
# Remember: Pragmas effect the current compilation context.
# No need to keep track of where we are importing into...
# They require their ->import() method to be called directly, no matter how deep the call stack happens to be.
# Just call ->import() directly, like below, and it will do the right thing.
sub strict      : Export(-) { strict->import   }
sub warnings    : Export(-) { warnings->import }
sub utf8        : Export(-) { utf8->import     }

sub strictures  : Export(-) {
  strict->import;
  warnings->import
}

sub sane : Export(-) {
  utf8->import;
  strict->import;
  warnings->import;
}

# use Exporter::Handy qw(-sane -features), exporter_setup => 1;
sub features {
  my ($exporter, $arg)= @_;

  # default features to turn on/off
  my %feats = (
    'current_sub'     => 1, # Perl v5.16+ (2012) : enable __SUB__ token that returns a ref to the current subroutine (or undef).

lib/Exporter/Handy.pm  view on Meta::CPAN

Define a module with exports

  package My::Utils;
  use Exporter::Handy -exporter_setup => 1;

  export(qw( foo $x @STUFF -strict_and_warnings ), ':baz' => ['foo'] );

  sub foo { ... }

  sub strict_and_warnings {
    strict->import;
    warnings->import;
  }

Create a new module which exports all that, and more

  package My::MoreUtils;
  use My::Utils -exporter_setup => 1;
  sub util_fn3 : Export(:baz) { ... }

Use the module

lib/Exporter/Handy/Util.pm  view on Meta::CPAN

Define a module with exports

  package My::Utils;
  use Exporter::Handy -exporter_setup => 1;

  export(qw( foo $x @STUFF -strict_and_warnings ), ':baz' => ['foo'] );

  sub foo { ... }

  sub strict_and_warnings {
    strict->import;
    warnings->import;
  }

Create a new module which exports all that, and more

  package My::MoreUtils;
  use My::Utils -exporter_setup => 1;
  sub util_fn3 : Export(:baz) { ... }

Use the module



( run in 0.540 second using v1.01-cache-2.11-cpan-299005ec8e3 )