Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Firefox Script

by langdona (Initiate)
on Jan 25, 2008 at 16:21 UTC ( [id://664307]=perlquestion: print w/replies, xml ) Need Help??

langdona has asked for the wisdom of the Perl Monks concerning the following question:

I have what I hope is a small problem running a Perl script in Firefox. I have the attached script on a Red Had Linux Server that is using the Apache web server which I think I have configured correctly to run Perl. I'm am trying to run it from my XP PC using both Firefox and IE. I am connecting using http://linux_server/plhello2.htm. In IE it works i.e. I get "PerlScript says: Hello, world!" however if I use the same address in Firefox I just get a blank screen. Anyone any ideas as to why Firefox is not interpreting the script?
<DOCTYPE> <html> <head> <meta> <meta> <title>PerlScript sample: Hello, world</title> <link> </head> <ActiveState> <BODY> <script language="PerlScript"> $window->document->write("PerlScript says: Hello, world!"); </script>

Replies are listed 'Best First'.
Re: Firefox Script
by wfsp (Abbot) on Jan 25, 2008 at 16:58 UTC
    The Active Perl docs say:

    PerlScript is an ActiveX scripting engine that allows you to use Perl with any ActiveX scripting host. At this time, ActiveX scripting hosts include:

    Internet Information Server 3.0/4.0/5.0
    Peer Web Services 3.0/4.0
    Microsoft Internet Explorer 5.0x
    Windows Scripting Host
      Ah well missing the obvious.
      Looks like its back to Javascript then!
      So I assume this means there is no way of running and veiwing PerlScript webpages from a Linux box? I just assumed that everything Perl was multiplatform.

      By the way I have no problems running Perl routines on the server from Firefox and receiving output HTML back.

      Anyway
      Thanks
        If you are persistent enough you can find a way to run Perl scripts in Firefox. I've used Javascript + XPCOM to open sockets to a Perl RPC service I created which will allow Javascript to make calls to Perl subroutines. I used it to wrap (partially) DBI methods so I could talk to real databases from Javascript. I also utilized a <perl> tag to embed Perl in the XUL. The RPC client (written in Javascript) has a method that will extract the Perl code on page load and send it to perl to be executed. The technique does not allow Perl to replace Javascript, but allows Javascript to take advantage of some of Perl's strengths.
Re: Firefox Script
by moritz (Cardinal) on Jan 25, 2008 at 16:30 UTC
    Uhm, why should firefox execute any arbitrary scripting language?

    I've never heard that it executes anything but javascript in HTML pages.

Re: Firefox Script
by Errto (Vicar) on Jan 25, 2008 at 21:18 UTC

    I admit to a general anti-Microsoft bias in much of my daily work but I have to give them this one. The fact that Windows has a general purpose scripting host architecture meaning that any scripting language that runs at all on the platform can also run in a whole variety of scripting-enabled applications is pretty damned cool.

    I know almost nothing about Firefox internals, but I assume that their scripting engine is flexible enough that one could plug in support for other languages without outrageous amounts of pain. Not sure if anyone's done it with Perl, though.

      Cool?
      Symantec build script blockers into their products wasting resources watching programs like media player, which have no reason to run scripts, causing all sorts of problems if something goes wrong with symantec sblock. Services.msc uses activex too untill you hit standard view. Why??. And security controls in gpedit.msc that actually prevent you from activating Windows but hardly cause any other problems.

      I'm guessing mozilla have good reason* and running perl client side is not prevalent enough, to force their hand, like javascript, but it can be enabled with addons.

      * Known good Scripts need to run from read only sources and externally sourced code cannot be known good and so needs an architecture to hopefully protect the user, better than Java has and especially activeX.
Re: Firefox Script
by andyford (Curate) on Jan 25, 2008 at 17:00 UTC
      Yes normal web pages load OK.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://664307]
Approved by moklevat
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-24 03:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found