On 7/12/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 7/12/07, Gregory Machin <[EMAIL PROTECTED]> wrote:
> Hi
> I have a rusty memory of perl have the ability, where by you can load
> perl code into an variable / array then execute it on demand, anyone
> got an example of how to do this ..
>
> Many Thanks

The string based version eval function can do this, but it is very
dangerous (for one thing, you open yourself up to injection attacks*)
and it is very rarely really needed.  If you describe what you want to
achieve we may be able to tell you how to achieve the effect without
eval.

* http://en.wikipedia.org/wiki/Code_injection


What I want to do is to write a service monitoring daemon, where the
core or body of the script parses a directory, that contains the
config / perl scripts, and is loaded into the core script, if one of
the scripts has an unrecoverable error, it's dumped, thus preserving
the daemon, but more importantly it allows for more inflexibility, as
each script can be tailored to suite that particular service, without
bloating the core script, obviously keeping all good reusable code in
the core script... The script needs to have as few dependencies as
posible as it's going to be run on a custom os thats very minimal ...
and not only will in need to monitor other daemons but also the status
on network interfaces and there connectivity, monitor daemons log
files can carry out actions based on the content, thus also trying to
do preventative maintenance ..

Quite an under taking  for a nubee, but it'll help fast track my perl
skills i'm sure ..

--
Gregory Machin
[EMAIL PROTECTED]
www.linuxpro.co.za

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to