* Simon Wilcox <[EMAIL PROTECTED]> [2002-11-04 09:38]:
> Is it possible to add a function like this at runtime or should I just
> bite the bullet and write a plugin ?

Nothing springs to mind that would help you -- a user can't load
arbitrary Perl modules into a Template unless USE_PERL is set in the
Template constructor (security feature).  I think a plugin is your best
plan:

  package Template::Plugin::ImageSize;

  use strict;
  use base qw(Template::Plugin);

  use Image::Size;

  sub imgsize {
      my ($self, $context, $image) = @_;
      return imgsize($image);
  }

  sub attr_imgsize {
      my ($self, $context, $image) = @_;
      return attr_imgsize($image);
  }

  sub html_imgsize {
      my ($self, $context, $image) = @_;
      return html_imgsize($image);
  }

  1;

(darren)

-- 
Once you eliminate the impossible, whatever remains, no matter how
improbable, must be the truth.
    -- Sherlock Holmes

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://www.template-toolkit.org/mailman/listinfo/templates

Reply via email to