Re: RFC: Package == class == object type

From: Paul Johnson (paul_at_pjcj.net)
Date: 01/13/04


Date: Tue, 13 Jan 2004 16:26:35 +0100 (CET)
To: "James Edward Gray II" <james@grayproductions.net>


>> 2) What I do with the data will obviously depend on the program using
>> my
>> object, but would probably be things like update the screen (Term, TK,
>> Win32), or to send instructions to a control system (e.g. throw points
>> on
>> model railway).
>>
>> What is the best method to pass control back to the program from
>> within a
>> method?
>
> I don't think I understand this question. The obvious answer to me is
> return (exit the method). Control will pass back to the caller at this
> point, as it always does. If I misunderstood, please try explaining it
> again.

I expect you are looking for callbacks here. The caller passes in a sub
(reference) which you call from within the method.

$obj->meth(sub { my ($oomph, $time) = @_; print "Oomph is $oomph at $time" })

and in the module

sub meth
{
    my $self = shift;
    my ($callback) = @_;
    my ($oomph, $time) = ...
    $callback->($oomph, $time);
}

-- 
Paul Johnson - paul@pjcj.net
http://www.pjcj.net


Relevant Pages

  • Re: Defaulting to a control
    ... record will take you our of the last control you were in and then fire the ... Try placing [Caller Detail].SetFocus in a button ClickEvent with the Button ... > When I then go to to create a new record I remain on the TabControlPage ... > Sue Compelling ...
    (microsoft.public.access.formscoding)
  • Re: Opening a pop-up window from code behind page
    ... "bruce barker" wrote: ... > you web button should open a window that calls an aspx page. ... > page can fetch values from the caller. ... >> I have a WebControls.Button control on a page. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Ownership and dispose
    ... which adds an item to the list control. ... and verge on the safe side (assume the control keeps a reference). ... This is important to the caller, because if a reference is kept, the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Kurt Harrington Lochner- "Queen Bitch of Empty Threats" - Admits Defeat By Threatening t
    ... Control gets you sexually excited, then you, my boy, have problems far ... CALLER: Someone just told me how to commit suicide! ... CALLER: KURT! ... Hold on a second while I consult with my superiors, sir. ...
    (talk.politics.guns)