We don't bite newbies here... much | |
PerlMonks |
Extending Perl::PIE - how to have Perl snippets executed ?by Anonymous Monk |
on Jul 08, 2009 at 16:19 UTC ( [id://778325]=perlquestion: print w/replies, xml ) | Need Help?? |
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I'm extending Perl::Pie package to include more deterministic rules that can be triggered in some certain time moments (new seconds, every 5 secs, etc...). Rules consists of conditions that must be true, so actions in the list get executed. I've add some simple time related functions (new_second, new_hour, ...) and variables ($Week_day, $Day, $Hour) in the additional time.pl file. I've included it in main file with require 'time.pl'; and declared all functions in it as main::function. I can use them easily in main program, but have problems if I try to use those functions as parts of condition or actions of rules... I try to use them as "eval $str" from some Perl::PIE package, where $str is written in xml rules config file, but it seems that it is not working at all. I think I need to run them in "context of the main" program but this is obviously not happening... I've debugged code and it doesn't get into function at all. I must be missing some basic things about dealing with global variables and functions... I have this in xml config :
and when I try to eval('main::new_second(5)') nothing happens, if I do the same from main program it works... I'd kindly as for some help or some pointers to similar solutions ... Thanks in advance, regards, Rob.
Back to
Seekers of Perl Wisdom
|
|