PerlScript (WSH) - Cannot set property

Discussion in 'Perl Misc' started by Smugsboy, Mar 16, 2005.

  1. Smugsboy

    Smugsboy Guest

    Hi,
    I have an application which uses Microsoft's ScriptControl as a script
    host for PerlScript.
    I add an object to it that contains a property.

    When I try to read the propery I succeed using the following syntax:
    $MyObj->Prop1

    However, whem I try to write to the propery using the following syntax
    I get an error:
    $MyObj->Prop1 = 6;

    Any ideas ?
     
    Smugsboy, Mar 16, 2005
    #1
    1. Advertising

  2. Smugsboy

    Paul Lalli Guest

    "Smugsboy" <> wrote in message
    news:...
    > Hi,
    > I have an application which uses Microsoft's ScriptControl as a script
    > host for PerlScript.
    > I add an object to it that contains a property.
    >
    > When I try to read the propery I succeed using the following syntax:
    > $MyObj->Prop1
    >
    > However, whem I try to write to the propery using the following syntax
    > I get an error:
    > $MyObj->Prop1 = 6;
    >
    > Any ideas ?


    Several.

    What is the object? How was it created? How is Prop1 defined? What is
    the error you received?

    What you have just done is the equivalent of calling a mechanic, telling
    him "my car doesn't go forward. Any ideas?"

    Have you read the posting guidelines posted to this group twice a week?

    Paul Lalli
     
    Paul Lalli, Mar 16, 2005
    #2
    1. Advertising

  3. Smugsboy

    Smugsboy Guest

    MyObj is a .NET managed object declared in C# in the following way:
    class MyObj
    {
    MyObj() {}

    private int m_prop1;

    public int Prop1
    {
    get { return m_prop1; }
    set { m_prop1 = value; }
    }
    }

    It is added into Microsoft's Script Control and used through
    PerlScript.
    I need to add that accessing Prop1 works fine with VBScript & JScript.
    Any idea ?
    Thanks,

    Tim Hammerquist wrote:
    > Smugsboy <> wrote:
    > > When I try to read the propery I succeed using the following

    syntax:
    > > $MyObj->Prop1
    > >
    > > However, whem I try to write to the propery using the following
    > > syntax I get an error:
    > > $MyObj->Prop1 = 6;
    > >
    > > Any ideas ?

    >
    > You'll need to provide more information about $MyObj in order to get
    > a definitive answer. Also, hopefully someone more familiar with
    > WSH/PerlScript programming than me is lurking around here. I used
    > ASP/PerlScript about 5 years ago, but I haven't kept up.
    >
    > PerlScript lacks a lot of the syntactic sugar that makes VBScript

    look
    > so simple. E.g., "default objects." You'll probably need to take
    > a deeper look into the $MyObj object and see what, if anything, is

    going
    > on behind the scenes.
    >
    > HTH,
    > Tim Hammerquist
     
    Smugsboy, Mar 16, 2005
    #3
  4. "Smugsboy" <> wrote in news:1110989063.304894.6550
    @f14g2000cwb.googlegroups.com:

    > Hi,
    > I have an application which uses Microsoft's ScriptControl as a script
    > host for PerlScript.
    > I add an object to it that contains a property.
    >
    > When I try to read the propery I succeed using the following syntax:
    > $MyObj->Prop1
    >
    > However, whem I try to write to the propery using the following syntax
    > I get an error:
    > $MyObj->Prop1 = 6;


    I have never used PerlScript, but does the obvious way work?

    $MyObj->Prop1(6);

    Sinan.
     
    A. Sinan Unur, Mar 16, 2005
    #4
  5. Smugsboy

    Smugsboy Guest

    No it does not.
     
    Smugsboy, Mar 17, 2005
    #5
    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. Benjamin Bittner

    IISFAQ WSH Script in/to DotNet

    Benjamin Bittner, Jun 28, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    863
    M. Zeeshan Mustafa
    Jun 28, 2004
  2. David Josty

    wsh and Python

    David Josty, Apr 9, 2005, in forum: Python
    Replies:
    1
    Views:
    456
    Roger Upole
    Apr 10, 2005
  3. misiek3d
    Replies:
    1
    Views:
    379
    Dino Viehland
    Jun 28, 2007
  4. Guest
    Replies:
    2
    Views:
    140
    Guest
    Jul 30, 2004
  5. Guest
    Replies:
    6
    Views:
    138
    Joe Smith
    Jul 25, 2004
Loading...

Share This Page