How can I embed Javascript to run Perl scripts in my HTML code?

I have created a teeny weenie directory of Internet resources.
(Yawn.) But more importantly, I want to be able to allow people
(webmasters) to include a one- or two-liner Javascript into their
HTML that will query my directory and return HTML to be included in
HTML pages.

How do I do that? Something like this?

   <!cript type='text/html' src='http://foo/bar.cgi' />