in reply to Re: Import constants?
in thread Import constants?

Ok, then I will choose c :-) I don't understand how and in which order to put the different pieces.

Replies are listed 'Best First'.
Re^3: Import constants?
by almut (Canon) on Aug 05, 2010 at 08:37 UTC

    Try something like

    use DBIx::Log4perl qw(:masks); $DBIx::Log4perl::LogMask = DBIX_L4P_LOG_OUTPUT | DBIX_L4P_LOG_INPUT;

    The values of the constants represent individual bits being set, i.e.

    (binary) DBIX_L4P_LOG_INPUT 1 00000001 DBIX_L4P_LOG_OUTPUT 2 00000010

    Each bit activates a certain functionality. You can combine them using bitwise or (|), e.g.

    00000001 00000010 -------- 00000011

    The resulting value has all bits set which were set in any of the or'ed input values.

      Maybe:

      use DBIx::Log4perl qw(:masks); my $dbh = DBIx::Log4perl->connect(...); $dnh->dbix_l4p_setattr( 'dbix_l4p_logmask', DBIX_L4P_LOG_TXN | DBIC_L4P_LOG_CONNECT | DBIX_L4P_LOG_INPUT | DBIX_L4P_LOG_ERRCAPTURE | DBIX_L4P_LOG_ERRORS | DBIX_L4P_LOG_DBDSPECIFIC ); ...

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        Unfortunately it didn't do any difference.

        I'm doing the following:
        use Log::Log4perl; use DBIx::Log4perl qw(:masks); Log::Log4perl->init("myconfigfile.cfg"); $dbh = DBIx::Log4perl->connect($DSN, "user", "pass"); $dbh->dbix_l4p_setattr( 'dbix_l4p_logmask', DBIX_L4P_LOG_TXN | DBIC_L4P_LOG_CONNECT | DBIX_L4P_LOG_INPUT | DBIX_L4P_LOG_ERRCAPTURE | DBIX_L4P_LOG_ERRORS | DBIX_L4P_LOG_DBDSPECIFIC ); ...
        Maybe my problem is related to my usage of the config file?
      I get
      Can't locate auto/DBIx/Log4perl/st/_dbix_l4p_p.al in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.10.0/DBIx/Log4perl/st.pm line 281
      when running it, so mayme i'm missing something?

        Could you show the exact code that produces the problem?

        With the following test I can't replicate the issue:

        #!/usr/bin/perl -l use DBIx::Log4perl qw(:masks); $DBIx::Log4perl::LogMask = DBIX_L4P_LOG_OUTPUT | DBIX_L4P_LOG_INPUT; print $DBIx::Log4perl::LogMask;

        (prints '3', as expected)

        From a quick look at the code, I would say try replacing line 277 in DBIx/Log4perl/st.pm

        $sth->_dbix_l4p_perl(2, # line 277 sub {Data::Dumper->Dump( [$res], ["fetchrow_hashref($h->{dbh_no}.$sth->{private_DBIx_st_no} +)"])}) if ($h->{logmask} & DBIX_L4P_LOG_OUTPUT);

        with

        $sth->_dbix_l4p_debug($h, 2, # line 277 ...

        AFAICT, there is no method _dbix_l4p_perl in any of the related packages (while there are similarly named ones like ..._debug, ..._info, etc.).  No guarantees, though (untested).

        That was a bug in DBIx::Log4perl and is fixed in 0.22 which I've just uploaded. I didn't see your thread even though I am a perl monk because your subject did not grab me and I don't have time to read every one - perhaps there is a lesson to be learnt there. The fix correctly identified elsewhere in this thread is trivial and a little embarrassing although I have to admit to not using the OUTPUT logging in my own projects.