cat ops.conf+% find ! -name "*~" . ./ops.conf ./lib ./lib/Framework ./lib/Framework/Op ./lib/Framework/Op/PayBills.pm ./lib/Framework/Op/TakeOutTrash.pm ./lib/Framework/Op/PickUpKids.pm ./lib/Framework/Op/WalkTheDog.pm ./lib/Framework/Op/CookDinner.pm ./runner.pl
cat runner.plOp PayBills Op TakeOutTrash Op WalkTheDog
cat ./lib/Framework/Op/PayBills.pm#!/usr/bin/env perl use strict; use warnings; use Config::General qw(ParseConfig); my %config = ParseConfig("ops.conf"); foreach my $op_class (@{ $config{Op} }) { my $class = "Framework::Op::$op_class"; eval "require $class" or die $@; my $op = $class->new; $op->execute; }
cat ./lib/Framework/Op/TakeOutTrash.pmpackage Framework::Op::PayBills; use Moose; sub execute { my ($self) = @_; warn 'paying the bills'; } 1;
The other modules are similar. Then:package Framework::Op::TakeOutTrash; use Moose; sub execute { my ($self) = @_; warn 'taking out the trash'; } 1;
+% perl -I lib runner.pl paying the bills at lib/Framework/Op/PayBills.pm line 7. taking out the trash at lib/Framework/Op/TakeOutTrash.pm line 7. walking the dog at lib/Framework/Op/WalkTheDog.pm line 7.
In reply to Re: Perl Framework Help
by Arunbear
in thread Perl Framework Help
by anshumangoyal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |