Fred-Fish-DBUG

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

While I attempted to write good test cases, they can all pass and still
result in the module having issues.  Since what is important is what is actually
written to the log file!  So it's important for the developer (me) to remember
to actually look at the fish logs generated sometimes.

End users of this module (you) do not have to do this.  You can assume if all
the test cases pass it's good to use and install!


# =============================================================================
# C/C++ Macros vs Perl Functions
# -----------------------------------------------------------------------------
# C/C++ Macro Name | Perl Function Name   | Comments
# -----------------+----------------------+------------------------------------
DBUG_PUSH          | DBUG_PUSH            | Used to turn Fish on.
DBUG_ENTER         | DBUG_ENTER_FUNC      | Tracks entering a function.
  ---              | DBUG_EBTER_BLOCK     | Tracks entering a sub-block of code.
DBUG_PRINT         | DBUG_PRINT           | Writes message to fish logs.
DBUG_RETURN        | DBUG_RETURN          | Tracks one or more return values.
  ---              | DBUG_ARRAY_RETURN    | Handles returns of lists to scalars.
  ---              | DBUG_RETURN_SPECIAL  | Special case of DBUG_RETURN.
DBUU_VOID_RETURN   | DBUG_VOID_RETURN     | Tracks func return with no value.
DBUG_LEAVE         | DBUG_LEAVE           | Terminates your program.
DBUG_EXECUTE       | DBUG_EXECUTE         | Returns TRUE if writing to fish.
DBUG_FILE          | DBUG_FILE_HANDLE     | Return's the File Handle of fish.
DBUG_IN_USE        | DBUG_ACTIVE          | Returns TRUE if writing to fish.
DBUG_ASSERT        | DBUG_ASSERT          | If true & fish on, abort program.

# -----------------------------------------------------------------------------
# Not one of the C/C++ Macros, but added to support Perl functionality.
# -----------------------+-----------------------------------------------------
DBUG_CATCH               | Logs trapped exception.
DBUG_PAUSE               | Temporarily turns off fish logs.
DBUG_MASK                | Masks func return values written to fish.
DBUG_MASK_NEXT_FUNC_CALL | Masks func argument written to fish.
DBUG_FILTER              | Filter what's written to fish.
DBUG_CUSTOM_FILTER       | Filter what's written to fish.
DBUG_CUSTOM_FILTER_OFF   | Filter what's written to fish.
DBUG_SET_FILTER_COLOR    | Use color it the fish logs.
DBUG_FILE_NAME           | Returns the file name of the fish log.

README  view on Meta::CPAN


# -----------------------------------------------------------------------------
# NOTE: Trap signals with care.  On some OS, such as Windows, trapping
#       signals can be flakey!  But it's extremely useful on Unix.
# ----------------------------------------------------------------------------
DBUG_TRAP_SIGNAL         | Writes the tapped signal to fish.
DBUG_FIND_CURRENT_TRAPS  | Tells if a signal is currently trappable.
DBUG_DIE_CONTEXT         | Gives the context of the trapped signal.

# -----------------------------------------------------------------------------
# C/C++ Macro Name, but not relevant in Perl
# -----------------------------------------------------------------------------
DBUG_POP
DBUG_PROCESS
DBUG_SETJMP
DBUG_LONGJMP
DBUG_DUMP
DEBUGGER_OFF
DEBUGGER_ON
DBUG_LOCK_FILE
DBUG_UNLOCK_FILE

lib/Fred/Fish/DBUG/ON.pm  view on Meta::CPAN

         };
         if ( $@ ) {
            eval {
               # Throws exception if color value wasn't from a color macro!
               # Ex: use Term::ANSIColor qw(:constants); $color = RED;
               # Not all color macro values are escape sequences ...
               my @str = Term::ANSIColor::uncolor ($cm);
               foreach my $s ( @str ) {
                  $color_str .= color ($s);     # Makes sure always an escape sequence ...
               }
               # print STDERR "Valid Color Macro(s): '", join (", ", @str), "'\n";
            };
            if ( $@ ) {
               warn ("Invalid color string '$cm'.\nColor request reset to no colors for level $dbug_levels[$level]!\n");
               $color_str = "";
               last;
            }
         }
      }
   }



( run in 0.244 second using v1.01-cache-2.11-cpan-05444aca049 )