[ic] "if file-e" functionality in user tag?
Mike Heins
mike at perusion.com
Fri Aug 5 23:40:40 EDT 2005
Quoting Jeff Boes (jeff at endpoint.com):
> I want to create a user tag that produces an "<img>" tag using some
> default attributes, and inserting a default image if the cited image is
> missing. But the "-e" check in Perl isn't allowed by Safe, so I tried:
>
> if ($Tag->if({ op => 'file-e', term => $file})) {
>
> This reports (at catalog initialization) --
>
> UserTag 'veh_thumb' subroutine failed safe check: Can't call method "if"
> on an undefined value at (eval 383) line 11, <CONFIG> line 45.
The [if ...] tag is one of the 6 tags which cannot be called with
the $Tag object. (if, unless, goto, label, bounce, either are the ones.)
The -f file test -- which should be OK for testing for an image
file -- is allowed by default. That means
if (-f $file) { do_something() }
should work fine.
You can also add allowed ops in with SafeUntrap. I think this does
it for -e:
SafeUntrap ftis
I know this does it for -s:
SafeUntrap ftsize
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.765.647.1295 tollfree 800-949-1889 <mike at perusion.com>
"Laughter is inner jogging." -- Norman Cousins
More information about the interchange-users
mailing list