Give C4::Debug an import() function like this:

sub import {
        if ($debug) {
                require Smart::Comments;
                Smart::Comments->import;
                require Data::Dumper;
                Data::Dumper->import;
        }
        C4::Debug->export_to_level(1, @_);
}

That should do the trick.

On Mon, Feb 9, 2009 at 9:11 PM, Mason James <mason.loves.sushi@gmail.com> wrote:

On 2009/02/10, at 6:01 PM, Mason James wrote:

> Hi Koha developers,
>
> I have been talking with John and Paul at BibLibre for some months
> now about a
> correct way to add Data::Dumper, Smart::Comments,
> insert::your::favorite::debugger stuff
> to the Koha perl files *once and for all*
>
>
> After a few false starts and some googling - this is the method I
> have used and tested...
>
>
> use C4::Debug;
> use if $debug, 'Data::Dumper' ;
> use if $debug, 'Smart::Comments' ;
> # use if $debug, 'YAML::Dumper;   # etc....
>

> Is there a better way than this?


A question from me too..

Is there a clever way to add this code to *just* Debug.pm which would
enable D::D and S::C functionality to all perl files that 'use
C4::Debug'?

That would be the cleanest way, i think - but i don't know how to do
this, or if it's possible in perl :/

anyone?



_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-devel