and a corresponding action.xml<workflow type="uplfile" persister="Filesystem"> <time_zone>local</time_zone> <description>This is the Blast sequence alignment workflow.</desc +ription> <state name="INITIAL" autorun="yes"> <action name="upload file" resulting_state="uploaded" /> </state> <state name="uploaded" autorun="yes"> <action name="null" resulting_state="finished"> </action> </state> <state name="finished" /> </workflow>
in the myapp subdirectory there is an Upload_file.pm which simply opens up and prints out a short text sequence:<actions> <type>uplfile</type> <action name="upload file" class="myapp::Upload_file"> </action> <action name="null" class="Workflow::Action::Null" /> </actions>
package Upload_file; use strict; use Fcntl; use base qw( Workflow::Action ); use Workflow::Exception qw( workflow_error ); sub new { my $class = shift; my $self = {}; bless ($self, $class); return $self; } sub execute { my ( $self, $wf ) = @_; my $ifile = "/mypath/to/codelib/perl/lib/myapp/testseq.txt"; sysopen(IFILE, $ifile, O_RDONLY) or die "Can't open $ifile : $!"; my @file = <IFILE>; close IFILE; print "testseq is ", @file, "\n"; return 1; } 1;
#! /bin/perl -w use strict; use Workflow::Factory qw( FACTORY ); use Fcntl; use File::Basename; Log::Log4perl::init('l4p.conf'); my $workflow_conf = 'wf_test.xml'; my $action_conf = 'action.xml'; my $pers = 'persister.xml'; FACTORY->add_config_from_file( workflow => $workflow_conf, action => $action_conf, persister => $pers, ); my $wf = FACTORY->fetch_workflow('uplfile', "PITGKDNR"); print "Workflow 1 ", $wf->id, " ", "currently at state ", $wf->state, "\n"; print "Available actions: ", $wf->get_current_actions, "\n"; $wf->execute_action('upload file');
Workflow 1 PITGKDNR currently at state INITIAL Available actions: upload file Can't locate object method "new" via package "myapp::Upload_file" at / +lib/x86_64/pkg/perl-5.8.8/lib/site_perl/5.8.8/Workflow/Factory.pm lin +e 546.
Upload_file->new()->execute();
In reply to Workflow module problem by diomedea
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |