in reply to Creating Advanced Client-Side Applications With Perl

This myth persists because of the following:
  1. The Java VM comes installed on most Windows systems.
  2. Java has a unified method of creating GUIs, while Perl doesn't.
  3. Java has a better set of documentation.

That last complaint is a really really big one for me. For the past week, I've been researching using PerlScript to create client-side apps using IE without a webserver. Let me tell you - there is almost zero documentation for this.

In other words, someone might be able to, if they were willing to bust their ass trying to reverse-engineer it. But, why do that when you can just install Apache?

------
We are the carpenters and bricklayers of the Information Age.

Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

Replies are listed 'Best First'.
Re: Re: Creating Advanced Client-Side Applications With Perl
by jdporter (Paladin) on Apr 16, 2004 at 15:01 UTC

    Thank you for the info, dragonchild. I've been doing a fair amount of client-side scripting with JScript (Micro$oft's javascript) lately, and have been wondering why I couldn't do it in Perl. I know about PerlScript, but I can't use it here because it isn't installed. I didn't realize there were these other barriers to entry as well. :-(

    Btw -- I think it's clear from the context that "advanced client-side applications" means programming to a plug-in, not to the browser itself. Therefore the comparison between Java and PerlScript is apples and oranges. PerlScript is an alternative to Javascript/JScript/VBScript (etc.). An alternative to Java (on the client) would be something embedded, like Flash, and whatever Tk or Wx thingies people might have come up with.

    jdporter
    The 6th Rule of Perl Club is -- There is no Rule #6.

Re: Re: Creating Advanced Client-Side Applications With Perl
by Jenda (Abbot) on Apr 16, 2004 at 20:38 UTC
    1. One of the reasons why you do not find anything about PerlScript used in the browser is ... that people do not do that often enough. You simply can't do this in any other case than if all your users are running Windows and have Perl installed. Maybe some intranets are elligible, I don't really know. I might do something like this soonish in a HTA, but for web client-side stuff JavaScript has to be good enough.
    2. The second reason is IMHO that there is not much to document. Perl is Perl and browser object model is browser object model. Sure Netscape and MS has all their docs in J(ava)Script, but converting that to Perl syntax is not that a big deal. If you want to control a program using OLE/COM you usualy need to convert the description and examples from VB and thats a bigger difference.

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature

      I want to create single-user applications to be run on a single PC that you download. The installer would include ActivePerl, should it be necessary. I can't use JavaScript because I want to use DBD::SQLite, plus I don't want to learn a whole new language.

      Put it this way - the simple utility apps I want to create and distribute would take between 2-4 days each ... assuming I can use Perl for DBD::SQLite and HTML::Template. The engines for these utilities are very small and easy ... Heck, I've already written most of the engines for two of the utilities in the general course of my work. I don't want to reimplement them, if at all possible, or spend a month learning Tk. But, I don't want to require using a webserver, even one as small as webmin.

      As for not needing much to document ... Converting from JScript to PScript is almost impossible for non-trivial cases. Take the following rather simplistic example in JavaScript:

      Here's the direct translation (as I understand it) to PerlScript.

      The JavaScript version works as expected, but the PerlScript one doesn't even run the onLoad handler. What's the difference? What am I missing?

      I'm on WinXP Pro, IE 6.0.2x, the latest build of ActivePerl (downloaded within the past week).

      Update: Changed to match Erto's statement. It still doesn't work.

      ------
      We are the carpenters and bricklayers of the Information Age.

      Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

        Are you sure it's not called?

        Try to add

        use Win32; Win32::MsgBox("How are you?");
        into the subroutine. It seems to me it does get called (IE 6.0.2800.1106), but the code doesn't do anything.

        I tried to fix it but I can't find the contentFrame. I tried to use

        sub displayObj { my $obj = shift(); Win32::MsgBox("Keys: " . join(', ', map { "$_ => $obj->{$_}" } sor +t keys %$obj )); } ... displayObj( $window); displayObj( $window->{document}); ...
        , but I can't find anything.

        Quite possibly it would be best to use JavaScript for most of the "client-side" stuff and only call some PerlScript subroutines from the JavaScript.:

        <SCRIPT LANGUAGE="PerlScript"> sub DoSelectSite { $window->{document}->{Location} = $window->{document}->Forms( 0 )- +>{SiteSelector}->{Value}; } </SCRIPT> <script language="JavaScript"> function SelectSite () { DoSelectSite(); } </script> <BODY> <P>Select a site to browse.</P> <HR> <FORM> <SELECT NAME="SiteSelector" SIZE = "1" onChange="JavaScript:SelectSite +()"> <OPTION VALUE="">--select one-- <OPTION VALUE="http://www.ncat.edu">North Carolina A and T State Unive +rsity</OPTION> <OPTION VALUE = "http://www.uncg.edu">University of North Carolina at +Greensboro</OPTION> </SELECT> </FORM> </BODY>

        Jenda
        Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
           -- Rick Osborne

        Edit by castaway: Closed small tag in signature

        I've never tried PerlScript in IE, but what strikes me off the bat is that in your translation you renamed the "update" function but didn't modify the HTML accordingly. So you should change onLoad="update()" to onLoad="parentFrame_onLoad()" and try that.