Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re5: Creating Advanced Client-Side Applications With Perl

by dragonchild (Archbishop)
on Apr 19, 2004 at 18:28 UTC ( #346386=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Creating Advanced Client-Side Applications With Perl
in thread Creating Advanced Client-Side Applications With Perl

The question here, imho, isn't whether or not it's called. (Though, I don't think it is because putting in a $window->alert("It's me!"); doesn't pop up.) It's what mistake(s), if any, did I make in trascribing the JavaScript into PerlScript. PerlScript on the client-side is advertised as being identical to JavaScript, albeit with Perl's power. Where did I go wrong??

------
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: Re5: Creating Advanced Client-Side Applications With Perl
by Jenda (Abbot) on Apr 19, 2004 at 19:36 UTC

    One of the problems in your code is that this JavaScript

    window.document.formname.fieldname.value = 5;
    needs to be translated to this PerlScript:
    $window->{document}->{formname}->{fieldname}->{value} = 5;
    Notice the curlies! The second problem is that JavaScript looks for objects in more places. Eg. It's OK to write the code above like this:
    document.formname.fieldname.value = 5;
    since JavaScript searches through the properties of the active window object if it doesn't find a variable of that name. OTOH
    $document->{frm2}->{code}->{value} = 5;
    is not valid.

    Likewise if I add <div id="foo" name="this is foo">Ahoj</div> into the page and run alert(foo) in JavaScript I get [object]. If I try to run alert($foo); in PerlScript I get nothing. I bet there is a way to get that object, but I don't know how.

    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

      Ahhhh ... I thought that Win32::OLE would actually AUTOLOAD methods that map to property names. Silly wabbit! Thanks!

      ------
      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

        No it does not. Which is particularly annoying if you are converting some VB(Script) examples to Perl. In JavaScript you may distinguish between a function call and property access (function calls always have braces, even if you do not want to pass any parameters) but there is no such distinction in VB(Script) :-(

        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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://346386]
help
Chatterbox?
[vedagiri89]: from the source
[hippo]: But APR.pm is under vendor_perl in your error message so you are mixing up modules installed from the packager and by hand. That's rarely a good plan.
[vedagiri89]: the prm is..works fine if i run file directly..not working if i run through apache http file
[hippo]: Environments differ.
[vedagiri89]: so, how to fix that differ
[choroba]: option one is install everything from the vendor
[choroba]: option two is install everything by hand
[choroba]: option three is mixed the two, but know well what you're doing

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2018-06-19 11:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (113 votes). Check out past polls.

    Notices?