Carl Jolley wrote:
> On Fri, 5 Jan 2001, Martin Moss wrote:
>
> > All,
> >
> > I'm trying to write a callback process in a script I'm writing.
> > Basically I have a reference to a subroutine, and I want to
> execute that
> > subroutine and pass it some parameters,
>
> I'm not sure exactly wha
Martin Moss wrote:
> Ah, that's what I'd thought to do, however I think I've
> missed a step. I want to hide the subroutine referencing
> code from the user thus I want to do something like this:-
>
>
> my $Papp = new iBus::Papp('debug' => 1, 'callback' => "::MySub", 'LogFile'
=> '/var/log/MyPa
Martin Moss wrote:
> how can I tell that the reference I've been given is
> actually a reference to a subroutine?
print "subref" if ref($callback) && ref($callback) eq 'CODE';
perldoc -f ref
ref returns undef if the variable is not a reference, and 'CODE' for a
subref.
Cheers,
Philip
_