in reply to Wx::Carp - a replacement for Carp in Wx applications

I'm not a genius when it comes to modules... but didn't you just export Carp subs and rename them under Wx::Carp?

I'd love to know if I'm wrong, or missing something important.

Cheers,
ibanix

$ echo '$0 & $0 &' > foo; chmod a+x foo; foo;

Replies are listed 'Best First'.
Re: Re: Wx::Carp - a replacement for Carp in Wx applications
by PodMaster (Abbot) on Dec 26, 2002 at 04:43 UTC
    /me looks around a little confused
    but didn't you just export Carp subs and rename them under Wx::Carp?
    No, that's not all I did. Instead of warning or dieing, Wx::LogFatalError and Wx::LogWarning are called.

    I use Carp; all the time. When I write CGI apps, I use CGI::Carp, cause it does things appropriate for a CGI environment.

    Ah, that makes me think I should've put die and warn in there, i'll do that, thanks.

    ###################################################################### +####### ## Name: Carp.pm ## Purpose: Wx::Perl::Carp class (a replacement for Carp in Wx app +lications) ## Author: D.H. aka PodMaster ## Modified by: ## Created: 12/24/2002 ## RCS-ID: ## Copyright: (c) 2002 D.H. ## Licence: This program is free software; you can redistribute it + and/or ## modify it under the same terms as Perl itself ###################################################################### +####### =head1 NAME Wx::Perl::Carp - a replacement for Carp in Wx applications =head1 SYNOPSIS Just like L<Carp>, so go see the L<Carp> pod (cause it's based on L<Ca +rp>). # short example Wx::Perl::Carp; ... carp "i'm warn-ing"; croak "i'm die-ing"; =head1 SEE ALSO L<Carp> L<Carp> L<Carp> L<Carp> L<Carp> =head1 COPYRIGHT (c) 2002 D.H. aka PodMaster (a proud CPAN author) =cut package Wx::Perl::Carp; BEGIN { require Carp; require Wx; } use Exporter; @ISA = qw( Exporter ); @EXPORT = qw( confess croak carp die warn); @EXPORT_OK = qw( cluck verbose ); @EXPORT_FAIL = qw( verbose ); # hook to enable verbose mo +de sub export_fail { Carp::export_fail( @_) } # make verbose work for me sub croak { Wx::LogFatalError( Carp::shortmess(@_) ) } sub confess { Wx::LogFatalError( Carp::longmess(@_) ) } sub carp { Wx::LogWarning( Carp::shortmess(@_) ) } sub cluck { Wx::LogWarning( Carp::longmess(@_) ) } sub warn { Wx::LogWarning( @_ ) } sub die { Wx::LogFatalError( @_ ) } 1;
    update: i've renamed it to Wx::Perl::Carp in keeping with what Mattia setup.


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Ok, I think I get it now. You call Carp and pipe the output through Wx::LogFatalError or ::LogWarning; and that's what you get when you use Wx::Carp and then call carp "foo!" later.

      Am I right?

      $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
        Pretty much, except no piping is done ;)(argument passing)


        MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
        ** The Third rule of perl club is a statement of fact: pod is sexy.