in reply to Re: READDIR and DBI
in thread READDIR and DBI

what sort of magic is that ?
$sth->execute_array({ ArrayTupleStatus => \my @tuple}) or die $sth->er
never see it before! what does it do?

Replies are listed 'Best First'.
Re^3: READDIR and DBI
by pryrt (Abbot) on Feb 26, 2024 at 20:53 UTC

    what sort of magic is that ?

    $sth->execute_array({ ArrayTupleStatus => \my @tuple}) or die $sth->errstr;

    It depends on which portion of that line seems like "magic" to you.

    • LanX answered with the execute_array description.
    • ArrayTupleStatus is described in the DBI bind_param_array and execute_array documentation.
    • \my @tuple syntax is shown in the examples of that DBI documentation. The concept of creating an array and immediately getting a reference to that array is described in perlref: Assigning-to-References, and is essentially shorthand for calling my @tuple; in one line and then using \@tuple in the execute_array() call to pass the reference to the function. (This is my best guess as to what you would consider the "magic" portion of that line of code.)
    • or die $sth->errstr is the typical way to raise an error with DBI, unless you use RaiseError
Re^3: READDIR and DBI
by LanX (Saint) on Feb 26, 2024 at 18:27 UTC
Re^3: READDIR and DBI
by justin423 (Scribe) on Feb 26, 2024 at 18:05 UTC

    You and me both....

    But it works...