1Event::ExecFlow(3) User Contributed Perl Documentation Event::ExecFlow(3)
2
3
4
6 Event::ExecFlow - High level API for event-based execution flow control
7
9 This is release has nearly no documentation yet. If you're interested
10 in the details please contact the author.
11
13 Event::ExecFlow provides a ligh level API for defining complex flow
14 controls with asynchronous execution of external programs.
15
17 use Event::ExecFlow;
18
19 my $job = Event::ExecFlow::Job::Group->new (
20 jobs => [
21 Event::ExecFlow::Job::Command->new (
22 name => "transcode",
23 title => "Transcoding DVD title to OGG",
24 command => "transcode -i /dev/dvd ...",
25 fetch_output => 1,
26 progress_max => 4711, # number of frames
27 progress_parser => sub {
28 my ($job, $buffer) = @_;
29 $job->set_progress_cnt($1) if $buffer =~ /\[\d+-(\d+)\]/;
30 #-- or simply write this:
31 #-- progress_parser => qr/\[\d+-(\d+)\]/,
32 },
33 ),
34 Event::ExecFlow::Job::Code->new (
35 name => "checks",
36 title => "Do some checks",
37 depends_on => [ "transcode" ],
38 code => sub {
39 my ($job) = @_;
40 my $transcode = $job->get_group->get_job_by_name("transcode");
41 if ( $transcode->get_output !~ /.../ ) {
42 $job->set_error_message("XY check failed");
43 }
44 #-- this could be done easier as a post_callback added to
45 #-- the "transcode" job above, but it's nevertheless a good
46 #-- example for the 'Code' job type and shows how jobs can
47 #-- interfere with each other.
48 },
49 ),
50 Event::ExecFlow::Job::Command->new (
51 title => "Muxing OGG file",
52 depends_on => [ "checks" ],
53 command => "ogmmerge ...",
54 no_progress => 1,
55 ),
56 ],
57 );
58
59 #-- this inherits from Event::ExecFlow::Frontend
60 my $frontend = Video::DVDRip::GUI::ExecFlow->new(...);
61 $frontend->start_job($job);
62
64 Event::ExecFlow offers a high level API to declare jobs, which mainly
65 execute external commands, parse their output to get progress or other
66 status information, triggers actions when the command has been finished
67 etc. Such jobs can be chained together in a recursive fashion to
68 fulfill rather complex tasks which consist of many jobs.
69
70 Additionally it defines an extensible API for communication with the
71 frontend application, which may be a written using Gtk2, Tk or Qt or is
72 a simple text console program.
73
74 In case of Gtk2 a custom widget for displaying an Event::ExecFlow job
75 plan, including progress updates, is shipped with the
76 Gtk2::Ex::FormFactory package.
77
79 Event::ExecFlow requires the follwing Perl modules:
80
81 AnyEvent >= 0.04
82 Locale::TextDomain
83 Test::More
84
86 You get the latest installation tarballs and online documentation at
87 this location:
88
89 http://www.exit1.org/Event-ExecFlow/
90
91 If your system meets the requirements mentioned above, installation is
92 just:
93
94 perl Makefile.PL
95 make test
96 make install
97
99 Jörn Reder <joern at zyn dot de>
100
102 Copyright 2005-2006 by Jörn Reder.
103
104 This library is free software; you can redistribute it and/or modify it
105 under the same terms as Perl itself.
106
108 Hey! The above document had some coding errors, which are explained
109 below:
110
111 Around line 122:
112 Non-ASCII character seen before =encoding in 'Jörn'. Assuming UTF-8
113
114
115
116perl v5.34.0 2021-07-22 Event::ExecFlow(3)