KOBAYASHI, Hiroaki

NAME

MOP4Import::Opts - Object to encapsulate caller() record

SYNOPSIS

  # To import the type 'Opts' and m4i api functions.
  use MOP4Import::Opts;

  # To create an instance of MOP4Import::Opts.
  sub import {
    ...
    my Opts $opts = m4i_opts([caller]);
    ...
  }

  # To extract MOP4Import::Opts safely from pragma args.
  sub declare_foo {
    (my $myPack, my Opts $opts, my (@args)) = m4i_args(@_);
    ...
  }

DESCRIPTION

This hash object encapsulates caller() info and other parameters for MOP4Import::Declare family.

ATTRIBUTES

callpack

scalar caller() of import in usual case.

destpkg

Where to export. Always defined.

objpkg

What to define. Optional.

basepkg

What to inherit. Optional.

extending

Used in MOP4Import::Types::Extend and MOP4Import::Declare::Type

caller

Original caller() info. This may be empty for faked m4i_opts().

filename
line

FUNCTIONS

m4i_args

This function converts $_[1] by m4i_opts and returns whole @_.

  (my $myPack, my Opts $opts, my (@args)) = m4i_args(@_);

m4i_opts

  my Opts $opts = m4i_opts([caller]);

  my Opts $opts = m4i_opts(scalar caller); # string is ok too.

METHODS

as_string

  $opts->as_string;

  "$opts"; # Same as above.

AUTHOR

Kobayashi, Hiroaki <hkoba@cpan.org>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.