← Index
NYTProf Performance Profile   « line view »
For /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/bin/perlcritic
  Run on Sat Mar 19 22:12:22 2016
Reported on Sat Mar 19 22:14:12 2016

Filename/Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/File/HomeDir/Darwin/Cocoa.pm
StatementsExecuted 666 statements in 4.60ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111570┬Ás1.50msFile::HomeDir::Darwin::Cocoa::::BEGIN@7File::HomeDir::Darwin::Cocoa::BEGIN@7
5551517┬Ás3.77msFile::HomeDir::Darwin::Cocoa::::_find_folderFile::HomeDir::Darwin::Cocoa::_find_folder
5511214┬Ás214┬ÁsFile::HomeDir::Darwin::Cocoa::::CORE:ftdirFile::HomeDir::Darwin::Cocoa::CORE:ftdir (opcode)
111150┬Ás2.29msFile::HomeDir::Darwin::Cocoa::::my_desktopFile::HomeDir::Darwin::Cocoa::my_desktop
111148┬Ás449┬ÁsFile::HomeDir::Darwin::Cocoa::::my_musicFile::HomeDir::Darwin::Cocoa::my_music
111148┬Ás417┬ÁsFile::HomeDir::Darwin::Cocoa::::my_picturesFile::HomeDir::Darwin::Cocoa::my_pictures
111146┬Ás407┬ÁsFile::HomeDir::Darwin::Cocoa::::my_videosFile::HomeDir::Darwin::Cocoa::my_videos
221146┬Ás46┬ÁsFile::HomeDir::Darwin::Cocoa::::my_homeFile::HomeDir::Darwin::Cocoa::my_home
111145┬Ás448┬ÁsFile::HomeDir::Darwin::Cocoa::::my_dataFile::HomeDir::Darwin::Cocoa::my_data
11139┬Ás83┬ÁsFile::HomeDir::Darwin::Cocoa::::BEGIN@10File::HomeDir::Darwin::Cocoa::BEGIN@10
11116┬Ás16┬ÁsFile::HomeDir::Darwin::Cocoa::::BEGIN@3File::HomeDir::Darwin::Cocoa::BEGIN@3
1118┬Ás20┬ÁsFile::HomeDir::Darwin::Cocoa::::BEGIN@4File::HomeDir::Darwin::Cocoa::BEGIN@4
1118┬Ás36┬ÁsFile::HomeDir::Darwin::Cocoa::::BEGIN@9File::HomeDir::Darwin::Cocoa::BEGIN@9
1114┬Ás4┬ÁsFile::HomeDir::Darwin::Cocoa::::BEGIN@5File::HomeDir::Darwin::Cocoa::BEGIN@5
1113┬Ás3┬ÁsFile::HomeDir::Darwin::Cocoa::::BEGIN@6File::HomeDir::Darwin::Cocoa::BEGIN@6
0000s0sFile::HomeDir::Darwin::Cocoa::::my_documentsFile::HomeDir::Darwin::Cocoa::my_documents
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package File::HomeDir::Darwin::Cocoa;
2
3240┬Ás116┬Ás
# spent 16┬Ás within File::HomeDir::Darwin::Cocoa::BEGIN@3 which was called: # once (16┬Ás+0s) by File::HomeDir::_DRIVER at line 3
use 5.00503;
# spent 16┬Ás making 1 call to File::HomeDir::Darwin::Cocoa::BEGIN@3
4220┬Ás233┬Ás
# spent 20┬Ás (8+13) within File::HomeDir::Darwin::Cocoa::BEGIN@4 which was called: # once (8┬Ás+13┬Ás) by File::HomeDir::_DRIVER at line 4
use strict;
# spent 20┬Ás making 1 call to File::HomeDir::Darwin::Cocoa::BEGIN@4 # spent 13┬Ás making 1 call to strict::import
5221┬Ás14┬Ás
# spent 4┬Ás within File::HomeDir::Darwin::Cocoa::BEGIN@5 which was called: # once (4┬Ás+0s) by File::HomeDir::_DRIVER at line 5
use Cwd ();
# spent 4┬Ás making 1 call to File::HomeDir::Darwin::Cocoa::BEGIN@5
6215┬Ás13┬Ás
# spent 3┬Ás within File::HomeDir::Darwin::Cocoa::BEGIN@6 which was called: # once (3┬Ás+0s) by File::HomeDir::_DRIVER at line 6
use Carp ();
# spent 3┬Ás making 1 call to File::HomeDir::Darwin::Cocoa::BEGIN@6
7280┬Ás11.50ms
# spent 1.50ms (570┬Ás+930┬Ás) within File::HomeDir::Darwin::Cocoa::BEGIN@7 which was called: # once (570┬Ás+930┬Ás) by File::HomeDir::_DRIVER at line 7
use File::HomeDir::Darwin ();
# spent 1.50ms making 1 call to File::HomeDir::Darwin::Cocoa::BEGIN@7
8
9236┬Ás264┬Ás
# spent 36┬Ás (8+28) within File::HomeDir::Darwin::Cocoa::BEGIN@9 which was called: # once (8┬Ás+28┬Ás) by File::HomeDir::_DRIVER at line 9
use vars qw{$VERSION @ISA};
# spent 36┬Ás making 1 call to File::HomeDir::Darwin::Cocoa::BEGIN@9 # spent 28┬Ás making 1 call to vars::import
10
# spent 83┬Ás (39+44) within File::HomeDir::Darwin::Cocoa::BEGIN@10 which was called: # once (39┬Ás+44┬Ás) by File::HomeDir::_DRIVER at line 18
BEGIN {
111400ns $VERSION = '1.00';
1215┬Ás @ISA = 'File::HomeDir::Darwin';
13
14 # Load early if in a forking environment and we have
15 # prefork, or at run-time if not.
161100ns local $@;
17122┬Ás eval "use prefork 'Mac::SystemDirectory'";
# spent 55┬Ás executing statements in string eval
# includes 44┬Ás spent executing 1 call to 1 sub defined therein.
181284┬Ás183┬Ás}
# spent 83┬Ás making 1 call to File::HomeDir::Darwin::Cocoa::BEGIN@10
19
- -
24#####################################################################
25# Current User Methods
26
27
# spent 46┬Ás within File::HomeDir::Darwin::Cocoa::my_home which was called 22 times, avg 2┬Ás/call: # 22 times (46┬Ás+0s) by File::HomeDir::my_home at line 93 of File/HomeDir.pm, avg 2┬Ás/call
sub my_home {
28225┬Ás my $class = shift;
29
30 # A lot of unix people and unix-derived tools rely on
31 # the ability to overload HOME. We will support it too
32 # so that they can replace raw HOME calls with File::HomeDir.
332267┬Ás if ( exists $ENV{HOME} and defined $ENV{HOME} ) {
34 return $ENV{HOME};
35 }
36
37 require Mac::SystemDirectory;
38 return Mac::SystemDirectory::HomeDirectory();
39}
40
41# from 10.4
42
# spent 2.29ms (50┬Ás+2.24) within File::HomeDir::Darwin::Cocoa::my_desktop which was called 11 times, avg 208┬Ás/call: # 11 times (50┬Ás+2.24ms) by File::HomeDir::my_desktop at line 97 of File/HomeDir.pm, avg 208┬Ás/call
sub my_desktop {
43113┬Ás my $class = shift;
44
45113┬Ás require Mac::SystemDirectory;
461122┬Ás eval {
471116┬Ás112.24ms $class->_find_folder(Mac::SystemDirectory::NSDesktopDirectory())
# spent 2.24ms making 11 calls to File::HomeDir::Darwin::Cocoa::_find_folder, avg 203┬Ás/call
48 }
49 ||
50 $class->SUPER::my_desktop;
51}
52
53# from 10.2
54sub my_documents {
55 my $class = shift;
56
57 require Mac::SystemDirectory;
58 eval {
59 $class->_find_folder(Mac::SystemDirectory::NSDocumentDirectory())
60 }
61 ||
62 $class->SUPER::my_documents;
63}
64
65# from 10.4
66
# spent 448┬Ás (45+403) within File::HomeDir::Darwin::Cocoa::my_data which was called 11 times, avg 41┬Ás/call: # 11 times (45┬Ás+403┬Ás) by File::HomeDir::my_data at line 127 of File/HomeDir.pm, avg 41┬Ás/call
sub my_data {
67113┬Ás my $class = shift;
68
69113┬Ás require Mac::SystemDirectory;
701121┬Ás eval {
711112┬Ás11403┬Ás $class->_find_folder(Mac::SystemDirectory::NSApplicationSupportDirectory())
# spent 403┬Ás making 11 calls to File::HomeDir::Darwin::Cocoa::_find_folder, avg 37┬Ás/call
72 }
73 ||
74 $class->SUPER::my_data;
75}
76
77# from 10.6
78
# spent 449┬Ás (48+400) within File::HomeDir::Darwin::Cocoa::my_music which was called 11 times, avg 41┬Ás/call: # 11 times (48┬Ás+400┬Ás) by File::HomeDir::my_music at line 109 of File/HomeDir.pm, avg 41┬Ás/call
sub my_music {
79114┬Ás my $class = shift;
80
81114┬Ás require Mac::SystemDirectory;
821121┬Ás eval {
831113┬Ás11400┬Ás $class->_find_folder(Mac::SystemDirectory::NSMusicDirectory())
# spent 400┬Ás making 11 calls to File::HomeDir::Darwin::Cocoa::_find_folder, avg 36┬Ás/call
84 }
85 ||
86 $class->SUPER::my_music;
87}
88
89# from 10.6
90
# spent 417┬Ás (48+369) within File::HomeDir::Darwin::Cocoa::my_pictures which was called 11 times, avg 38┬Ás/call: # 11 times (48┬Ás+369┬Ás) by File::HomeDir::my_pictures at line 115 of File/HomeDir.pm, avg 38┬Ás/call
sub my_pictures {
91114┬Ás my $class = shift;
92
93113┬Ás require Mac::SystemDirectory;
941119┬Ás eval {
951113┬Ás11369┬Ás $class->_find_folder(Mac::SystemDirectory::NSPicturesDirectory())
# spent 369┬Ás making 11 calls to File::HomeDir::Darwin::Cocoa::_find_folder, avg 34┬Ás/call
96 }
97 ||
98 $class->SUPER::my_pictures;
99}
100
101# from 10.6
102
# spent 407┬Ás (46+361) within File::HomeDir::Darwin::Cocoa::my_videos which was called 11 times, avg 37┬Ás/call: # 11 times (46┬Ás+361┬Ás) by File::HomeDir::my_videos at line 121 of File/HomeDir.pm, avg 37┬Ás/call
sub my_videos {
103113┬Ás my $class = shift;
104
105113┬Ás require Mac::SystemDirectory;
1061121┬Ás eval {
1071113┬Ás11361┬Ás $class->_find_folder(Mac::SystemDirectory::NSMoviesDirectory())
# spent 361┬Ás making 11 calls to File::HomeDir::Darwin::Cocoa::_find_folder, avg 33┬Ás/call
108 }
109 ||
110 $class->SUPER::my_videos;
111}
112
113
# spent 3.77ms (517┬Ás+3.25) within File::HomeDir::Darwin::Cocoa::_find_folder which was called 55 times, avg 69┬Ás/call: # 11 times (124┬Ás+2.11ms) by File::HomeDir::Darwin::Cocoa::my_desktop at line 47, avg 203┬Ás/call # 11 times (98┬Ás+306┬Ás) by File::HomeDir::Darwin::Cocoa::my_data at line 71, avg 37┬Ás/call # 11 times (100┬Ás+300┬Ás) by File::HomeDir::Darwin::Cocoa::my_music at line 83, avg 36┬Ás/call # 11 times (98┬Ás+271┬Ás) by File::HomeDir::Darwin::Cocoa::my_pictures at line 95, avg 34┬Ás/call # 11 times (98┬Ás+263┬Ás) by File::HomeDir::Darwin::Cocoa::my_videos at line 107, avg 33┬Ás/call
sub _find_folder {
114557┬Ás my $class = shift;
115556┬Ás my $name = shift;
116
117558┬Ás require Mac::SystemDirectory;
118552.90ms552.72ms my $folder = Mac::SystemDirectory::FindDirectory($name);
# spent 2.72ms making 55 calls to Mac::SystemDirectory::FindDirectory, avg 50┬Ás/call
1195511┬Ás return undef unless defined $folder;
120
12155311┬Ás55214┬Ás unless ( -d $folder ) {
# spent 214┬Ás making 55 calls to File::HomeDir::Darwin::Cocoa::CORE:ftdir, avg 4┬Ás/call
122 # Make sure that symlinks resolve to directories.
123 return undef unless -l $folder;
124 my $dir = readlink $folder or return;
125 return undef unless -d $dir;
126 }
127
12855554┬Ás55313┬Ás return Cwd::abs_path($folder);
# spent 313┬Ás making 55 calls to Cwd::abs_path, avg 6┬Ás/call
129}
130
13112┬Ás1;
132
133=pod
134
135=head1 NAME
136
137File::HomeDir::Darwin::Cocoa - Find your home and other directories on Darwin (OS X)
138
139=head1 DESCRIPTION
140
141This module provides Darwin-specific implementations for determining
142common user directories using Cocoa API through
143L<Mac::SystemDirectory>. In normal usage this module will always be
144used via L<File::HomeDir>.
145
146Theoretically, this should return the same paths as both of the other
147Darwin drivers.
148
149Because this module requires L<Mac::SystemDirectory>, if the module
150is not installed, L<File::HomeDir> will fall back to L<File::HomeDir::Darwin>.
151
152=head1 SYNOPSIS
153
154 use File::HomeDir;
155
156 # Find directories for the current user
157 $home = File::HomeDir->my_home; # /Users/mylogin
158 $desktop = File::HomeDir->my_desktop; # /Users/mylogin/Desktop
159 $docs = File::HomeDir->my_documents; # /Users/mylogin/Documents
160 $music = File::HomeDir->my_music; # /Users/mylogin/Music
161 $pics = File::HomeDir->my_pictures; # /Users/mylogin/Pictures
162 $videos = File::HomeDir->my_videos; # /Users/mylogin/Movies
163 $data = File::HomeDir->my_data; # /Users/mylogin/Library/Application Support
164
165=cut
 
# spent 214┬Ás within File::HomeDir::Darwin::Cocoa::CORE:ftdir which was called 55 times, avg 4┬Ás/call: # 55 times (214┬Ás+0s) by File::HomeDir::Darwin::Cocoa::_find_folder at line 121, avg 4┬Ás/call
sub File::HomeDir::Darwin::Cocoa::CORE:ftdir; # opcode