GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  WORKFLOW::CONDITION::EVALUATE (3)

.ds Aq ’

NAME

Workflow::Condition::Evaluate - Inline condition that evaluates perl code for truth

CONTENTS

VERSION

This documentation describes version 1.02 of this package

SYNOPSIS



 <state name="foo">
     <action name="foo action">
         <condition test="$context->{foo} =~ /^Pita chips$/" />



DESCRIPTION

If you’ve got a simple test you can use Perl code inline instead of specifying a condition class. We differentiate by the ’test’ attribute — if it’s present we assume it’s Perl code to be evaluated.

While it’s easy to abuse something like this with:



 <condition>
   <test><![CDATA[
     if ( $context->{foo} =~ /^Pita (chips|snacks|bread)$/" ) {
          return $context->{bar} eq hummus;
     }
     else { ... }
     ]]>
   </test>
 </condition>



It should provide a good balance.

OBJECT METHODS

new( \%params )

One of the \%params should be ’test’, which contains the text to evaluate for truth.

evaluate( $wf )

Evaluate the text passed into the constructor: if the evaluation returns a true value then the condition passes; if it throws an exception or returns a false value, the condition fails.

We use Safe to provide a restricted compartment in which we evaluate the text. This should prevent any sneaky bastards from doing something like:



 <state...>
     <action...>
         <condition test="system( rm -rf / )" />



The text has access to one variable, for the moment:
<B>B>$context<B>B> A hashref of all the parameters in the Workflow::Context object

SEE ALSO

Safe - From some quick research this module seems to have been packaged with core Perl 5.004+, and that’s sufficiently ancient for me to not worry about people having it. If this is a problem for you shoot me an email.

COPYRIGHT

Copyright (c) 2004 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Chris Winters <chris@cwinters.com>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 WORKFLOW::CONDITION::EVALUATE (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.