I would agree with Peter. In this case you might want to use the
preProcess method within a plugin as an example:
<cffunction name="preProcess" access="public" returntype="void"
output="false">
<cfargument name="eventContext"
type="MachII.framework.EventContext" required="true" />
<cfset var event = arguments.eventContext.getNextEvent() />
<!--- create an error/msg object once for e/ event cycle --->
<cfif NOT event.isArgDefined('myPersistentVariable')>
<cfset event.setArg('myPersistentVariable', 'Some value for this
variable') />
</cfif>
<cfreturn />
</cffunction>
On Jul 17, 8:13 am, "Peter J. Farrell" <[email protected]> wrote:
> MercuryNewt said the following on 07/17/2009 06:46 AM:> I was just recently
> reading up on subroutines and plugins, but didn't
> > see any specific examples of how to execute a subroutine from a
> > plugin.
>
> Probably because it's not a standard thing to do.> What I'm trying to
> accomplish is check for the existance of
> > certain persistent variables and if they do not exist for the event,
> > execute code to instantiate the variables and then continue with event
> > processing. My understanding is that this can be done from within a
> > plugin or by using a subroutine. I may be totally off-base with my
> > approach and perhaps it would be better to encapsulate such logic
> > directly in the plugin. Any advice?
>
> Sounds like a perfect job for a plugin if they need to be done on each
> and every request. If the logic only needs to be execute in certain
> event-handlers, you'd be better off using an event-filter.
>
> .pjf
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/
Wiki / Documentation / Tickets:
http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/
-~----------~----~----~----~------~----~------~--~---