On Mon, Aug 23, 2004 at 09:54:05AM +0100 Nick Ing-Simmons wrote: > Bjoern Hoehrmann <[EMAIL PROTECTED]> writes: > >* Tassilo von Parseval wrote: > >>On Mon, Aug 23, 2004 at 08:14:45AM +0200 Bjoern Hoehrmann wrote: > >> > >>> Should my XS code check whether an object 'can' a specific method > >>> before calling call_method() for a reason other than performance? It > >>> seems that such a check is not commonly performed so it is probably > >>> not very important. > >> > >>Depends. When writing pure Perl code, do you usually check that a method > >>exists before you call it? I'd say no. However, sometimes you may want > >>to do it. The same is true for XS. If it's crucial not to trigger a > >>non-existent method, then do a preliminary check. > > > >Right, I looked at it in the context of optional event handlers where > >it is common that specific methods do not exist. In Perl, if $o->x is > >called even though there is no method x, Perl would die; so my question > >is rather whether call_method for a non-existant method has negative > >side-effects. > > Calling the method and catching the die via > > call_method("Not_there",G_SCALARX|G_EVAL); > > is what I do in Tk. But Tk has the G_EVAL there anyway so > that any die is reported in Tk context.
I was under the impression that G_EVAL catches errors that happen inside "Not_there" (now provided this method exists). So G_EVAL would eventually fill ERRSV with something like 'Can't locate object method "Not_there" via package...' if "Not_there" does not exist? Tassilo -- $_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({ pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#; $_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval