NAME
ZConf::GUI - A GUI backend chooser.
VERSION
Version 0.0.0
SYNOPSIS
Quick summary of what the module does.
Perhaps a little code snippet.
use ZConf::GUI;
my $zg = ZConf::GUI->new();
...
FUNCTIONS
new
This initiates it.
hash args
autoinit
If this is set to true, it will automatically call init the set and config. If this is set to false or not defined, besure to check '$zg->{init}' to see if the config/module has been initiated or not.
If it is not specified, it will default to true.
set
This specifies the initial set. It defaults to the default if not specified.
zconf
A already initialized ZConf object.
getPreferred
This gets the preferred for a module.
my @prefs=$zg->getPreferred('ZConf::Runner');
if($zg->{error}){
print "Error!\n";
}
getSet
This gets what the current set is.
my $set=$zg->getSet;
if($zg->{error}){
print "Error!\n";
}
hasPreferred
This checks to make sure a module has any prefences or not. The returned value is a perl bolean value.
my $returned=$zg->hasPreferred("ZConf::BGSet");
init
This initializes it or a new set.
If the specified set already exists, it will be reset.
One arguement is required and it is the name of the set. If it is not defined, ZConf will use the default one.
#creates a new set named foo
$zcw->init('foo');
if($zg->{error}){
print "Error!\n";
}
#creates a new set with ZConf choosing it's name
$zg->init();
if($zg->{error}){
print "Error!\n";
}
listAvailable
This is the available GUI modules for a module.
my @available=$zg->listAvailable('ZConf::Runner');
listModules
This lists configured modules.
my @modules=$zg->listModules;
if($zg->{error}){
print "Error!\n";
}
listSets
This lists the available sets.
my @sets=$zg->listSets;
if($zg->{error}){
print "Error!";
}
readSet
This reads a specific set. If the set specified is undef, the default set is read.
#read the default set
$zg->readSet();
if($zg->{error}){
print "Error!\n";
}
#read the set 'someSet'
$zg->readSet('someSet');
if($zg->{error}){
print "Error!\n";
}
rmPreferred
This removes a the preferences for a module.
$zg->rmPreferred('ZConf::BGSet');
if($zg->{error}){
print "Error:".$self->{error}.":".$self->{errorString};
}
setPreferred
This sets the preferred GUI back ends. The first arguement is the module. The second is a array reference of the prefences.
my @prefs=('GUI', 'Curses');
#set it for ZConf::BGSet
my $zg->setPreferred('ZConf::BGSet', \@prefs);
termAvailable
This checks to see if a terminal is available. It checks if $ENV{TERM} is set or not. If this is not set, it was most likely not ran from with a terminal.
if($zg->termAvailable){
print "a terminal is available";
}else{
print "no terminal is available";
}
Xavailable
This checks if X is available. This is checked for by trying to run '/bin/sh -c \'xhost 2> /dev/null > /dev/null\'' and is assumed if a non-zero exit code is returned then it failed and thus X is not available.
There is no reason to ever check $zcr->{error} with this as this function will not set it. It just returns a boolean value.
if($zg->Xavailable()){
print "X is available\n";
}
which
This chooses which should be used. This returns all available backends in order of preference.
my @choosen=$zg->which('ZConf::BGSet');
if($zg->{error}){
print "Error!";
}
print 'The primary preferred module is "'.$choosen[0].'"';
errorblank
This blanks the error storage and is only meant for internal usage.
It does the following.
$self->{error}=undef;
$self->{errorString}="";
ERROR CODES
1
ZConf error. Check $self->{zconf}->{error}.
2
No module specified.
3
No preferences specified.
4
A preference matched /:/.
5
No preferences for the listed module.
6
'list_modules' failed.
7
The specified module does not exist.
ZConf Keys
These are stored in config 'gui'.
Each preference is stored as a string for a module. Each preference is seperated as by ':'. The order of the preferred go from favorite to least favorite.
default
This is the default to use if nothing is setup for a module. The default value is 'GTK:Curses'.
modules/*
This contains the a list of preferences for a module. The module name is converted to a ZConf variable name by replacing '::' with '/'.
USING ZConf::GUI
A backend is considered to be any thing directly under <module>::GUI. How to call it or etc is directly up to the calling module though.
AUTHOR
Zane C. Bowers, <vvelox at vvelox.net>
BUGS
Please report any bugs or feature requests to bug-zconf-gui at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ZConf-GUI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc ZConf::GUI
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2009 Zane C. Bowers, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.