← Index
NYTProf Performance Profile   « block view • line view • sub view »
For ddd2.pl
  Run on Tue May 25 16:52:24 2010
Reported on Tue May 25 16:56:47 2010

File /project/perl/lib/UNIVERSAL/moniker.pm
Statements Executed 2
Statement Execution Time 20µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
650410753.3ms53.3msUNIVERSAL::::canUNIVERSAL::can (xsub)
3737168.04ms8.04msUNIVERSAL::::VERSIONUNIVERSAL::VERSION (xsub)
5698643µs643µsUNIVERSAL::::isaUNIVERSAL::isa (xsub)
0000s0sUNIVERSAL::::monikerUNIVERSAL::moniker
0000s0sUNIVERSAL::::plural_monikerUNIVERSAL::plural_moniker
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package UNIVERSAL::moniker;
217µs$UNIVERSAL::moniker::VERSION = '0.08';
3
4=head1 NAME
5
6UNIVERSAL::moniker
7
8=head1 SYNOPSIS
9
10 use UNIVERSAL::moniker;
11
12=head1 DESCRIPTION
13
14Class names in Perl often don't sound great when spoken, or look good when
15written in prose. For this reason, we tend to say things like "customer" or
16"basket" when we are referring to C<My::Site::User::Customer> or
17C<My::Site::Shop::Basket>. We thought it would be nice if our classes knew what
18we would prefer to call them.
19
20This module will add a C<moniker> (and C<plural_moniker>) method to
21C<UNIVERSAL>, and so to every class or module.
22
23=head2 moniker
24
25 $ob->moniker;
26
27Returns the moniker for $ob.
28So, if $ob->isa("Big::Scary::Animal"), C<moniker> will return "animal".
29
30=head2 plural_moniker
31
32 $ob->plural_moniker;
33
34Returns the plural moniker for $ob.
35So, if $ob->isa("Cephalopod::Octopus"), C<plural_moniker> will return "octopuses".
36
37(You need to install Lingua::EN::Inflect for this to work.)
38
39=cut
40
41package UNIVERSAL;
42
43sub moniker {
44 (ref( $_[0] ) || $_[0]) =~ /([^:]+)$/;
45 return lc $1;
46}
47
48sub plural_moniker {
49 CORE::require Lingua::EN::Inflect;
50 return Lingua::EN::Inflect::PL($_[0]->moniker);
51}
52
53=head1 AUTHORS
54
55Marty Pauley <marty+perl@kasei.com>,
56Tony Bowden <tony@kasei.com>,
57Elizabeth Mattijsen <liz@dijkmat.nl>
58
59(Yes, 3 authors for such a small module!)
60
61=head1 COPYRIGHT
62
63 Copyright (C) 2004 Kasei
64
65 This program is free software; you can redistribute it under the same terms as
66 Perl.
67
68 This program is distributed in the hope that it will be useful, but WITHOUT
69 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
70 FOR A PARTICULAR PURPOSE.
71
72=cut
73
74
75113µs1;
# spent 8.04ms within UNIVERSAL::VERSION which was called 37 times, avg 217µs/call: # once (272µs+0s) by Net::HTTP::Methods::zlib_ok at line 10 of IO/Compress/RawDeflate.pm # once (256µs+0s) by base::import at line 8 of SQL/Abstract/Limit.pm # once (247µs+0s) by Net::HTTP::Methods::zlib_ok at line 15 of IO/Compress/Gzip.pm # once (238µs+0s) by Net::HTTP::Methods::zlib_ok at line 16 of IO/Compress/Gzip.pm # once (236µs+0s) by Net::HTTP::Methods::zlib_ok at line 144 of IO/Compress/RawDeflate.pm # once (234µs+0s) by Net::HTTP::Methods::zlib_ok at line 7 of IO/Compress/Adapter/Deflate.pm # once (233µs+0s) by Net::HTTP::Methods::zlib_ok at line 17 of IO/Uncompress/Base.pm # once (229µs+0s) by Net::HTTP::Methods::zlib_ok at line 11 of IO/Compress/Gzip.pm # once (229µs+0s) by Net::HTTP::Methods::zlib_ok at line 520 of Net/HTTP/Methods.pm # once (228µs+0s) by Net::HTTP::Methods::zlib_ok at line 145 of IO/Compress/RawDeflate.pm # once (226µs+0s) by Net::HTTP::Methods::zlib_ok at line 11 of IO/Uncompress/RawInflate.pm # once (225µs+0s) by Net::HTTP::Methods::zlib_ok at line 14 of IO/Uncompress/Gunzip.pm # once (225µs+0s) by Net::HTTP::Methods::zlib_ok at line 11 of Compress/Zlib.pm # once (224µs+0s) by Net::HTTP::Methods::zlib_ok at line 450 of Compress/Zlib.pm # once (223µs+0s) by Net::HTTP::Methods::zlib_ok at line 9 of IO/Compress/Base.pm # once (222µs+0s) by LWP::Protocol::implementor at line 12 of IO/Socket.pm # once (221µs+0s) by Net::HTTP::Methods::zlib_ok at line 13 of Compress/Zlib.pm # once (219µs+0s) by Net::HTTP::Methods::zlib_ok at line 9 of IO/Compress/Adapter/Deflate.pm # once (219µs+0s) by Net::HTTP::Methods::zlib_ok at line 12 of Compress/Zlib.pm # once (219µs+0s) by Net::HTTP::Methods::zlib_ok at line 12 of IO/Uncompress/RawInflate.pm # once (218µs+0s) by Net::HTTP::Methods::zlib_ok at line 8 of IO/Uncompress/Adapter/Inflate.pm # once (218µs+0s) by Net::HTTP::Methods::zlib_ok at line 7 of IO/Uncompress/Adapter/Inflate.pm # once (217µs+0s) by Net::HTTP::Methods::zlib_ok at line 50 of IO/Uncompress/Gunzip.pm # once (217µs+0s) by Net::HTTP::Methods::zlib_ok at line 14 of Compress/Zlib.pm # once (216µs+0s) by Net::HTTP::Methods::zlib_ok at line 16 of IO/Uncompress/Gunzip.pm # once (216µs+0s) by Net::HTTP::Methods::zlib_ok at line 13 of IO/Compress/Zlib/Extra.pm # once (216µs+0s) by Net::HTTP::Methods::zlib_ok at line 8 of IO/Uncompress/RawInflate.pm # once (216µs+0s) by Net::HTTP::Methods::zlib_ok at line 9 of IO/Uncompress/RawInflate.pm # once (216µs+0s) by Net::HTTP::Methods::zlib_ok at line 12 of IO/Compress/RawDeflate.pm # once (213µs+0s) by Net::HTTP::Methods::zlib_ok at line 12 of IO/Uncompress/Gunzip.pm # once (212µs+0s) by Net::HTTP::Methods::zlib_ok at line 13 of IO/Compress/Gzip.pm # once (210µs+0s) by Net::HTTP::Methods::zlib_ok at line 17 of IO/Uncompress/Gunzip.pm # once (207µs+0s) by Net::HTTP::Methods::zlib_ok at line 14 of IO/Compress/Gzip.pm # once (205µs+0s) by Net::HTTP::Methods::zlib_ok at line 15 of IO/Uncompress/Gunzip.pm # once (205µs+0s) by Exporter::Heavy::heavy_require_version at line 237 of Exporter/Heavy.pm # once (205µs+0s) by Net::HTTP::Methods::zlib_ok at line 11 of IO/Compress/RawDeflate.pm # once (13µs+0s) by base::import at line 5 of Class/DBI.pm
sub UNIVERSAL::VERSION; # xsub
# spent 53.3ms within UNIVERSAL::can which was called 6504 times, avg 8µs/call: # 3696 times (34.0ms+0s) by Class::Trigger::__fetch_all_triggers at line 70 of Class/Trigger.pm, avg 9µs/call # 2766 times (18.5ms+0s) by LWP::UserAgent::_request_sanity_check at line 116 of LWP/UserAgent.pm, avg 7µs/call # 16 times (353µs+0s) by Class::DBI::_make_method at line 368 of Class/DBI.pm, avg 22µs/call # 10 times (219µs+0s) by Class::DBI::accessor_name_for at line 378 of Class/DBI.pm, avg 22µs/call # 10 times (218µs+0s) by Class::DBI::mutator_name_for at line 387 of Class/DBI.pm, avg 22µs/call # 2 times (20µs+0s) by Class::DBI::Relationship::HasMany::triggers at line 72 of Class/DBI/Relationship/HasMany.pm, avg 10µs/call # once (20µs+0s) by attributes::import at line 41 of attributes.pm # once (16µs+0s) by attributes::get at line 80 of attributes.pm # once (14µs+0s) by Class::DBI::Plugin::RetrieveAll::import at line 87 of Class/DBI/Plugin/RetrieveAll.pm # once (11µs+0s) by Class::DBI::add_searcher at line 1090 of Class/DBI.pm
sub UNIVERSAL::can; # xsub
# spent 643µs within UNIVERSAL::isa which was called 56 times, avg 11µs/call: # 28 times (349µs+0s) by base::import at line 74 of base.pm, avg 12µs/call # 10 times (104µs+0s) by Class::DBI::ColumnGrouper::add_column at line 84 of Class/DBI/ColumnGrouper.pm, avg 10µs/call # 6 times (62µs+0s) by DBI::setup_driver at line 798 of DBI.pm, avg 10µs/call # 6 times (52µs+0s) by DBI::setup_driver at line 801 of DBI.pm, avg 9µs/call # 2 times (17µs+0s) by Class::Date::new at line 153 of Class/Date.pm, avg 8µs/call # once (22µs+0s) by Class::DBI::Plugin::Pager::import at line 101 of Class/DBI/Plugin/Pager.pm # once (19µs+0s) by Class::DBI::sth_to_objects at line 1133 of Class/DBI.pm # once (12µs+0s) by Class::DBI::Relationship::HasA::__ANON__[/project/perl/lib/Class/DBI/Relationship/HasA.pm:77] at line 55 of Class/DBI/Relationship/HasA.pm # once (6µs+0s) by Class::Date::new at line 146 of Class/Date.pm
sub UNIVERSAL::isa; # xsub