Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
ZConf::Runner(3)      User Contributed Perl Documentation     ZConf::Runner(3)

NAME
       ZConf::Runner - Run a file using	a choosen methode, desktop entry or
       mimetype.

VERSION
       Version 2.1.4

SYNOPSIS
       The purpose of this module is to	figure out what	to do with an object
       based on	it's mimetype. Currently only files are	supported.

	   use ZConf::Runner;

	   my $zcr=ZConf::Runner->new();
	  if($zcr->{error}){
	      print "Error!\n";
	  }

METHODS
   new
       This initializes	it.

       One arguement is	taken and that is a hash value.

       hash values

       zconf

       This is a zconf object to use instead of	initiating a new one.

	  my $zcr=ZConf::Runner->new();
	  if($zcr->{error}){
	      print "Error!\n";
	  }

   actionIsSetup
       This checks to see if a specific	action is setup	for a mimetype.

       Two arguements are accepted. The	first is the mimetype. The second is
       the action.

	   my $mimetype='image/jpeg';
	   my $returned=$zcr->actionIsSetup($mimetype, 'edit');
	   if($zcr->{error}){
	       print "Error!\n";
	       if($zcr->{error}	eq '7'){
		   print "Mimetype is not setup.\n";
	       }
	   }
	   if($returned){
	       print $mimtetype." is configured	already";
	   }

   ask
       This is creates a Curses::UI 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.

	   my $returned=$zcr->ask('view', '/tmp/test.rdf', {useX=>0});
	   if($zcr->{error}){
	       print "Error!\n";
	   }else{
	       if($returned){
		   print "Action setup.\n";
	       }
	   }

   do
       This runs takes an file and runs	it.

       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.

       args hash

       still needs implemented

       exec

       If this is set to true, exec is used instead of system.

       ask

       If this is set to true, it will

   getAction
       This fetches an action for a mimetype and returns the do	and type as an
       hash.

       The are two required arguements.	The first is the mimetype and the
       second is the action.

	   my %action=$zcr->getAction('application/vnd.oasis.opendocument.text', 'view');
	   if($zcr->{error}){
	       print "Error!\n";
	   }else{
	       print "do: '".$action{do}."'\n".
		     "type: '".$action{type}."'\n";
	   }

   getSet
       This gets what the current set is.

	   my $set=$zcr->getSet;
	   if($zcr->{error}){
	       print "Error!\n";
	   }

   listActions
       This gets a list	of actions for a specific mimetype.

       There is	one required arguement and it is the mimetype.

	   my @actions=$zcr->listActions('application/vnd.oasis.opendocument.text');
	   if($zcr->{error}){
	       print "Error!\n";
	   }

   listMimetypes
       This fetches a list of currently	setup mimetypes.

       The are no arguements for this.

	   my @mimetypes=$zcr->listMimetypes();
	   if($zcr->{error}){
	       print "Error!\n";
	   }

   listSets
       This lists the available	sets.

	   my @sets=$zcr->listSets;
	   if($zcr->{error}){
	       print "Error!";
	   }

   newRunner
       This creates a new runner. The only required arguement is an hash.
       Please see the section below for	the required hash values.

       hash args

       mimetype

       This is the mimetype for	the new	runner.

       action

       This action that	will be	done.

       type

       This is either 'exec' or	'desktop'.

       do

       If the 'exec' is	specified as the type the specified program is used to
       run it. '%f' will be replaced by	the filename when it is	ran.

       If the 'desktop'	is specified as	the type
       'File::MimeInfo::Applications' is used to run it.

	   $zcr->newRunner({mimetye=>'application/pdf',	action=>'view',	type=>'exec', do=>'xpdf	%f'})
	   if($zcr->{error}){
	       print "Error!\n";
	   }

   mimetypeIsSetup
       This checks if a	mimetype has been setup	already. One arguement is
       accepted. It is a string	containing the name of mimetype.

	   my $mimetype='image/jpeg';
	   my $returned=$zcr->mimetypeIsSetup($mimetype);
	   if($zcr->{error}){
	       print "Error!\n";
	   }
	   if($returned){
	       print $mimtetype." is configured	already";
	   }

   readSet
       This reads a specific set. If the set specified is undef, the default
       set is read.

	   #read the default set
	   $zcr->readSet();
	   if($zcr->{error}){
	       print "Error!\n";
	   }

	   #read the set 'someSet'
	   $zcr->readSet('someSet');
	   if($zcr->{error}){
	       print "Error!\n";
	   }

   removeAction
       This removes an action for a mimetype.

       Two arguements are required. The	first is the mimetype and the second
       is the action.

	   $zcr->removeAction('application/pdf', 'view');
	   if($self->{error}){
	       print "Error!\n";
	   }

   validAction
       This makes sure an action is valid. See the error code for the reason
       it is not valid.

	   $zcr->validAction('application/pdf',	'view');
	   if($self->{error}){
	       print 'Error:'.$self->{error}.':	Action is not valid';
	   }

   validActionName
       This makes sure that the	action name is valid.

       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($zcr->validActionName('some/test')){
	       print "Error\n";
	   }

   validDesktopEntry
       This checks to see if a desktop entry is	valid. One value is accept and
       that is file id name.

       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($zcr->validDesktopEntry('xemacs')){
	       print "xeamcs is	not a valid desktop entry\n";
	   }

   Xavailable
       This checks if X	is available. This is checked for by trying to run
       'xhost >	/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($zcr->Xavailable()){
	       print "X	is available\n";
	   }

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

       It does the following.

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

ERROR CODES
       The error code is contianed in $zcr->{error} and	a extended description
       can be found in $zcr->{errorString}. If any module ever sets
       $zcr->{perror} then the error is	permanent and none of the methods are
       usable.

   1
       Could not initialize ZConf.

   2
       ZConf error.

   3
       Failed to create	the ZConf config 'runner'.

   4
       Missing function	arguements.

   5
       Invalid action name.

   6
       Invalid type.

   7
       Mimetype	not configured.

   8
       Action is not configured.

   9
       Missing type for	an action.

   10
       Invalid action for an type.

   11
       'do' is not defined for the action.

   12
       Could not determine mimetype.

   13
       Desktop entry does not appear to	be valid. It could not be found	by
       'lookup'	in 'File::DesktopEntry'.

   14
       No desktop entry	specified or none exists for this mimetype.

   15
       Curses::UI start	problem

   16
       Curses::UI failed in some manner.

EXIT CODES
   14
       Quit selected.

   15
       The OK has been selected	and the	new runner has been added.

   16
       Error Code 14 happened when OK was selected.

   17
       'newRunner' errored.

   18
       Ask errored.

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

BUGS
       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
       You can find documentation for this module with the perldoc command.

	   perldoc ZConf::Runner

       You can also look for information at:

       o   RT: CPAN's request tracker

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

       o   AnnoCPAN: Annotated CPAN documentation

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

       o   CPAN	Ratings

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

       o   Search CPAN

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

ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
       Copyright 2008 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.

perl v5.24.1			  2009-11-27		      ZConf::Runner(3)

NAME | VERSION | SYNOPSIS | METHODS | ERROR CODES | EXIT CODES | AUTHOR | BUGS | SUPPORT | ACKNOWLEDGEMENTS | COPYRIGHT & LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=ZConf::Runner&sektion=3&manpath=FreeBSD+12.0-RELEASE+and+Ports>

home | help