[Koha-bugs] [Bug 8761] New: Correct compile time warnings in C4::Circulation

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Sep 11 19:49:46 CEST 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8761

          Priority: P5 - low
 Change sponsored?: ---
            Bug ID: 8761
          Assignee: gmcharlt at gmail.com
           Summary: Correct compile time warnings in C4::Circulation
          Severity: minor
    Classification: Unclassified
                OS: All
          Reporter: colin.campbell at ptfs-europe.com
          Hardware: All
            Status: NEW
           Version: master
         Component: Architecture, internals, and plumbing
           Product: Koha

A recent enhancement to C4::Circulation has introduced some ambiguous
constructs which on current perls give compile time warnings with perl 5.16.0
or 5.16.1 
(I've not tested with older)
if you check compilation with perl -wc C4/Circulation.pm you get the following
warnings
Scalar value @values[$take] better written as $values[$take] at Circulation.pm
line 985.
Scalar value @alloweddate[0] better written as $alloweddate[0] at
Circulation.pm line 991.
Scalar value @alloweddate[1] better written as $alloweddate[1] at
Circulation.pm line 993.
Scalar value @alloweddate[2] better written as $alloweddate[2] at
Circulation.pm line 993.
Scalar value @alloweddate[2] better written as $alloweddate[2] at
Circulation.pm line 994.

Heres the doc from perlwarn

          (W syntax) You've used an array slice (indicated by @) to select a
single element of an
           array.  Generally it's better to ask for a scalar value (indicated
by $).  The difference
           is that $foo[&bar] always behaves like a scalar, both when assigning
to it and when
           evaluating its argument, while @foo[&bar] behaves like a list when
you assign to it, and
           provides a list context to its subscript, which can do weird things
if you're expecting
           only one subscript.

           On the other hand, if you were actually hoping to treat the array
element as a list, you
           need to look into how references work, because Perl will not
magically convert between
           scalars and lists for you.  See perlref.

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


More information about the Koha-bugs mailing list