In perl.git, the branch dagolden/single-term-prototype has been created

<http://perl5.git.perl.org/perl.git/commitdiff/ea84dc7846692ae06dab43c0c7ead08ae9e6175f?hp=0000000000000000000000000000000000000000>

        at  ea84dc7846692ae06dab43c0c7ead08ae9e6175f (commit)

- Log -----------------------------------------------------------------
commit ea84dc7846692ae06dab43c0c7ead08ae9e6175f
Author: David Golden <[email protected]>
Date:   Sun Sep 12 20:26:43 2010 -0400

    Add single-term prototype
    
    The C<+> prototype is a special alternative to C<$> that will act like
    C<\...@%]> when given a literal array or hash variable, but will otherwise
    force scalar context on the argument.  This is useful for functions which
    should accept either a literal array or an array reference as the argument:
    
        sub smartpush (+@) {
            my $aref = shift;
            die "Not an array or arrayref" unless ref $aref eq 'ARRAY';
            push @$aref, @_;
        }
    
    When using the C<+> prototype, your function must check that the argument
    is of an acceptable type.
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to