ZConf::Runner::GUI - Various GUI stuff for ZConf::Runner.


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

Index


Code Index:

NAME

Top

ZConf::Runner::GUI - Various GUI stuff for ZConf::Runner.

VERSION

Top

Version 1.0.1

SYNOPSIS

Top

This provides the ask dialog used by ZConf::Runner.

    use ZConf::Runner::GUI;

    my $zcr=ZConf::Runner->new();

METHODS

Top

new

This initializes it.

One arguement is taken and that is a hash value.

hash values

zcrunner

This is a ZConf::Runner 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.

ask

This is creates a dialog window asking what to do.

The first agruement is the action to be performed. The second is the file it is to be performed on. The third is an optional hash. It's accepted keys are as below.

hash args

Both hash args are currently required.

action

This is the action to be performed on the object.

object

This is the object to act on.

    my $returned=$zcr->ask({action=>'view', object=>'/tmp/test.rdf'});
    if($zcr->{error}){
        print "Error!\n";
    }else{
        if($returned){
            print "Action setup.\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::Runner 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::Runner




You can also look for information at:

* RT: CPAN's request tracker

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

* AnnoCPAN: Annotated CPAN documentation

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

* CPAN Ratings

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

* Search CPAN

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

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


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

use warnings;
use strict;
use ZConf::Runner;
use ZConf::GUI;

our $VERSION = '1.0.1';

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

	my $self={error=>undef, errorString=>undef, module=>'ZConf-Runner-GUI'};
	bless $self;

	#initiates
	if (!defined($args{zcrunner})) {
		$self->{zcr}=ZConf::Runner->new();
	}else {
		$self->{zcr}=$args{zcrunner};
	}

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

	$self->{zconf}=$self->{zcr}->{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-Runner-GUI new:2: '.$error);
			return $self;
		}
	}else {
		$self->{gui}=$args{zcgui};
	}

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

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

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

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

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

	$self->errorblank;

	my $returned=$self->{be}->ask(\%args);
	if ($self->{be}->{error}) {
		$self->{error}=5;
		$self->{errorString}='Backend errored. error="'.$self->{error}.'" '.
		                     'errorString=>"'.$self->{errorString}.'"';
		warn('ZConf-Runner-GUI ask:5: '.$self->{errorString});
		return undef;
	}

	return $returned;
}

sub dialogs{
	return ('ask');
}

sub windows{
	return ();
}

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

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

	return 1;
}

1; # End of ZConf::Runner