[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#799097: mrtg-rrd: Regression after the fix for bug #787608.



On Fri, 13 Jan 2017 15:24:54 +0000, Damyan Ivanov wrote:

> Probably, but I can't do it promptly. I don't agree with the statement 
> that
> 
>    defined %{$hash{key}}
> 
> is better to be replaced with
> 
>    exists $hash{key}
> 
> than with
> 
>    %{$hash{key}}
> 
> (same for defined @{$hash{key}})

Agreed.

I just found
http://haroon.sis.utoronto.ca/rrd/scripts/
https://github.com/corporate-gadfly/rrd.cgi
which seems to be a fork of mrtg-rrd, and the git repo contains the
following 2 commits:

https://github.com/corporate-gadfly/rrd.cgi/commit/0a32136461c3033a000ec497c0922e24b2b3acb9
https://github.com/corporate-gadfly/rrd.cgi/commit/489d0990211793cd438bc90f8616cb6877baee10

perldiag says:

    Can't use 'defined(@array)' (Maybe you should just omit the defined()?)
        (F) defined() is not useful on arrays because it checks for an
        undefined scalar value. If you want to see if the array is empty, just
        use "if (@array) { # not empty }" for example.

    Can't use 'defined(%hash)' (Maybe you should just omit the defined()?)
        (F) "defined()" is not usually right on hashes.

        Although "defined %hash" is false on a plain not-yet-used hash, it
        becomes true in several non-obvious circumstances, including
        iterators, weak references, stash names, even remaining true after
        "undef %hash". These things make "defined %hash" fairly useless in
        practice, so it now generates a fatal error.

        If a check for non-empty is what you wanted then just put it in
        boolean context (see "Scalar values" in perldata):

            if (%hash) {
               # not empty
            }


BTW 1: It would be nice to have actual error messages instead of "is
a blank page".

BTW 2, the last release of mrtg-rrd is from 2003:
https://www.fi.muni.cz/~kas/mrtg-rrd/

Cheers,
gregor
 
-- 
 .''`.  https://info.comodo.priv.at/ - Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Various Artists: Couldn't Have Come At A Better Time

Attachment: signature.asc
Description: Digital Signature


Reply to: