Add single-term prototype
authorDavid Golden <dagolden@cpan.org>
Mon, 13 Sep 2010 00:26:43 +0000 (20:26 -0400)
committerDavid Golden <dagolden@cpan.org>
Thu, 21 Oct 2010 13:23:58 +0000 (09:23 -0400)
commitc035a075a240f10383292128a8d3f3746c4ac857
treea245d8f117b9636fe740448118a753e5457978c8
parent9061a8f72941979d02cbccb5cb18a2034813b6a7
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.
op.c
pod/perldelta.pod
pod/perlsub.pod
t/comp/proto.t
toke.c