FLTK::Preferences - Application preferences
Preferences are data trees containing a root, branches and leaves.
deleteEntry
my $gone = $preferences->deleteEntry( $entry );
Delete a group.
deleteGroup
my $removed = $preferences->deleteGroup( $group );
destroy
$preferences->destroy( );
Destroy individual keys.
Destroying the base preferences will flush changes to the prefs file. After destroying the base, none of the depending preferences must be read or written.
entries
my $count = $preferences->entries( );
Returns the number of entries (key/value) pairs for a group.
entry
my $key = $preferences->entry( $index );
Returns the name of an entry. There is no guaranteed order of entry names and $index must be within the range given by entries().
$index
entries()
entryExists
my $exists = $preferences->entryExists( $entry );
Returns 1, if a group with this name exists.
1
flush
$preferences->flush( );
Writes all preferences to disk. This method works only with the base preference group.
Note: This method is rarely used as the preferences flush automatically when destroy( ) is called or when the base preferences go out of scope.
destroy( )
get
my $value = $preferences->get( $key, $value, $defaultValue );
Get an entry (key/value) pair.
getUserdataPath
my $path = $preferences->getUserdataPath( );
Creates a path that is related to the preferences file and that is usable for application data beyond what is covered by Preferences.
group
my $name = $preferences->group( $index );
Returns the group name of the $indexth group. There is no guaranteed order of group names and $index must be within the range given by groups( ).
groups( )
groupExists
my $exists = $preferences->groupExists( $group );
groups
my $count = $preferences->groups( );
Returns the number of groups that are contained within a group.
new
my $tree = $preferences->new( $root, $vendor, $application );
Creates a new preferences object.
$root is a value representing either per machine (FLTK::Preferences::SYSTEM) or per user (FLTK::Preferences::USER) settings.
$root
FLTK::Preferences::SYSTEM
FLTK::Preferences::USER
vendor is the unique identification of the author or vendor of $application.
vendor
$application
Note: vendor must be a valid directory name.
$application is a vendor unique application name, for example, PreferencesTest. Multiple preferences files can be created per application.
PreferencesTest
Note: application name must be a valid file name.
my $node = $preferences->new( $parent, $group );
Creates a Preferences node in relation to a parent node for reading and writing
$parent is the base name for the group.
$parent
$group is a group name which may contain / separated group names.
$group
/
Example:
my $colors = FLTK::Preferences->new( $prefs, 'setup/colors' );
my $prefs = $preferences->new( $path, $vendor, $application );
Creates a Preferences object.
$path is an application-supplied path.
$path
set
my $okay = $preferences->set( $entry, $value );
Set an entry (key/value) pair.
size
my $length = $preferences->size( $key );
Returns the size of the value part of an entry.
Sanko Robinson <sanko@cpan.org> - http://sankorobinson.com/
Copyright (C) 2008-2010 by Sanko Robinson <sanko@cpan.org>
This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.
When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.
To install FLTK, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FLTK
CPAN shell
perl -MCPAN -e shell install FLTK
For more information on module installation, please visit the detailed CPAN module installation guide.