Matt S Trout > Rakudo-Star-2012.08_001 > dumper.pir

Download:
Rakudo-Star-2012.08_001.tar.gz

Annotate this POD

Source  

NAME ^

dumper.pir - PIR version of Perl 5's Data::Dumper module

VERSION ^

version 0.10

SYNOPSIS ^

    load_bytecode "dumper.pbc"

    # dump the $P0 register
    _dumper( $P0 )

    # dump the $P0 register, with "name"
    _dumper( $P0, "name" )

DESCRIPTION ^

PIR implementation of Perl 5's Data::Dumper module.

FUNCTIONS ^

This library provides the following functions:

_dumper( pmc, ?name, ?indent] )

This is the public (non object) interface to the dumper library.

pmc

Required. The PMC to dump.

name

Optional. The name of the PMC.

indent

Optional. The indent used at the start of each line printed.

Note: This function currently returns nothing. It should return the dumped data as a string, like Perl's Data::Dumper. Instead, everything is printed out using print.

Note: #2 Hash keys are now sorted using _sort() (sort.pir)

_register_dumper( id, sub )

Registers a dumper for new PMC type. EXCEPTION_UNIMPLEMENTED But see method __dump below.

id

the PMC id, as returned by the typeof op.

sub

a Sub pmc, that gets called in order to dump the content of the given PMC

For example:

    sub = find_name "_dump_PerlArray"
    _register_dumper( .PerlArray, sub )

This function returns nothing.

__dump(pmc dumper, str label) method

If a method __dump exists in the namespace of the class, it will be called with the current dumper object and the label of the PMC.

dumper =_global_dumper() (internal)

Internal helper function.

Returns the global dumper instance used by the non object interface.

AUTHOR ^

Jens Rieks <parrot at jensbeimsurfen dot de> is the author and maintainer.

syntax highlighting: