in reply to Re: Re: Re: Walks like a regex, quacks like a regex...
in thread Walks like a regex, quacks like a regex...

Sweet -- this is exactly the discussion I wanted to see, and a nice answer. I thought of 'ref' earlier, but my perldoc tells me:
Builtin types include:

  SCALAR
  ARRAY
  HASH
  CODE
  REF
  GLOB
  LVALUE
...so I didn't think it was possible. Thank you.
--
man with no legs, inc.
  • Comment on Son of the Bride of Walks like a regex, quacks like a regex...

Replies are listed 'Best First'.
Re: Son of the Bride of Walks like a regex, quacks like a regex...
by diotalevi (Canon) on Sep 24, 2003 at 04:26 UTC

    In the years since I've written this node, UNIVERSAL::isa has been published. Use that instead.


    In that case you should use isa() and test for 'Regex'. You'll allow for blessed regexen this way. Simple ref() tests don't account for that.

    *isa = \&UNIVERSAL::isa; sub regex_tester { my $thingie = shift; return isa( $thingie, 'Regex' ); }