Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: variable access

by marto (Cardinal)
on Jan 06, 2015 at 09:58 UTC ( [id://1112316]=note: print w/replies, xml ) Need Help??


in reply to variable access

$tura is declared within subroutine tura you need to return the value rather than print it. See also perlsub and Coping with Scoping.

Replies are listed 'Best First'.
Re^2: variable access
by aioan1 (Acolyte) on Jan 06, 2015 at 12:21 UTC
    I used "return" but no result. I cheked "perlsub" before asking for help.
      I used "return" ...

      But how did you use return? Are you saying that adding the statement
          return $tura;
      after the debug print statement that showed you that  $tura was something you expected and then assigning the returned value to another lexical
          my $other_lexical = tura();
      passed nothing back from the subroutine? This seems doubtful...


      Give a man a fish:  <%-(-(-(-<

        passed nothing back from the subroutine? This seems doubtful...

        You don't return from a callback :) unless the caller expects you to return ... Tk usually doesn't expect return values from callbacks ... op either needs to stuff $tura into a widget, or another object, which is done by giving it the object/widget as reference, or making the object/widget a global

        this means

        sub tura { ... $globals{tura} = $tura; ... -browsecmd => [ \&tura, \%globals ], ... sub tura { ... my( $globals_ref ) = @_; $globals_ref->{tura} = $tura; + ... -browsecmd => [ \&tura, \$original_tura ], ... sub tura { ... my( $tura_ref ) = @_; $$tura_ref = $tura;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1112316]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found