Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Perl & IEby gjb (Vicar) |
on Apr 08, 2004 at 19:39 UTC ( [id://343723]=perlmeditation: print w/replies, xml ) | Need Help?? |
Yesterday dragonchild wondered about the possibility to use Microsoft Internet Exploren as the user interface layer for client side Perl applications. I remembered vaguely that this was indeed possible and decided to check. The answer is that you can actually perform client side Perl scripts in Internet Explorer using ActiveState's Perl. Part of the installation is PerlScript, an ActiveX component that ties in with Windows Scripting Host. Once installed, Perl scripts embedded in HTML with the <script> tag are executed in the browser just as JavaScript is. The following is a simple example that shows the basics: As you can guess, this example was adapted from the JavaScript rinocerus book (p. 7 in the 3rd edition, O'Reilly). So provided you know the object model, you can do in PerlScript whatever you can in JavaScript. Now honestly I've only dabbled just a little bit in client side scripting, so I'm not going into useful things here. And yes, it's possible to load and use modules. The reason I've always been slightly suspicious of PerlScript is shown in the following example: Yes, this actually works when the page is loaded from a local disk. Since this is creepy, I checked whether this works when the HTML file is loaded from a webserver and fortunately it doesn't. It seems that PerlScript is subject to the same limitations as JavaScript. Whether this is a reassurance given Microsoft track record on security I'll leave to you to decide. However, it is tempting to use PerlScript for client side scripting. If you can live with HTLM UI limitations and don't get nuts by keeping track of the state of your application it seems like a viable approach. For the record, my setup: Windows XP Pro, IE 6, ActiveState Perl 5.8.3.809. Just my 2 cents, -gjb-
Back to
Meditations
|
|