in reply to Re^3: Right-click Edit/Paste in TK Browse Entry
in thread Right-click Edit/Paste in TK Browse Entry

Welcome, see The Perl Monks Guide to the Monastery, new questions go in Seekers Of Perl Wisdom, because the person whom you're asking a question was last here 46 weeks ago

Is this something anyone can answer from what I've described?

Absolutely, see

$ perl -Mdiagnostics -e " rand()->menu " Can't call method "menu" without a package or object reference at -e l +ine 1 (#1) (F) You used the syntax of a method call, but the slot filled by t +he object reference or package name contains an expression that retur +ns a defined value which is neither an object reference nor a package n +ame. Something like this will reproduce the error: $BADREF = 42; process $BADREF 1,2,3; $BADREF->process(1,2,3); Uncaught exception from user code: Can't call method "menu" without a package or object reference + at -e line 1. at -e line 1.

That may or may not help you :)

If not, I'm happy to cook up some sample code to reproduce this problem.

That is the general idea behind How do I post a question effectively?. Write-it up and post in Seekers Of Perl Wisdom

Replies are listed 'Best First'.
Re^5: Right-click Edit/Paste in TK Browse Entry
by phatWares (Initiate) on Jul 11, 2012 at 12:00 UTC

    Thanks for your reply! I'm just here to say that I figured out (sort of) what was causing the problem ...

    my $mw = MainWindow->new(); my $widget = $mw->SomeWidget(\%some_options)->pack()->focus(); &add_edit_popup($mw, $widget); $mw->MainLoop;

    This will fail. However ...

    my $mw = MainWindow->new(); my $widget = $mw->SomeWidget(\%some_options)->pack(); &add_edit_popup($mw, $widget); $mw->MainLoop;

    This will succeed. The difference is not placing the focus() call in the declaration of the widget. If you do it later in the code using ...

    $widget->focus();

    Then you're golden!

    I'm sure there's a perfectly good explanation for this behavior. What that might be is beyond my Perl knowledge.

    Anyway, BIG thanks to all for your help!

      I'm sure there's a perfectly good explanation for this behavior. What that might be is beyond my Perl knowledge.

      That technique is called method chaining, see chaining method calls

      pack returns the object being packed (it chains), but focus doesn't