I have this vb code that works like it is supposed to but I would like to write it in perl but I am having a little trouble with the conversion.
Here is the vb code
And here is what I tried with the perl code
The open and login work fine as it should but when it gets down to adding a new record I get
"Can't call method "NewRecord" on an undefined value"
Any thoughts?
Here is the vb code
Code:
Dim DB
Set DB = WScript.CreateObject("object.Name")
DB.Open "Param1", "Param2", "Param3", "Param4"
DB.Login "Username", "Password"
DB.Contact.NewRecord
DB.Contact.Value("LAST_NAME") = "Ztester"
DB.Contact.Value("FIRST_NAME") = "Ztest"
DB.Contact.Update
DB.Logout
DB.Close
WScript.Quit
And here is what I tried with the perl code
Code:
use Win32::OLE;
my $DB;
$DB = Win32::OLE->new('object.name');
$DB->Open('param1', 'param2', 'param3', 'param4');
$DB->Login('username', 'password');
$DB->Contact->NewRecord();
$DB->Contact->SetProperty("Value", 'FIRST_NAME', 'zTest');
$DB->Contact->SetProperty("Value", 'LAST_NAME', 'zTester');
$DB->Contact->Update();
$DB->Logout();
$DB->Close();
exit 0;
The open and login work fine as it should but when it gets down to adding a new record I get
"Can't call method "NewRecord" on an undefined value"
Any thoughts?