File: run3profpp

package info (click to toggle)
libipc-run3-perl 0.036-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 152 kB
  • ctags: 82
  • sloc: perl: 1,016
file content (103 lines) | stat: -rw-r--r-- 1,982 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/usr/local/bin/perl -w

$VERSION = 0.000_1;

=head1 NAME

run3profpp - Report on IPC::Run3 profiling data

=head1 SYNOPSIS

    $ run3profpp [<profile_file_name>]

=head1 DESCRIPTION

IPC::Run3 may be run with profiling data enabled.  It may report as it runs
or dump all of the data to a file.  This program reads that file and generates
reports based on it.

The default filename is run3.out.

=cut

use strict;
use Getopt::Long;

sub _program_name {
    require File::Basename;
    File::Basename::basename( $0 );
}

sub _usage {
    my ( $message ) = @_;
    ## Don't slow execution by always loading a rarely needed module.
    ## At least, we hope it's rarely needed.
    require Pod::Usage;

    $message = "Unkown error (message not provided)"
        if defined $message && ! length $message;

    my $help_mode = ! defined $message;

    my $exitval = $help_mode ? 0 : do {
        # The "message" may be a simple number, in which case it's an
        # exit value.
        $message =~ s/\A(\d+)\z// ? $1 : 1
    };

    Pod::Usage::pod2usage(
        -verbose => $help_mode ? 2 : 1,
        defined $message && length $message
            ? ( -message => $message )
            : (),
        -exitval => $exitval,
    );
}

=head1 OPTIONS

=over

=item --help, -h, -?

Print out full help text.

=back

=cut

GetOptions(
    "help|h|?" => sub { _usage },
) or _usage 1;

# _usage "Too few paramaters"  unless @ARGV > 0;
# _usage "Too many paramaters" if     @ARGV > 0;

###############################################################################
#
# Main program body
#

#
# End of the main program body
#
###############################################################################

=head1 LIMITATIONS

=head1 COPYRIGHT

    Copyright 2003, R. Barrie Slaymaker, Jr., All Rights Reserved

=head1 LICENSE

You may use this module under the terms of the BSD, Artistic, or GPL licenses,
any version.

=head1 AUTHOR

Barrie Slaymaker <barries@slaysys.com>

=cut

1;