Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Perl Browser Plugins

by bkiahg (Pilgrim)
on Oct 29, 2008 at 17:36 UTC ( [id://720266]=perlquestion: print w/replies, xml ) Need Help??

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

I once again come in search of the wisdom from you venerable sages.

What I am looking to do is to write plugins to connect to the client side of things through a browser (IE -> Java, Flash, Etc). Perl is hands down my first choice as a programming language and have been able to do many wonderful things on the server level. Is there a way to write perl plugins to interact with things on the client level such as:

  • Interact with local printers, ie. print directly to the printer not using the browsers printing capabilities.

  • Connect to local ODBC databases.

  • Read items connected to the client locally.
I do all of my server programming usually on a Win2003 box and can instruct all of the clients to use Internet Explorer.

My question would be two-fold:
  1. Is there a perl solution for this?
  2. And if there isn't, does anyone have a recomendation on an easier to use low cost programming solution (think like perl!!) that would work for this type of problem?

Replies are listed 'Best First'.
Re: Perl Browser Plugins
by jettero (Monsignor) on Oct 29, 2008 at 17:51 UTC
    Anything that let you do this from the browser is likely to be a bad security hole to say the least, and there's certainly no way to do it with perl. I think you could probably write a plugin for firefox, but it'd be pretty challenging and it'd be a real problem if the plugin were popular as it would give remote attackers access to everything on the users' LAN.

    ... did I misunderstand the question?

    -Paul

      These would obviously have to be downloaded and installed locally on the client to interact with the cgi applications. Sounds according to you that it wouldn't be a good idea to do it in perl ( :-/ ) So the question then becomes...

      does anyone have a recomendation on an easier to use low cost programming solution (think like perl!!) that would work for this type of problem?

      I know that Java and I believe C#/VB have options through Microsofts .Net framework to do what I'm looking for. But those are commercial solutions which cost money and don't usually come with the brilliant help found at sites like this.
        No, these same problems are a problem in any language. The reason you can't get to that stuff from any known plugin is because it's a security problem to be able to get to it. Java probably comes the closest, but it is carefully designed to not let you break out of the browser ... for a reason.

        -Paul

Re: Perl Browser Plugins
by gwadej (Chaplain) on Oct 29, 2008 at 19:00 UTC

    It's possible that we are all focusing too much on your solution rather than on your requirements. As I understand it, you are looking for a browser plugin instead of doing this server-side, because:

    1. need to interact with client components
    2. would prefer to use the browser as an interface

    Additionally, you are allowed to install things on the client side, so you are not limited to what the browser supports, natively.

    If I understand your requirements correctly, there's another option: do all of the work server-side, on the client's machine. Run a little web-server locally on the machine and interact with it with the browser.

    Although this may not be what you had in mind, it does meet the requirements as I've restated them above. I have found this technique to be useful in the past (because I'm lousy with UIs, and marginally better with HTML.

    G. Wade
      Very interesting outside of the box thinking. This would take care of all the requirements listed above. The question, delving a little more into my specific dilemma, then morphs into how do I package everything I need into a perl install that would install perl and all the modules needed and handle automatic updates... I'm going to do some googleing on how to do this.

      Thank you gwadej for a different perspective on how to come up with a solution.

        The module of interest for that problem is PAR.

        I've used PAR for a few small examples, never anything big. But it may actually do what you want/need.

        G. Wade
        Either of PAR, PerlApp (from ActiveState's PDK), or Perl2exe can be used for packaging up the script and it's dependent CPAN modules. I've used the two first successfully.

        Add an installer, like InnoSetup, the NullSoft Installer (the one from WinAmp), or MSI and you've got something that the end user can't distinguish from other Windows programs (which is a Good Thing(tm)).

        It doesn't do automatic updates though. I'm sure there's a CPAN module waiting to be written there :)

        /J

Re: Perl Browser Plugins
by jvector (Friar) on Oct 29, 2008 at 18:00 UTC
    I find myself wondering 'Why would I want to go to a web site that could "Connect to local ODBC databases" or "Read items connected to the client locally' ...?

    Or am I being excessively paranoid (if that's possible)?


    This signature will be ready by Christmas
      These would all be in a controlled environment, I would already have access to all of the databases that I am going to interact with. I am just looking for a way to connect the local databases with my cgi applications.
        CGI applications by definition run on a server, not in a browser (like client side javascript).
        These would all be in a controlled environment, I would already have access to all of the databases that I am going to interact with. I am just looking for a way to connect the local databases with my cgi applications.
        OK, fair enough. I retract any meaning that might have been attached to my previous reply. I had thought that this might be on an open site accessible to all.

        This signature will be ready by Christmas
Re: Perl Browser Plugins
by Perlbotics (Archbishop) on Oct 29, 2008 at 19:09 UTC

    1. Is there a perl solution for this?
    Not as far as I know. If I understand your question correct, then that would require something (a plugin) that is in principle a Perl installation (executable + modules) that is dynamically loaded by the browser and has access to the browsers resources, especially the GUI (canvas?). A Perl-Applet Runtime Environment so to speak? IMHO too complicated, if it cannot be easily mapped to an already available Perl installation...and even when limited to Windows and IE.
    2. And if there isn't, does anyone have a recommendation on an easier to use low cost programming solution (think like perl!!) that would work for this type of problem?
    Easiest perlish solution that I can think of is a local mini HTTP-server that runs on behalf of the user (with reduced privileges) and presents the GUI in HTML (+Javasrcipt if required). Eventually, any off-the-shelf browser becomes a HTTP- and HTML-based user interface for your application. The server would allow connections from localhost only and ideally from the the same authenticated user. Maybe something that uses POE::Component::Server::HTTP or HTTP::Daemon?

    Even downloading Papplets(?) and running them by your server could be made possible, but it would be very hard to make them work secure (Signed Papplets?)... at least it sounds like a CUFP. Maybe it's easier to use a Java-Applet right from the start...

Re: Perl Browser Plugins
by JavaFan (Canon) on Oct 29, 2008 at 19:07 UTC
    Way back, before Java applets were as common as they are now, people experimented with writing plugins for various languages. I've seen at least one browser with a Python plugin, and I remember someone working on a Perl/Tk based browser that could do Perl plugins. And I certainly remember people talking about writing a Perl plugin.

    But that's a long time ago, and I haven't heard anything about it in years, so it might very well be that their projects have died.

    Did you do a Web search?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-12 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found