Re: Object Introspection for Existence of Methods: How?

2015-03-20 Thread Tom Browder
On Mar 20, 2015 2:07 PM, "Will Coleda" wrote: > > > use Test; > > class bar { method foo () {}} > > ok bar.can("foo"), "stuff"; > ok 1 - stuff Oops (I say as I slap my forehead)! Thanks, Will. -Tom

Re: Object Introspection for Existence of Methods: How?

2015-03-20 Thread Will Coleda
> use Test; > class bar { method foo () {}} > ok bar.can("foo"), "stuff"; ok 1 - stuff On Fri, Mar 20, 2015 at 3:00 PM, Tom Browder wrote: > On Mar 20, 2015 1:50 PM, "Will Coleda" wrote: >> class bar { method foo () {}} >> my bar $a = bar.new(); >> say so $a.can("foo"); > > Great! > >> I'm not s

Re: Object Introspection for Existence of Methods: How?

2015-03-20 Thread Tom Browder
On Mar 20, 2015 1:51 PM, "Tobias Leich" wrote: > if $obj.^can($method_name) {... Thanks, Tobias. Cheers! -Tom

Re: Object Introspection for Existence of Methods: How?

2015-03-20 Thread Tom Browder
On Mar 20, 2015 1:50 PM, "Will Coleda" wrote: > class bar { method foo () {}} > my bar $a = bar.new(); > say so $a.can("foo"); Great! > I'm not sure this warrants a new _ok method. How would you do it with an existing test? Thanks, Will. Cheers! -Tom

Re: Object Introspection for Existence of Methods: How?

2015-03-20 Thread Tobias Leich
if $obj.^can($method_name) {... Am 20.03.2015 um 19:38 schrieb Tom Browder: > I am trying to create a testing subroutine to detect if a class object > has a certain method. > > I want it to look something like this: > > my $obj = Foo.new(); > can_ok($obj, 'method1'); > > sub can_ok($obj, Str

Re: Object Introspection for Existence of Methods: How?

2015-03-20 Thread Will Coleda
class bar { method foo () {}} my bar $a = bar.new(); say so $a.can("foo"); True my Int $b; say so $b.can("foo"); False I'm not sure this warrants a new _ok method. On Fri, Mar 20, 2015 at 2:38 PM, Tom Browder wrote: > I am trying to create a testing subroutine to detect if a class object > ha

Object Introspection for Existence of Methods: How?

2015-03-20 Thread Tom Browder
I am trying to create a testing subroutine to detect if a class object has a certain method. I want it to look something like this: my $obj = Foo.new(); can_ok($obj, 'method1'); sub can_ok($obj, Str $method_name) { if $obj.{$method_name}:exists { say "ok"; return True;

Re: Need help with: Cannot find method 'postcircumfix:<( )>'...

2015-03-20 Thread Tom Browder
On Thu, Mar 19, 2015 at 9:26 PM, Tom Browder wrote: > On Mar 19, 2015 8:58 PM, "Brandon Allbery" wrote: >> On Thu, Mar 19, 2015 at 9:32 PM, Tom Browder >> wrote: >>> >>> if (self.$elem) { # <=== LINE 995 === LINE 995 >> This is an indirect method call. Is that really what you

Re: Need help with: Cannot find method 'postcircumfix:<( )>'...

2015-03-20 Thread Moritz Lenz
On 03/20/2015 11:00 AM, Timo Paulssen wrote: On 03/20/2015 03:40 AM, Brandon Allbery wrote: On Thu, Mar 19, 2015 at 10:33 PM, Tom Browder mailto:tom.brow...@gmail.com>> wrote: Why do you say that is not a method? The first line says Sorry, somehow I managed to misread that. So you wa

Re: Need help with: Cannot find method 'postcircumfix:<( )>'...

2015-03-20 Thread Timo Paulssen
On 03/20/2015 03:40 AM, Brandon Allbery wrote: > > On Thu, Mar 19, 2015 at 10:33 PM, Tom Browder > wrote: > > Why do you say that is not a method? The first line says > > > Sorry, somehow I managed to misread that. > > So you want what I have already said twice: