http://www.perlmonks.org?node_id=438766


in reply to This is not a pipe

! $this->isa("pipe")

Syntax is correct, though it will die in runtime because $this is not declared.

"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Replies are listed 'Best First'.
Re^2: This is not a pipe
by jhourcle (Prior) on Mar 13, 2005 at 23:59 UTC

    If you're worried about errors, I recommend instead:

    ! UNIVERSAL::isa($this, 'pipe')

    Just in case there's a possibility that $this might be undef, or an unblessed scalar.

      For poetry, I'm not worried about it. Syntax correctness is all that matters, and putting UNIVERSAL in there just adds clutter.

      "There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Re^2: This is not a pipe
by Revelation (Deacon) on Mar 16, 2005 at 22:49 UTC
    I think an easier way to prevent it from die-ing, would be to change that to:  !this->isa('pipe'); or  this->isa(!'pipe'); is another possibility. I agree the  Universal:: just add clutter.

    Gyan Kapur