From: Chris W. <ch...@cw...> - 2003-03-23 17:22:36
|
damien leri wrote: > i'd like to know recommendations regarding custom code that is relevant globally, not just in a specific OI package: > > for OI.regex_chunk() i need a multiple-line match; i could add an 's' before the semicolon in the line: > > my ( $item ) = $str =~ /$match/; > > or should i subclass Plugin.pm somehow, or use a component? > > if i do the latter, for miscellaneous components like this, should i wrap it in a new OI package? or just edit $OIWEBSITE/conf/action.perl and put a mysite.pm somewhere and a use() somewhere (where?)? A little-documented (and tested) feature is for a package to make available a Template Plugin that is accessible in all templates. In your package's package.conf you should be able to specify a plugin like this: name mypackage version 1.00 author Foo <fo...@ba...> url http://www.foo.com/ template_plugin MyPlugin OpenInteract::Template::MyPlugin description Blah blah And then reference the plugin as normal, using the first entry in the configuration line as the plugin name: [% USE MyPlugin %] [% matched = MyPlugin.multiline_match( var ) %] ... Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |