[Koha-bugs] [Bug 36419] New: Ambiguous return value in GetPlugins

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Mar 25 18:01:32 CET 2024


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36419

            Bug ID: 36419
           Summary: Ambiguous return value in GetPlugins
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: tomascohen at gmail.com
        QA Contact: testopia at bugs.koha-community.org

Bug 35536 introduced some better error handling, but made the return value more
erratic.

We you previously had code like this:

```perl
    my @plugins = Koha::Plugins->new()->GetPlugins(
        {
            method   => 'ill_backend',
            metadata => { name => $backend_id },
            all      => 1,
            errors   => 1
        }
    );

    foreach my $plugin (@plugins) { ... }
```

And now the new return value for GetPlugins is:

```perl
    return $errors ? ( \@plugins, \@failing ) : @plugins;
```

This means the caller will need to check the return value, and if the arity is
two (?), check that the second element has some specific structure so we
determine... it is not actually a plugin!

I propose we return a hashref with the plugins and (possibly) the errors.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list