“$x->Put"是什么意思?在 Perl 中做什么?

“$x->Put

问题描述:

我正在看这段代码:

$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);

其中 Variant 定义如下:

where Variant is defined below:

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

我不确定它的作用以及 PUT 在 Perl 中的实际作用.

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

有什么想法吗?

Put 不是 Perl 自带的标准函数.

Put is not a standard function that comes with Perl.

在本例中,您有一个名为 $diag_request_var 的对象,它属于 Win32::OLE::Variant.Put 是一个此对象的方法.

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.

要了解 Perl 自带的标准函数,请参阅:perldoc perlfunc

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

Put(DIM, VALUE)代码>