Params-Named

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Perl extension Params::Named

1.0.2 Thu Nov  3 12:29:09 GMT 2005
  * Changed PadWalker version dependency number.

1.0.1 Fri Oct 14 17:09:00 BST 2005
  * Fixed bug where MAPARGS got confused by a lexical declared multiple times.
  * Should now work with anonymous subs too.
  * Removed warning of no params mapped.
  * Added a warning for every parameter that is unmapped.
  * Much code refactoring (thanks Robin!).
  * Dropped List::Util dependency.
  
1.0.0 Tue Oct 11 11:42:57 BST 2005

META.yml  view on Meta::CPAN

# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
name:         Params-Named
version:      1.0.2
version_from: lib/Params/Named.pm
installdirs:  site
requires:
    PadWalker:                     1.0

distribution_type: module
generated_by: ExtUtils::MakeMaker version 6.17

Makefile.PL  view on Meta::CPAN

use ExtUtils::MakeMaker;

WriteMakefile(
  NAME         => 'Params::Named',
  VERSION_FROM => 'lib/Params/Named.pm',
  AUTHOR       => 'Dan Brook',

  PREREQ_PM    => {
    'PadWalker'     => '1.0',
  },
);

README  view on Meta::CPAN


   perl Makefile.PL
   make
   make test
   make install

DEPENDENCIES

This module requires these other modules and libraries:

  PadWalker

COPYRIGHT AND LICENCE

Copyright (C) 2005 Dan Brook

This code is distributed under the same copyright terms as Perl itself.

lib/Params/Named.pm  view on Meta::CPAN


$VERSION = '1.0.2';

require Exporter;
@ISA     = 'Exporter';
@EXPORT  = 'MAPARGS';

use strict;

use Carp      qw/croak carp/;
use PadWalker 'var_name';

sub VAR { return {qw/SCALAR $ ARRAY @ HASH % REF $/}->{ref $_[0]}.$_[1]; }

sub _set_param {
  my($p, $v, $n) = @_; # param, value, name
  return $$p = $v
    if ref $p eq 'SCALAR'
    && (ref $v || ref \$v) eq 'SCALAR' || (ref $v eq 'REF');
  return @$p = @$v
    if ref $p eq 'ARRAY' && ref $v eq 'ARRAY';

lib/Params/Named.pm  view on Meta::CPAN


=back

=head1 SEE. ALSO

L<Sub::Parameters>, L<Sub::Signatures>, L<Params::Smart>

=head1 THANKS

Robin Houston for bug spotting, code refactoring, idea bouncing and releasing
a new version of L<PadWalker> (is there anything he can't do?).
  
=head1 AUTHOR

Dan Brook C<< <cpan@broquaint.com> >>

=head1 COPYRIGHT

Copyright (c) 2005, Dan Brook. All Rights Reserved. This module is free
software. It may be used, redistributed and/or modified under the same
terms as Perl itself.

t/03multi_vars.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More tests => 3;

use Params::Named;

## Thanks to Robin Houston for this and the new version of PadWalker -
## http://use.perl.org/comments.pl?sid=28953&cid=43856

sub ick {
    MAPARGS \my($foo, $bar);
    {my $foo}
    return $foo;
}

my $val = eval { ick(foo => 42, bar => 1) };



( run in 0.884 second using v1.01-cache-2.11-cpan-05444aca049 )