Hi Perl Monks I've been using the Perl OLE module on a few COM based libraries and I am now using it with the Windows Installer MSI.dll. I did start using the CPAN Win32::MSI::DB module but there is very little information on this module and the documentation is very poor so I ran into difficulties.
Now, I've started using it with great results so far but I cannot seem to get the modification of MSI table data to work. If I create a new empty record (see code snippet below) and assign values to this record using either String or Integer data, I get "Can't modify non-lvalue subroutine call" errors when I try and assign a value.
$newRecord->IntegerData(1) = 0;

Can anyone shed any light on this please?

I guess I must be missing something fundamental.

Regards

Ant H

---Code Snippet---
$MSIObject = CreateObject Win32::OLE 'WindowsInstaller.Installer'; if (defined ($MSIObject)) { print "Object Available\n"; $dbReference = $MSIObject->OpenDatabase("C:\\temp\\AppsenseApplica +tionManager.msi", 1); # Create SQL query to obtain required data $query = "SELECT * FROM Feature WHERE Feature = " . "'Agent'"; # Create a database view based on the query $view = $dbReference->OpenView($query); # Execute the query $results = $view->Execute(); # fetch the first data set based on the query $record = $view->Fetch(); if ($record) { print "Field = " . $record->StringData(0) . "\n"; print "Field = " . $record->StringData(1) . "\n"; print "Field = " . $record->StringData(2) . "\n"; print "Field = " . $record->StringData(3) . "\n"; print "Field = " . $record->StringData(4) . "\n"; print "Field = " . $record->StringData(5) . "\n"; print "Field = " . $record->StringData(6) . "\n"; print "Field = " . $record->StringData(7) . "\n"; print "Field = " . $record->StringData(8) . "\n"; } else { print "Record is undefined!\n" } print $record->FieldCount(); $newRecord = $MSIObject->CreateRecord($record->FieldCount()); **** FAILS to assign this value **** $newRecord->IntegerData(1) = 0; $record->Modify(6, $newRecord);

In reply to Help with OLE module and MSI files by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.