Mark Stosberg wrote:
>Rhesa wrote:
With the new proposed callback functionality, this could be added completely transparently. For the current version of cgi-app, it can still
be added with very little code. I don't think the utf8 code _has_ to be in there, but I needed it.
Do you think it would make sense to make a plugin for this?
Yes. It sounds like something someone else would find useful. My
ValidateRM is nearly as short.
I've been playing with the new callback stuff, and it's quite neat! Well
done guys :)
I'm in the process of building a plugin for HTML::Tidy. The intention is
to convert the output into valid xhtml using tidy. For that purpose, I
use the 'postrun' callback. However, I'm running into a potential
problem: most of my applications do some post-processing in an
overridden cgiapp_postrun as well (such as adding headers and footers),
and the callback is called _before_ my cgiapp_postrun. This means the
call to tidy comes too soon. Is there a way to make a hook that runs
just after cgiapp_postrun so that I can do a final pass on the output?
Another question I have is more a matter of interface design. I want to
add the option to specify the config file for tidy, but I'm not sure how
to get at it.
Currently I'm (ab)using the 'use' line like so:
use CGI::Application::Plugin::HtmlTidy config_file => '/etc/tidy.conf';
I'm wondering if that is the most appropriate way to do it; It feels a
bit odd to me. On the other hand I definitely don't like to have the
user mess around with package variables, and I'd prefer to avoid extra
code for the user altogether.
This is how I get at it in my plugin (the option handling is just a
quick hack, obviously) :
our %OPTS;
sub import {
my %opts = splice @_, 1;
$OPTS{CONFIG_FILE} = $opts{config_file} || '/etc/tidy.conf';
my $caller = scalar(caller);
$caller->add_callback('postrun', \&tidy_clean);
goto &Exporter::import;
}
Is there a better transparent way to supply data to the callbacks?
For what it's worth, we've been using HTML::Tidy on one of our busiest
sites (www.exposuremanager.com), which is handling well over 150000 hits
a day (mostly on people's galleries of course). I just saw those stats
today, and was pretty impressed with it. It just shows how stable cgiapp
et al are. Performance is not an issue either :)
Thanks!
Rhesa
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]