App-Basis

 view release on metacpan or  search on metacpan

lib/App/Basis/Config.pm  view on Meta::CPAN


Saves the config data, will not maintain any comments from the original file.
Will not perform save if no changes have been noted.

B<Parameter>
    filename        name of file to store config to, optional, will use object 
      instanced filename by default

=item get

Retrieve an item of config data. We use a unix style filepath to separate out 
the individual elements.

We can also use ':' and '.' as path sepators, so valid paths are

    /item/name/thing
    item.name.thing
    item:name:thing

The leading separator is not needed and is ignored.

If the path points to a complex config structure, ie array or hash, then that is
the data that will be returned.

B<Parameter>
    filepath        path to item to retrieve

    #get an item from the config data based on a unix style path
    my $value = $cfg->get( '/deep/nested/item') ;

    # this is the same as same as accessing the raw data
    my $data = $cfg->raw ;
    my $value = $data->{deep}->{nested}->{item} ;

=item set

Store an item into the config. 

    # set the value of an item into the config data based on a unix style path
    # this will mark the data as changed
    $cfg->set( '/deep/nested/item', 123) ;

    # same as accessing the raw_data, but this will not mark the data as changed
    # my $data = $cfg->raw ;
    $data->{deep}->{nested}->{item} = 123 ;
    # mark the data as changed, ready for a store operation
    $data->changed( 1) ;

B<Parameter>



( run in 1.546 second using v1.01-cache-2.11-cpan-39bf76dae61 )