ZConf::Cron::GUI - Implements a GUI for ZConf::Cron.


ZConf-Cron documentation Contained in the ZConf-Cron distribution.

Index


Code Index:

NAME

Top

ZConf::Cron::GUI - Implements a GUI for ZConf::Cron.

VERSION

Top

Version 0.0.0

SYNOPSIS

Top

    use ZConf::Cron::GUI;




    my $zcc=$ZConf::Cron->new;
    my $zccg=ZConf::Cron::GUI->new({zccron=>$zcc});




METHODS

Top

new

This initializes it.

One arguement is taken and that is a hash value.

hash values

zccron

This is a ZConf::Cron object to use. If it is not specified, a new one will be created.

zcgui

This is the ZConf::GUI object. If it is not passed, a new one will be created.

crontab

Allows the crontabs to be edited.

   $zccg->crontab;
   if($zccg->{error}){
       print "Error!\n";
   }

dialogs

This returns the available dailogs.

windows

This returns a list of available windows.

errorblank

This blanks the error storage and is only meant for internal usage.

It does the following.

    $self->{error}=undef;
    $self->{errorString}="";

DIALOGS

Top

ask

WINDOWS

Top

At this time, no windows are supported.

ERROR CODES

Top

1

This means ZConf errored.

2

Initializing ZConf::GUI failed.

3

Initializing ZConf::Cron failed.

4

Failed to initailize the primary backend.

5

Backend errored.

AUTHOR

Top

Zane C. Bowers, <vvelox at vvelox.net>

BUGS

Top

Please report any bugs or feature requests to bug-zconf-runner at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ZConf-Runner. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc ZConf::Cron::GUI




You can also look for information at:

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=ZConf-Cron

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/ZConf-Cron

* CPAN Ratings

http://cpanratings.perl.org/d/ZConf-Cron

* Search CPAN

http://search.cpan.org/dist/ZConf-Cron

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


ZConf-Cron documentation Contained in the ZConf-Cron distribution.
package ZConf::Cron::GUI;

use warnings;
use strict;
use ZConf::Cron;
use ZConf::GUI;

our $VERSION = '0.0.0';

sub new{
	my %args;
	if(defined($_[1])){
		%args= %{$_[1]};
	}

	my $self={error=>undef, errorString=>undef};
	bless $self;

	#initiates
	if (!defined($args{zccron})) {
		$self->{zcc}=ZConf::Cron->new();
	}else {
		$self->{zcc}=$args{zccron};
	}

	#handles it if initializing ZConf::Runner failed
	if ($self->{zcc}->{error}) {
		my $errorstring=$self->{zcc}->{errorString};
		$errorstring=~s/\"/\\\"/g;
		my $error='Initializing ZConf::Cron failed. error="'.$self->{zcc}->{error}
		          .'" errorString="'.$self->{zcc}->{errorString}.'"';
	    $self->{error}=3;
		$self->{errorString}=$error;
		warn('ZConf-Cron-GUI new:3: '.$error);
		return $self;		
	}

	$self->{zconf}=$self->{zcc}->{zconf};

	if (!defined($args{zcgui})) {
		#initializes the GUI
		$self->{gui}=ZConf::GUI->new({zconf=>$self->{zconf}});
		if ($self->{gui}->{error}) {
			my $errorstring=$self->{gui}->{errorString};
			$errorstring=~s/\"/\\\"/g;
			my $error='Initializing ZConf::GUI failed. error="'.$self->{gui}->{error}
		          .'" errorString="'.$self->{gui}->{errorString}.'"';
			$self->{error}=2;
			$self->{errorString}=$error;
			warn('ZConf-Cron-GUI new:2: '.$error);
			return $self;
		}
	}else {
		$self->{gui}=$args{zcgui};
	}


	$self->{useX}=$self->{gui}->useX('ZConf::Cron');

	my @preferred=$self->{gui}->which('ZConf::Cron');

	if (!defined($preferred[0])) {
		$self->{perror}=1;
		$self->{error}=4;
		$self->{errorString}='No backends located.';
		warn('ZConf-Cron-GUI new:4: '.$self->{errorString});
	}

	my $toeval='use ZConf::Cron::GUI::'.$preferred[0].';'."\n".
	           '$self->{be}=ZConf::Cron::GUI::'.$preferred[0].
			   '->new({zconf=>$self->{zconf}, useX=>$self->{useX},'.
			   'zcgui=>$self->{gui}, zccron=>$self->{zcc}}); return 1';

	my $er=eval($toeval);
	
	return $self;
}

sub crontab{
	my $self=$_[0];

	$self->errorblank;
	if ($self->{error}) {
		warn('ZConf-Cron-GUI crontab: A permanent error was set');
		return undef;
	}

	my $returned=$self->{be}->crontab;
	if ($self->{be}->{error}) {
		$self->{error}=5;
		$self->{errorString}='Backend errored. error="'.$self->{be}->{error}.
		                     '" errorString="'.$self->{be}->{errorString}.'"';
		warn('ZConf-Cron-GUI crontab:'.$self->{errorString});
	}

	return $returned;
}

sub dialogs{
	return ('crontab');
}

sub windows{
	return ();
}

#blanks the error flags
sub errorblank{
	my $self=$_[0];

	if ($self->{perror}) {
		warn('ZConf-Cron-GUI errorblank: A permanent error is set.');
		return undef;
	}

	$self->{error}=undef;
	$self->{errorString}="";

	return 1;
}

1; # End of ZConf::Cron::GUI