Perl6::Pod::Parser::Context - Perl6::Pod::Parser::Context documentation


Perl6-Pod documentation  | view source Contained in the Perl6-Pod distribution.

Index


new [ <parent context ref>]

sub_context

create sub_context

config

return ref to hash of pod options per blockname

usef

return ref to hash of plugin per formatcode name

use

return ref to hash of perl module per blockname

custom

return ref to hash of user defined keys,vals

class_opts

return ref to hash of Class optioons to create loaded by use mods

set_use <module_name>, ':config_options'

encoding

return ref to hash of pod options per blockname

_opt2hash <pod opt string>

Convert pod opt string to hash

_hash2opt

Convert hash to opt string



    'we' => {
        'value' => '12 3 asdas a',
      'type'  => 'String'
    }







get_attr <block_type>

Get options for block_type in current context

    $c1->get_attr('item1');
=cut

sub get_attr { my $self = shift; my $btype = shift; return {} unless exists $self->config->{$btype}; my $hash = $self->_opt2hash( $self->config->{$btype} ); my %res = (); while ( my ( $key, $val ) = each %$hash ) { $res{$key} = $val->{value}; } return \%res; }

set_attr <block_type>, { attr1 =>1[, attr2=>2]}

Set options for block_type in current context

    $c1->set_attr('item1', { w=>[12] } );
=cut

#got array of attrs sub set_attr { my $self = shift; my $btype = shift;

    #get current state
    my $attr = shift;
    my %par  = ();
    while ( my ( $key, $val ) = each %$attr ) {
        $par{$key} = { value => $val };
    }
    my $opt = $self->_hash2opt(%par);
    $self->config->{$btype} = $opt;
    return $opt;
}

1; __END__

SEE ALSO

Top

http://zag.ru/perl6-pod/S26.html, Perldoc Pod to HTML converter: http://zag.ru/perl6-pod/, Perl6::Pod::Lib

AUTHOR

Top

Zahatski Aliaksandr, <zag@cpan.org>

COPYRIGHT AND LICENSE

Top


Perl6-Pod documentation  | view source Contained in the Perl6-Pod distribution.