Re: Unexplained behavior with signal_connect and references

On 12/17/00 Hunter Thomas wrote:
sub SetTopWin
              my ($app ,$name) = @_; #reference to top window, and it's
              $$app = new Gnome::App $name, $name;

              signal_connect $$app 'delete_event', sub { Gtk->main_quit;
return 0 };

So, up pops a nice little window that doesn't do much, but perl does exit
when I press the close button. The odd bit is, when I run it, I also get
this error message in my console:

String found where operator expected at ./ line 22, near "$app
      (Missing operator before 'delete_event'?)

So, what is it that's going wrong here? If it's me, how do I fix it? It
doesn't stop the code from running, but it's annoying to have any warning
messages at all.

Try using parens, like:
        signal_connect $$app ('delete_event', sub { Gtk->main_quit; return 0});

This has nothing to do specifically with gtk-perl, of course:-)


lupus debian org                                     debian/rules
lupus helixcode com                          Monkeys do it better

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