| ZConf-RSS documentation | Contained in the ZConf-RSS distribution. |
ZConf::RSS::GUI - Provides various GUI methods for ZConf::RSS.
Version 0.0.2
use ZConf::RSS::GUI;
my $zcrssGui = ZConf::RSS::GUI->new();
...
This is object returned by ZConf::RSS.
my $zcrssGui=ZConf::RSS::GUI->new({obj=>$obj});
if($zcrssGui->{error}){
print "Error!\n";
}
This invokes a dialog to add a new feed.
There is one optional arguement taken and it is the URL for the feed. This will be used to automatically populate URL feild in the dialog.
$zcrssGui->addFeed('http://foo.bar/rss.xml');
if($zcrssGui->{error}){
print "Error!\n";
}
Invokes the view window.
$zcrssGui->manage;
if($zcrssGui->{error}){
print "Error!\n";
}
Invokes the view window.
$zcrssGui->view;
if($zcrssGui->{error}){
print "Error!\n";
}
This returns a array of available dialogs.
my @dialogs=$zcrssGui->dialogs;
if($zcrssGui->{error}){
print "Error!\n";
}
This returns a array of available dialogs.
my @windows=$zcrssGui->windows;
if($zcrssGui->{error}){
print "Error!\n";
}
This blanks the error storage and is only meant for internal usage.
It does the following.
$self->{error}=undef;
$self->{errorString}="";
Failed to initiate ZConf::RSS.
Failed to initiate ZConf::GUI.
Failed to get the preferred.
Failed to initiate the backend.
Backend errored.
No backend found via ZConf::GUI->which.
This adds a new feed.
Please not that unless working directly and specifically with a backend, windows and dialogs are effectively the same in that they don't return until the window exits, generally.
This allows the RSS feeds to be viewed.
This allows the RSS feeds to be managed along with the templates.
Zane C. Bowers, <vvelox at vvelox.net>
Please report any bugs or feature requests to bug-zconf-devtemplate at rt.cpan.org, or through
the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=ZConf-RSS. I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc ZConf::RSS::GUI
You can also look for information at:
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.
| ZConf-RSS documentation | Contained in the ZConf-RSS distribution. |
package ZConf::RSS::GUI; use warnings; use strict; use ZConf::GUI; use ZConf::RSS;
our $VERSION = '0.0.2';
sub new{ my %args; if(defined($_[1])){ %args= %{$_[1]}; } my $function='new'; my $self={error=>undef, perror=>undef, errorString=>undef, module=>'ZConf-RSS-GUI', }; bless $self; #gets the object or initiate it if (!defined($args{obj})) { $self->{obj}=ZConf::RSS->new; if ($self->{obj}->{error}) { $self->{error}=1; $self->{perror}=1; $self->{errorString}='Failed to initiate ZConf::RSS. error="'. $self->{obj}->{error}.'" errorString="'.$self->{obj}->{errorString}.'"'; warn($self->{module}.' '.$function.':'.$self->{error}.': '.$self->{errorString}); return $self; } }else { $self->{obj}=$args{obj}; } #gets the zconf object $self->{zconf}=$self->{obj}->{zconf}; #gets the gui $self->{gui}=ZConf::GUI->new({zconf=>$self->{zconf}}); if ($self->{obj}->{error}) { $self->{error}=2; $self->{perror}=1; $self->{errorString}='Failed to initiate ZConf::GUI. error="'. $self->{gui}->{error}.'" errorString="'.$self->{gui}->{errorString}.'"'; warn($self->{module}.' '.$function.':'.$self->{error}.': '.$self->{errorString}); return $self; } $self->{useX}=$self->{gui}->useX('ZConf::RSS'); my @preferred=$self->{gui}->which('ZConf::RSS'); if ($self->{gui}->{error}) { $self->{error}=3; $self->{perror}=1; $self->{errorString}='Failed to get the preferred backend list. error="'. $self->{gui}->{error}.'" errorString="'.$self->{gui}->{errorString}.'"'; warn($self->{module}.' '.$function.':'.$self->{error}.': '.$self->{errorString}); return $self; } #make sure we have something if (!defined($preferred[0])) { $self->{error}=6; $self->{perror}=1; $self->{errorString}='Which did not return any preferred backends'; warn($self->{module}.' '.$function.':'.$self->{error}.': '.$self->{errorString}); return $self; } #initiate the backend my $toeval='use ZConf::RSS::GUI::'.$preferred[0].';'."\n". '$self->{be}=ZConf::RSS::GUI::'.$preferred[0]. '->new({obj=>$self->{obj}});'; my $er=eval($toeval); #failed to initiate the backend if (!defined($self->{be})) { $self->{error}=4; $self->{perror}=1; $self->{errorString}='The backend returned undefined'; warn($self->{module}.' '.$function.':'.$self->{error}.': '.$self->{errorString}); return $self; } #backend errored if ($self->{be}->{error}) { $self->{error}=4; $self->{perror}=1; $self->{errorString}='The backend returned undefined. error="'. $self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; warn($self->{module}.' '.$function.':'.$self->{error}.': '.$self->{errorString}); return $self; } return $self; }
sub addFeed{ my $self=$_[0]; my $feed=$_[1]; my $function='manage'; $self->errorblank; if ($self->{error}) { warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } $self->{be}->addFeed($feed); if ($self->{be}->{error}) { $self->{error}=5; $self->{errorString}='The backend errored. error="'. $self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } return 1; }
sub manage{ my $self=$_[0]; my $function='manage'; $self->errorblank; if ($self->{error}) { warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } $self->{be}->manage; if ($self->{be}->{error}) { $self->{error}=5; $self->{errorString}='The backend errored. error="'. $self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } return 1; }
sub view{ my $self=$_[0]; my $function='view'; $self->errorblank; if ($self->{error}) { warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } $self->{be}->view; if ($self->{be}->{error}) { $self->{error}=5; $self->{errorString}='The backend errored. error="'. $self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } return 1; }
sub dialogs{ my $self=$_[0]; my $function='dialogs'; $self->errorblank; if ($self->{error}) { warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } my @dialogs=$self->{be}->dialogs; if ($self->{be}->{error}) { $self->{error}=5; $self->{errorString}='The backend errored. error="'. $self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } return @dialogs; }
sub windows{ my $self=$_[0]; my $function='windows'; $self->errorblank; if ($self->{error}) { warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } my @windows=$self->{be}->windows; if ($self->{be}->{error}) { $self->{error}=5; $self->{errorString}='The backend errored. error="'. $self->{be}->{error}.'" errorString="'.$self->{be}->{errorString}.'"'; warn($self->{module}.' '.$function.': A permanent error is set. error="'.$self->{error}.'" errorString="'.$self->{errorString}.'"'); return undef; } return @windows; }
#blanks the error flags sub errorblank{ my $self=$_[0]; if ($self->{perror}) { warn('ZConf-DevTemplate errorblank: A permanent error is set'); return undef; } $self->{error}=undef; $self->{errorString}=""; return 1; }
1; # End of ZConf::RSS::GUI