File: module-size

package info (click to toggle)
libmemory-usage-perl 0.201-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 164 kB
  • sloc: perl: 1,361; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl
use strict;
use warnings;
use Memory::Usage;

if( scalar @ARGV < 1 ) {
	die "Usage: $0 Module::Name\n";
}

my $m = Memory::Usage->new();
$m->record('Base perl plus Memory::Usage');
foreach my $module_name (@ARGV) {
	eval "use $module_name";
	warn $@ if $@;
	$m->record("after 'use $module_name'");
}

$m->dump();

__END__

=head1 NAME

module-size -- Spit out estimated size of module code.

=head1 SYNOPSIS

    module-size Some::Module::Name [ Other::Module ]

=head1 DESCRIPTION

Reports the process size after 'use'ing a module.  If more than one module name
is provided, the modules are included in order, allowing you to compare (for
example) the incremental effect of adding other modules to an existing
application.

=head1 SEE ALSO

L<Memory::Usage>, 

=head1 LICENCE AND COPYRIGHT

Copyright 2010 Dave O'Neill.

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

=cut