Skip to content

Commit

Permalink
Manually added conflicted changes from jmazon.
Browse files Browse the repository at this point in the history
  • Loading branch information
chromatic committed Jul 23, 2010
1 parent 6d203ee commit 829111b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CREDITS
Expand Up @@ -110,3 +110,6 @@ E: xsawyerx@cpan.org

N: Paulo Custodio
E: pscust@cpan.org

N: Jean-Baptiste Mazon
E: ?
45 changes: 37 additions & 8 deletions sections/prototypes.pod
Expand Up @@ -44,20 +44,49 @@ array as a single unit so that C<push> can operate on the array in place.
X<prototype>
X<keywords; prototype>

C<prototype> takes the name of a function and returns a string representing its
prototype. If you cannot emulate that function (if it's a core keyword),
C<prototype> will return C<undef>. To see the prototype of a built-in keyword,
use the C<CORE::> form:
The builtin C<prototype> takes the name of a function and returns a string
representing its prototype.  To see the prototype of a built-in keyword,
use the C<CORE::> form:

=begin programlisting

=begin programlisting
    $ B<perl -E "say prototype 'CORE::push';">
    \@@
    $ B<perl -E "say prototype 'CORE::keys';">
    \%
    $ B<perl -E "say prototype 'CORE::open';">
    *;$@

=end programlisting

If you cannot emulate the prototype of a builtin (and some you can't!),
C<prototype> will return C<undef>:

=begin programlisting

    $ B<perl -E "say prototype 'CORE::system' // 'undef' ">
    undef
    # You can't emulate builtin function C<system>'s calling convention.

    $ B<perl -E "say prototype 'CORE::prototype' // 'undef' ">
    undef
    # Builtin function C<prototype> has no prototype.

=end programlisting

Look at C<push> again:

=begin programlisting

$ B<perl -E "say prototype 'CORE::push';">
\@@
    $ B<perl -E "say prototype 'CORE::push';">
    \@@

=end programlisting

The C<@> character represents a list. The backslash forces the use of a
I<reference> to the corresponding argument. Thus C<mypush> might be:
I<reference> to the corresponding argument. Thus this function takes a
reference to an array (because you can't take a reference to a list) and a list
of values. C<mypush> might be:

=begin programlisting

Expand Down
2 changes: 1 addition & 1 deletion sections/tie.pod
Expand Up @@ -9,7 +9,7 @@ X<tying>
Overloading (L<overloading>) lets you give classes custom behavior for specific
types of coercions and accesses. A similar mechanism exists for making
variables act like built-in types (scalars, arrays, and hashes), but with more
specific behaviors. This mechanism uses the C<tie> keyword; it is C<tying>.
specific behaviors. This mechanism uses the C<tie> keyword; it is I<tying>.

The original use of C<tie> was to produce a hash stored on disk, rather than in
memory. This allowed the use of dbm files from Perl, as well as the ability to
Expand Down

0 comments on commit 829111b

Please sign in to comment.