From: Rafael Garcia-Suarez Date: Fri, 8 May 2009 21:01:18 +0000 (+0200) Subject: Document what to do with object on the left and add some TODO tests for that X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d0b243e39ca09d7da156b4027255b58fa0a84810;p=p5sagit%2Fp5-mst-13.2.git Document what to do with object on the left and add some TODO tests for that --- diff --git a/pod/perlsyn.pod b/pod/perlsyn.pod index 9f964e0..038bcfa 100644 --- a/pod/perlsyn.pod +++ b/pod/perlsyn.pod @@ -687,8 +687,9 @@ The behaviour of a smart match depends on what type of thing its arguments are. The behaviour is determined by the following table: the first row that applies determines the match behaviour (which is thus mostly determined by the type of the right operand). Note that the smart match -implicitly dereferences any hash or array ref, so the "Hash" and "Array" -entries apply in those cases. +implicitly dereferences any non-blessed hash or array ref, so the "Hash" +and "Array" entries apply in those cases. (For blessed references, the +"Any" entry apply.) $a $b Type of Match Implied Matching Code ====== ===== ===================== ============= diff --git a/t/op/smartmatch.t b/t/op/smartmatch.t index 75c0ec0..8047451 100644 --- a/t/op/smartmatch.t +++ b/t/op/smartmatch.t @@ -200,6 +200,8 @@ __DATA__ qr// \&bar ! [1] \&foo ! {a=>1} \&foo + $obj sub { ref $_[0] =~ /NoOverload/ } TODO + $ov_obj sub { ref $_[0] =~ /CopyOverload/ } TODO # empty stuff matches, because the sub is never called: [] \&foo {} \&foo @@ -312,6 +314,10 @@ __DATA__ = \@nums @tied_nums = @nums @tied_nums +# - an object +! $obj @fooormore + $obj [sub{ref shift}] TODO + # - works with lists instead of arrays "foo" qw(foo bar) TODO "foo" ('foo','bar') TODO