in reply to How can I get Perl via Carp, to SCREAM -- more informative output via cluck(),confess(),longmess()?

Any string starting with "cat" is true. or respects parentheses, so the confess&Co are never called. You probably wanted to move or outside the system argument list? In such a case, note that system returns 0 upon success.
(0 == system('cat', $file)) or confess();
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
  • Comment on Re: How can I get Perl via Carp, to SCREAM -- more informative output via cluck(),confess(),longmess()?
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: How can I get Perl via Carp, to SCREAM -- more informative output via cluck(),confess(),longmess()?
by taint (Chaplain) on Dec 06, 2013 at 17:23 UTC
    Thanks for the reply, choroba

    I replaced my call to system, with the one you noted. which returned

    cat: MYFILE: No such file or directory Undefined subroutine &main::confess called at ./tester.cgi line 17.
    Thanks again for the reply.

    --Chris

    Hey. I'm not completely useless. I can be used as a bad example.
    

      Undefined subroutine &main::confess

      This is because you forgot to import the confess function. You're importing cluck, longmess and shortmess but nothing else from Carp:

      use Carp qw(cluck longmess shortmess);

      Really, longmess and shortmess are unlikely to be much use in end-user code. They might be helpful if you were writing an extension to Carp.

      The four functions that are actually useful are croak, confess, carp, and cluck, and the least useful of these is cluck (which happens to be the only one of them that you're importing).

      use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
        Good points, tobyink.

        I should have caught the omission of confess, myself. Thanks for pointing it out. <blush>

        Thanks again.

        --Chris

        Hey. I'm not completely useless. I can be used as a bad example.