in reply to •Re: Re: •Re: Re: •Re: Re: Say no to ref $thing eq "Expected::Type"
in thread Putting file contents into a scalar

There's nothing I can do in my wrapper class to make: UNIVERSAL::isa($object_of_my_class, "IO::File") return true.
Nothing? Nothing reliable, perhaps, but try
*UNIVERSAL::old_isa = *UNIVERSAL::isa; *UNIVERSAL::isa = sub { my($self,$pkg) = @_; return 1 if ref($self) eq 'MyClass' and $pkg eq 'IO::Handle'; return UNIVERSAL::old_isa(@_); }; package MyClass; sub new { bless {} } my $object_of_myclass = new MyClass(); my $rc = UNIVERSAL::isa($object_of_myclass, 'IO::Handle'); print $rc ? "It worked\n" : "Oh nuts\n";
And no, I'm not serious.

  • Comment on Re: •Re: Re: •Re: Re: •Re: Re: Say no to ref $thing eq "Expected::Type"
  • Select or Download Code

Replies are listed 'Best First'.
Re^7: Say no to ref $thing eq "Expected::Type"
by Aristotle (Chancellor) on Oct 30, 2002 at 13:05 UTC
    And no, I'm not serious.
    Caught me a split second before I hit "reply"..

    Makeshifts last the longest.