| 1 | #!/usr/bin/perl -s | ||||||||||
| 2 | ## | ||||||||||
| 3 | ## Crypt::RSA::Debug | ||||||||||
| 4 | ## | ||||||||||
| 5 | ## Copyright (c) 2001, Vipul Ved Prakash. All rights reserved. | ||||||||||
| 6 | ## This code is free software; you can redistribute it and/or modify | ||||||||||
| 7 | ## it under the same terms as Perl itself. | ||||||||||
| 8 | ## | ||||||||||
| 9 | ## $Id: Debug.pm,v 1.9 2001/04/09 22:21:49 vipul Exp $ | ||||||||||
| 10 | |||||||||||
| 11 | package Crypt::RSA::Debug; | ||||||||||
| 12 | 9 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 9 | ▶ | use vars qw(@ISA @EXPORT_OK); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | 9 | require Exporter; | |||||||||
| 15 | 9 | @ISA = qw(Exporter); | |||||||||
| 16 | |||||||||||
| 17 | 9 | @EXPORT_OK = qw(debug debuglevel); | |||||||||
| 18 | |||||||||||
| 19 | 9 | my $DEBUG = 0; | |||||||||
| 20 | |||||||||||
| 21 | 11080 | ▶ | sub debug{ | ||||||||
|
Subroutine
debug: called CC=2 SCAR=15.6
Pod
documented
| |||||||||||
| 22 | 11080 | ▶ | return undef unless $DEBUG; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 0 | my ($caller, undef) = caller; | |||||||||
| 24 | 0 | my (undef,undef,$line,$sub) = caller(1); $sub =~ s/.*://; | |||||||||
| 25 | 0 | $sub = sprintf "%12s()%4d", $sub, $line; | |||||||||
| 26 | 0 | $sub .= " | " . (shift); | |||||||||
| 27 | 0 | $sub =~ s/\x00/[0]/g; | |||||||||
| 28 | 0 | $sub =~ s/\x01/[1]/g; | |||||||||
| 29 | 0 | $sub =~ s/\x02/[2]/g; | |||||||||
| 30 | 0 | $sub =~ s/\x04/[4]/g; | |||||||||
| 31 | 0 | $sub =~ s/\x05/[5]/g; | |||||||||
| 32 | 0 | $sub =~ s/\xff/[-]/g; | |||||||||
| 33 | 0 | $sub =~ s/[\x00-\x1f]/\./g; | |||||||||
| 34 | 0 | $sub =~ s/[\x7f-\xfe]/_/g; | |||||||||
| 35 | 0 | print "$sub\n"; | |||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | 0 | ▶ | sub debuglevel { | ||||||||
|
Subroutine
debuglevel: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 40 | |||||||||||
| 41 | 0 | my ($level) = shift; | |||||||||
| 42 | 0 | $DEBUG = $level; | |||||||||
| 43 | |||||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | =head1 NAME | ||||||||||
| 48 | |||||||||||
| 49 | Crypt::RSA::Debug - Debug routine for Crypt::RSA. | ||||||||||
| 50 | |||||||||||
| 51 | =head1 SYNOPSIS | ||||||||||
| 52 | |||||||||||
| 53 | use Crypt::RSA::Debug qw(debug); | ||||||||||
| 54 | debug ("oops!"); | ||||||||||
| 55 | |||||||||||
| 56 | =head1 DESCRIPTION | ||||||||||
| 57 | |||||||||||
| 58 | The module provides support for the I<print> method of debugging! | ||||||||||
| 59 | |||||||||||
| 60 | =head1 FUNCTION | ||||||||||
| 61 | |||||||||||
| 62 | =over 4 | ||||||||||
| 63 | |||||||||||
| 64 | =item B<debug> String | ||||||||||
| 65 | |||||||||||
| 66 | Prints B<String> on STDOUT, along with caller's function name and line number. | ||||||||||
| 67 | |||||||||||
| 68 | =item B<debuglevel> Integer | ||||||||||
| 69 | |||||||||||
| 70 | Sets the class data I<debuglevel> to specified value. The value | ||||||||||
| 71 | defaults to 0. Callers can use the debuglevel facility by | ||||||||||
| 72 | comparing $Crypt::RSA::DEBUG to the desired debug level before | ||||||||||
| 73 | generating a debug statement. | ||||||||||
| 74 | |||||||||||
| 75 | =back | ||||||||||
| 76 | |||||||||||
| 77 | =head1 AUTHOR | ||||||||||
| 78 | |||||||||||
| 79 | Vipul Ved Prakash, E<lt>mail@vipul.netE<gt> | ||||||||||
| 80 | |||||||||||
| 81 | =cut | ||||||||||
| 82 | |||||||||||
| 83 | 9 | 1; | |||||||||
| 84 | |||||||||||