Sub::DeferredPartial::Attributes - A simple subroutine attribute handler.


Sub-DeferredPartial documentation Contained in the Sub-DeferredPartial distribution.

Index


Code Index:

NAME

Top

Sub::DeferredPartial::Attributes - A simple subroutine attribute handler.

AUTHOR

Top

Steffen Goeldner <sgoeldner@cpan.org>

COPYRIGHT

Top


Sub-DeferredPartial documentation Contained in the Sub-DeferredPartial distribution.

package Sub::DeferredPartial::Attributes;

our $VERSION = '0.01';

my %Subs = ();
# -----------------------------------------------------------------------------
sub import
# -----------------------------------------------------------------------------
{
  my $class  = shift;
  my $caller = shift || caller;
  my $isa    = $caller . '::ISA';

  push @$isa, $class;
}
# -----------------------------------------------------------------------------
sub MODIFY_CODE_ATTRIBUTES
# -----------------------------------------------------------------------------
{
  my $Pkg = shift;
  my $Sub = shift;

  $Subs{$Sub} = [ @_ ];

  return ();
}
# -----------------------------------------------------------------------------
sub Hash
# -----------------------------------------------------------------------------
{
  my $class = shift;
  my $Sub   = shift;
  my %Atts;

  @Atts{@{$Subs{$Sub}}} = ();

  return \%Atts;
}
# -----------------------------------------------------------------------------
1;