Stefan Trcek > webrobot-0.81 > WWW::Webrobot::Properties

Download:
webrobot-0.81.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

WWW::Webrobot::Properties - Implements a config format like java.util.Properties

SYNOPSIS ^

    my $config = WWW::Webrobot::Properties->new(
        listmode => [qw(names auth_basic output http_header proxy no_proxy)],
        key_value => [qw(names http_header proxy)],
        multi_value => [qw(auth_basic)],
        structurize => [qw(load mail)],
    );
    my $cfg = $config->load_file($cfg_name, $cmd_param);

DESCRIPTION ^

This class implements a config format like java.util.Properties, see http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html for more docs.

Note: Some features are not implemented but there are some extensions for lists.

NOT IMPLEMENTED

 \uxxxx  Unicode characters

EXTENDED FORMAT

Listmode properties may be written

 listprop=value0
 listprop=value1
 listprop=value2

or

 listprop.0=value0
 listprop.1=value1
 listprop.2=value2

These properties are made available as perl-arrays.

METHODS ^

$wr = WWW::Webrobot::Properties -> new(%options);

Construct an object. Options marked (F) affect the semantics of the properties format. All options affect the internal representation in Perl. The syntax is

    option => [...]
listmode (F)

Multiple definitions enforce an array of options. Multiple definition options may (but needn't) be written with additional digits:

    names.1=xxx
    names.27=yyy

or

    names=xxx
    names=yyy

Thats for compatibility to java.util.Properties.

key_value (F)

Option value as 'key=value' deparsed.

    names = key=value
multi_value (F)
 Option value as '/v0/v1/v2/v3...' deparsed as array
                         / is any literal character
    names = /v0/v1/v2/v3/
structurize (-)

Common prefix options deparse as hash, e.g.

    load.num=xx
    load.base=yy

yields in the internal config format

    load => {num => "xx", base => "yy"}

For a complete guide of the semantics of the options see the tests t/properties.t.

syntax highlighting: