syntax question in dealing with .Net api

Discussion in 'Perl Misc' started by trillich@gmail.com, Nov 12, 2007.

  1. Guest

    hi -- not sure where the best place would be to post this; please
    point me elsewhere if there's another list more apropos...

    we've got two apps, one in java, one in .Net, and we're trying to put
    some glue together to transfer data back and forth between them:

    - reading data FROM the .Net application is easy
    - writing data TO the .Net application is a puzzle...

    to read data from within VB, we can use syntax like VAR =
    OBJ.METHOD(PARAMS) and to write fields to an object from within VB
    it's also simple: OBJ.METHOD(PARAMS) = VAL.

    only the read-style syntax works in exterior languages (Perl is our
    platform for proof-of-concept):

    $val = $obj->method("param");

    but the write-style syntax needs something different:

    $obj->method("param") = $expr; # no way

    is there a standardized "write-to" syntax that non-VB languages can
    take advantages?

    $obj->method("param")->let($expr); # for example
    $obj->let($expr)->method("param"); # for example
    $obj->let_method("param",$expr); # for example

    anybody know a FAQ or URL that'll point us in the right direction?
     
    , Nov 12, 2007
    #1
    1. Advertising

  2. Ben Morrow Guest

    [newsgroups trimmed since my ISP doesn't carry microsoft.*, f'up set]

    Quoth :
    >
    > we've got two apps, one in java, one in .Net, and we're trying to put
    > some glue together to transfer data back and forth between them:
    >
    > - reading data FROM the .Net application is easy
    > - writing data TO the .Net application is a puzzle...
    >
    > to read data from within VB, we can use syntax like VAR =
    > OBJ.METHOD(PARAMS) and to write fields to an object from within VB
    > it's also simple: OBJ.METHOD(PARAMS) = VAL.
    >
    > only the read-style syntax works in exterior languages (Perl is our
    > platform for proof-of-concept):
    >
    > $val = $obj->method("param");
    >
    > but the write-style syntax needs something different:
    >
    > $obj->method("param") = $expr; # no way


    I don't know much about .Net, but when you say 'fields' here are you
    referring to what Microsoft call 'properties' in OLE/COM? In that case,
    that standard way to access COM objects from Perl is to use the
    Win32::OLE module, which provides the syntax

    $obj->LetProperty('method', 'param', $expr);

    to perform what you are asking for above. See the docs for Win32::OLE.

    Since the method/property distinction, in particular the concept of
    'properties with arguments which are nevertheless assignable and
    different from methods', is very much a VB thing, you will have to use
    some sort of OLE-compatibility layer in other languages. I would have
    thought most languages that run on Win32 would have a standard COM
    binding, by now.

    If you are talking to your .Net app through some means other than COM,
    you will have to tell us more about what you are doing.

    Ben
     
    Ben Morrow, Nov 12, 2007
    #2
    1. Advertising

  3. Guest

    On Nov 12, 12:55 pm, Ben Morrow <> wrote:
    > Quoth :
    > > to read data from within VB, we can use syntax like VAR =
    > > OBJ.METHOD(PARAMS) and to write fields to an object from within VB
    > > it's also simple: OBJ.METHOD(PARAMS) = VAL.

    >
    > > only the read-style syntax works in exterior languages (Perl is our
    > > platform for proof-of-concept):

    >
    > > $val = $obj->method("param");

    >
    > > but the write-style syntax needs something different:

    >
    > > $obj->method("param") = $expr; # no way

    >
    > I don't know much about .Net, but when you say 'fields' here are you
    > referring to what Microsoft call 'properties' in OLE/COM? In that case,
    > that standard way to access COM objects from Perl is to use the
    > Win32::OLE module, which provides the syntax
    >
    > $obj->LetProperty('method', 'param', $expr);
    >
    > to perform what you are asking for above. See the docs for Win32::OLE.


    hmm. that doesn't look like...

    waitaminit:

    """
    The SetProperty() method allows to modify properties with
    arguments, which is not supported by the hash syntax. The hash form

    $Object->{Property} = $Value;

    is equivalent to

    $Object->SetProperty('Property', $Value);
    """

    so... if we're reading values via

    $stu = $students->Item( $ix );
    $fname = $stu->Fields( 31 );

    that implies that maybe we can do

    $stu->LetProperty('Fields',31,'Beelzebub');

    but there's no way that...

    it works! it really works! hoorah!

    big thanks, Ben, a blessing upon you and the horse you rode in on!
     
    , Nov 12, 2007
    #3
  4. Guest

    On Nov 12, 12:06 pm, wrote:
    > hi -- not sure where the best place would be to post this; please
    > point me elsewhere if there's another list more apropos...
    >
    > we've got two apps, one in java, one in .Net, and we're trying to put
    > some glue together to transfer data back and forth between them:
    >
    > - reading data FROM the .Net application is easy
    > - writing data TO the .Net application is a puzzle...
    >
    > to read data from within VB, we can use syntax like VAR =
    > OBJ.METHOD(PARAMS) and to write fields to an object from within VB
    > it's also simple: OBJ.METHOD(PARAMS) = VAL.
    >
    > only the read-style syntax works in exterior languages (Perl is our
    > platform for proof-of-concept):
    >
    > $val = $obj->method("param");
    >
    > but the write-style syntax needs something different:
    >
    > $obj->method("param") = $expr; # no way
    >
    > is there a standardized "write-to" syntax that non-VB languages can
    > take advantages?
    >
    > $obj->method("param")->let($expr); # for example
    > $obj->let($expr)->method("param"); # for example
    > $obj->let_method("param",$expr); # for example
    >
    > anybody know a FAQ or URL that'll point us in the right direction?


    SOLVED:

    > > to read data from within VB, we can use syntax like VAR =
    > > OBJ.METHOD(PARAMS) and to write fields to an object from within VB
    > > it's also simple: OBJ.METHOD(PARAMS) = VAL.


    > > only the read-style syntax works in exterior languages (Perl is our
    > > platform for proof-of-concept):


    > > $val = $obj->method("param");


    > > but the write-style syntax needs something different:


    > > $obj->method("param") = $expr; # no way


    > I don't know much about .Net, but when you say 'fields' here are you
    > referring to what Microsoft call 'properties' in OLE/COM? In that case,
    > that standard way to access COM objects from Perl is to use the
    > Win32::OLE module, which provides the syntax


    > $obj->LetProperty('method', 'param', $expr);


    > to perform what you are asking for above. See the docs for Win32::OLE.


    Win32::OLE manpage includes

    """
    The SetProperty() method allows to modify properties with
    arguments, which is not supported by the hash syntax. The hash form

    $Object->{Property} = $Value;

    is equivalent to

    $Object->SetProperty('Property', $Value);
    """

    so... if we're reading values via

    $stu = $students->Item( $ix );
    $fname = $stu->Fields( 31 );

    that implies that maybe we can do

    $stu->LetProperty('Fields',31,'Beelzebub');

    but there's no way that...

    it works! it really works! hoorah!
     
    , Nov 12, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    439
    Patricia Shanahan
    Aug 22, 2005
  2. paul
    Replies:
    4
    Views:
    279
    Michele Simionato
    Aug 3, 2003
  3. Replies:
    3
    Views:
    471
    John Bode
    Jul 29, 2005
  4. Josh Huber
    Replies:
    1
    Views:
    91
    Friedrich Dominicus
    Apr 10, 2004
  5. Ignoramus7272

    Dealing with a STRANGE API

    Ignoramus7272, Oct 6, 2006, in forum: Perl Misc
    Replies:
    2
    Views:
    99
    Ben Morrow
    Oct 7, 2006
Loading...

Share This Page