in reply to handling tasks and customizing flow of tasks using perl
Instead of XML, you can introduce simple text format:
Then you can parse it and call pretask/posttask as perl method:task=B pretask=makeAServerdown posttask=checkBServer
use strict; use warnings; use Data::Dumper; sub makeAServerdown { print "AHA:", @_, "\n"; } my $line = 'task=B pretask=makeAServerdown posttask=checkBServer'; my $h = { map { my ($k,$v) = split /=/; $k=>$v } split (' ', $line) }; print Dumper $h; { no strict 'refs'; $h->{pretask}->($h->{task}); } __END__ $VAR1 = { 'pretask' => 'makeAServerdown', 'task' => 'B', 'posttask' => 'checkBServer' }; AHA:B
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: handling tasks and customizing flow of tasks using perl
by asham (Novice) on Sep 29, 2013 at 14:48 UTC | |
by vsespb (Chaplain) on Sep 29, 2013 at 15:48 UTC | |
by asham (Novice) on Sep 29, 2013 at 18:56 UTC |
In Section
Seekers of Perl Wisdom