ZConf::GUI - A GUI backend chooser.
Version 1.1.0
use ZConf::GUI; my $zg = ZConf::GUI->new(); ...
This initiates it.
One arguement is taken.
If this errors, it errors permanently.
A already initialized ZConf object.
my $zg=ZConf::GUI->new({ zconf=>$zconf }); if($zg->{error}){ print "Error!\n"; }
This gets the value for 'appendOthers'.
my $appendOthers=$zg->getAppendOthers; if($zg->{error}){ print "Error!\n"; }
This gets the preferred for a module.
my @prefs=$zg->getPreferred('ZConf::Runner'); if($zg->{error}){ print "Error!\n"; }
This gets what the current set is.
my $set=$zg->getSet; if($zg->{error}){ print "Error!\n"; }
This fetches if X should be used or not for a module.
$zcgui->getUseX('ZConf::Runner'); if($zcgui->{error}){ print "Error!"; }
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");
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"; }
This is the available GUI modules for a module.
my @available=$zg->listAvailable('ZConf::Runner');
This lists configured modules.
my @modules=$zg->listModules; if($zg->{error}){ print "Error!\n"; }
This lists the available sets.
my @sets=$zg->listSets; if($zg->{error}){ print "Error!"; }
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"; }
This removes a the preferences for a module.
$zg->rmPreferred('ZConf::BGSet'); if($zg->{error}){ print "Error:".$self->{error}.":".$self->{errorString}; }
This sets the value for append others.
Only one value is accepted and that is a boolean value.
$zg->setAppendOthers($boolean); if($zg->{error}){ print "Error!\n"; }
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);
This determines if X should be used or not. This only affects terminal related modules that respect this.
$zcgui->setUseX('ZConf::Runner', '1'); if($zcgui->{error}){ print "Error!"; }
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"; }
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"; }
This checks to see if a terminal interface should try to use X or not by trying to spawn a X terminal.
This calls getUseX and if it is true, it calls Xavailable and returns it's value.
my $useX=$zcgui->useX('ZConf::Runner');
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].'"';
This module Error::Helper for error handling.
ZConf error. Check $self->{zconf}->error.
No module specified.
No preferences specified.
A preference matched /:/.
No preferences for the listed module.
'list_modules' failed.
The specified module does not exist.
No value for what to set appendOthers to specified.
The value specified for appendOthers is not boolean.
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.
This is the default to use if nothing is setup for a module. The default value is 'GTK:Curses'.
If this is set to true, "1", when which is called, all the others will be appended after the list of available preferred ones.
If this is not defined, it will default to true.
This contains the a list of preferences for a module.
The module name is converted to a ZConf variable name by replacing '::' with '/'.
This is if a cuses module should use X or not. If it is true, it will pass
If if is not defined, it is set to true.
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.
Any module using this, should have it's widgets and dialogs use a single hash for all it's arguements. This is currently not a requirement, but will be in future versions for future automated calling.
This initiates a application. If it is called, it is not expected to return.
This quaries a module to check to see if it has a app.
This returns a array of dialogs that can be called. These interupt execution till returned.
This is a list of windows that can be created. These should return immediately after creating the window.
Zane C. Bowers, <vvelox at vvelox.net>
<vvelox at vvelox.net>
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.
bug-zconf-gui at rt.cpan.org
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
http://rt.cpan.org/NoAuth/Bugs.html?Dist=ZConf-GUI
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/ZConf-GUI
CPAN Ratings
http://cpanratings.perl.org/d/ZConf-GUI
Search CPAN
http://search.cpan.org/dist/ZConf-GUI
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.
To install ZConf::GUI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ZConf::GUI
CPAN shell
perl -MCPAN -e shell install ZConf::GUI
For more information on module installation, please visit the detailed CPAN module installation guide.