Search code examples
perlput

What does "$x->Put" do in Perl?


I am looking at this piece of code:

$diag_cmd = pack("CCSV", DIAG_SUBSYS_CMD_F, DIAG_SUBSYS_PWRDB, PWRDB_DIAG_PKT_SCRIPT | $processor_select, length($s_part)) . $s_part;

     $diag_request_var = Variant(VT_ARRAY | VT_UI1, length $diag_cmd);
  $diag_request_var->Put($diag_cmd);

where Variant is defined below:

sub Variant {
    return Win32::OLE::Variant->new(@_);
}

I am not sure what does it do and what does PUT actually do in Perl.

Any ideas?


Solution

  • Put is not a standard function that comes with Perl.

    In this case, you have an object named $diag_request_var which is of class Win32::OLE::Variant. Put is a method of this object.

    To know the standard functions that come with Perl, please see: perldoc perlfunc

    Reference

    Put(DIM, VALUE)