in reply to Re: problem with script transfered from VBS
in thread problem with script transfered from VBS

thanks for your reply. I've tried: $rs->Fields('AEName')->value = $psProxyName; $rs->Fields('ADAS_ID')->value = $nDeviceID; but throw the same error, Can't modify non-lvalue subroutine call at cmp2.pl line 60. How can I do?

I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
  • Comment on Re^2: problem with script transfered from VBS

Replies are listed 'Best First'.
Re^3: problem with script transfered from VBS
by Bloodnok (Vicar) on Aug 06, 2008 at 12:16 UTC
    No problem :-)

    Looking again at your original change, it was in the context of using value as a method to get the current value for an assignment.

    You could try, instead of $rs->Fields('AEName')->value = $psProxyName;, $rs->Fields('AEName')->value($psProxyName);...

    At last, a user level that overstates my experience :-))
      Thanks for your prompt reply! I don't need to drain my brain as much since I got your help.
      I've tried as your suggestion, the good news is perl didn't throw any error. the bad news is it did do anything!:(
      I place print $rs->Fields('AEName')->value($psProxyName) after and before the statment. below are output
      VB script: wscript.echo "AEName old value is" wscript.echo rs.Fields( "AEName" ).value wscript.echo "ADAS_ID old value is" wscript.echo rs.Fields( "ADAS_ID" ).value rs.Fields( "AEName" ) = psProxyName rs.Fields( "ADAS_ID" ) = pnDeviceID wscript.echo "AEName new value is" wscript.echo rs.Fields( "AEName" ).value wscript.echo "ADAS_ID new value is" wscript.echo rs.Fields( "ADAS_ID" ).value wscript.echo rs.Fields( "AEName" ).value wscript.echo rs.Fields( "ADAS_ID" ).value __OUTPUT__ C:\>cscript cmp.vbs Microsoft (R) Windows Script Host Version 5.6 Copyright (C) Microsoft Corporation 1996-2001. All rights reserved. AEName old value is Mp_Default ADAS_ID old value is null AEName new value is MyTestMeterProxy06 ADAS_ID new value is 1415 Meter proxy created having the ID: 673132 Script Finished
      perl script print "ADAS_ID old value is", $rs->Fields('ADAS_ID')->value."\n"; print "AEName old value is", $rs->Fields('AEName')->value."\n"; print "\$psProxyName value is $psProxyName\n"; print "\$pnDeviceID value is $pnDeviceID\n"; $rs->Fields('AEName')->value($psProxyName); $rs->Fields('ADAS_ID')->value($pnDeviceID); print "ADAS_ID new value is", $rs->Fields('ADAS_ID')->value."\n"; print "AEName new value is", $rs->Fields('AEName')->value."\n"; $nCheckoutID = $ctMgr->Checkout($pnContainerID, $aSec); __OUTPUT__ C:\>perl cmp2.pl ADAS_ID old value is AEName old value isMp_Default $psProxyName value is MyTestMeterProxy010 $pnDeviceID value is Win32::OLE=HASH(0x1987448) ADAS_ID new value is AEName new value isMp_Default Meter proxy created having the ID: Script Finished
      I'm confused with output above. It seems to me '->value($psProxyName)' doesn't work?
      How can I continue?

      BTW: what can I benifit from overstating my experience?

      I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
        Hi ,

        Although the you didn't get a compile-time error, you may have experienced a run-time error - which wasn't caught.

        If it's the basic Win32::OLE module, any error from the last operation can be accessed via a call to Win32::OLE->LastError(), so try ...

        $rs->Fields('AEName')->value($psProxyName); die "value(\$psProxyName) failed - " . Win32::OLE->LastError() if Win3 +2::OLE->LastError();

        BTW, my sig is self-deprecating - it says that PM has a higher regard for my experience than I do;-)

        A user level that continues to overstate my experience :-))