Glib::Flags overload !=



This little program,

    use strict;
    use warnings;
    use Glib;
    my $p = Glib::ParamSpec->int ('x','x','',0,1,0, ['readable']);

    my $f1 = $p->get_flags;
    my $f2 = $p->get_flags;
    print "f1 ref is ", ref $f1, "\n";
    print "f1 != f2 is ", $f1 != $f2 ? "yes\n" : "no\n";

prints warnings

    Argument "[ readable ]" isn't numeric in numeric ne (!=) at foo.pl line 9.
    Argument "[ readable ]" isn't numeric in numeric ne (!=) at foo.pl line 9.

I saw in the Glib pod that "==" is overloaded, which made me try to use
"!=" too :-).  I wonder if that could be offered fairly easily.

I see "ne" works, but I suspect that's through stringizing (or at least
it reaches a print stuck into the overloaded '""').



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