On Thu, 27 Jul 2006, Alfie John wrote: > > I know there's a cleaner way to do this. All I want to do is print a > > word, but have more than one test case. I'd like to do it in the <% > > %> print operator, but haven't been able to figure that out. > > > > % if ( $ads = 'is_web' ) { > > Web Only > > % } elsif ( $ads = 'is_print' ) { > > Print > > % } else { > > Web and Print > > % } > > <% $ads eq 'is_web' ? q{Web Only} : $ads eq 'is_print' ? q{Print} : > q{Web and Print} %> > > Not really maintainable though.
I usually approach this as similar to a localization problem. Define a method that emits the correct text, and call it (maybe as a component, maybe as a library - depends on how you do things) with a constant. One approach would be something like: use MyProject::Labels (qw :tags); [...] <% $tag->get(thing => 'Location Identifier', ads => $ads) %> It also gives you at least a starting point if you ever have to go the whole way with I18N. (Don't take my example naming scheme - I'm just setting up examples, and those names suck.) -j -- Jamie Lawrence [EMAIL PROTECTED] My mother was a test tube, my father was a knife." - Friday, Robert A. Heinlein ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users