← Index
NYTProf Performance Profile   « line view »
For /home/ss5/perl5/perlbrew/perls/perl-5.22.0/bin/benchmarkanything-storage
  Run on Mon Jan 29 16:55:34 2018
Reported on Mon Jan 29 16:57:07 2018

Filename/home/ss5/perl5/perlbrew/perls/perl-5.22.0/lib/site_perl/5.22.0/File/HomeDir/FreeDesktop.pm
StatementsExecuted 18 statements in 424µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111393µs626µsFile::HomeDir::FreeDesktop::::BEGIN@13File::HomeDir::FreeDesktop::BEGIN@13
11118µs18µsFile::HomeDir::FreeDesktop::::BEGIN@8File::HomeDir::FreeDesktop::BEGIN@8
1118µs10µsFile::HomeDir::FreeDesktop::::BEGIN@9File::HomeDir::FreeDesktop::BEGIN@9
1117µs7µsFile::HomeDir::FreeDesktop::::BEGIN@16File::HomeDir::FreeDesktop::BEGIN@16
1116µs24µsFile::HomeDir::FreeDesktop::::BEGIN@15File::HomeDir::FreeDesktop::BEGIN@15
1112µs2µsFile::HomeDir::FreeDesktop::::BEGIN@12File::HomeDir::FreeDesktop::BEGIN@12
1112µs2µsFile::HomeDir::FreeDesktop::::BEGIN@10File::HomeDir::FreeDesktop::BEGIN@10
1112µs2µsFile::HomeDir::FreeDesktop::::BEGIN@11File::HomeDir::FreeDesktop::BEGIN@11
0000s0sFile::HomeDir::FreeDesktop::::_myFile::HomeDir::FreeDesktop::_my
0000s0sFile::HomeDir::FreeDesktop::::my_cacheFile::HomeDir::FreeDesktop::my_cache
0000s0sFile::HomeDir::FreeDesktop::::my_configFile::HomeDir::FreeDesktop::my_config
0000s0sFile::HomeDir::FreeDesktop::::my_dataFile::HomeDir::FreeDesktop::my_data
0000s0sFile::HomeDir::FreeDesktop::::my_desktopFile::HomeDir::FreeDesktop::my_desktop
0000s0sFile::HomeDir::FreeDesktop::::my_documentsFile::HomeDir::FreeDesktop::my_documents
0000s0sFile::HomeDir::FreeDesktop::::my_downloadFile::HomeDir::FreeDesktop::my_download
0000s0sFile::HomeDir::FreeDesktop::::my_musicFile::HomeDir::FreeDesktop::my_music
0000s0sFile::HomeDir::FreeDesktop::::my_picturesFile::HomeDir::FreeDesktop::my_pictures
0000s0sFile::HomeDir::FreeDesktop::::my_publicshareFile::HomeDir::FreeDesktop::my_publicshare
0000s0sFile::HomeDir::FreeDesktop::::my_templatesFile::HomeDir::FreeDesktop::my_templates
0000s0sFile::HomeDir::FreeDesktop::::my_videosFile::HomeDir::FreeDesktop::my_videos
0000s0sFile::HomeDir::FreeDesktop::::users_dataFile::HomeDir::FreeDesktop::users_data
0000s0sFile::HomeDir::FreeDesktop::::users_desktopFile::HomeDir::FreeDesktop::users_desktop
0000s0sFile::HomeDir::FreeDesktop::::users_documentsFile::HomeDir::FreeDesktop::users_documents
0000s0sFile::HomeDir::FreeDesktop::::users_musicFile::HomeDir::FreeDesktop::users_music
0000s0sFile::HomeDir::FreeDesktop::::users_picturesFile::HomeDir::FreeDesktop::users_pictures
0000s0sFile::HomeDir::FreeDesktop::::users_videosFile::HomeDir::FreeDesktop::users_videos
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::FreeDesktop;
2
3# Specific functionality for unixes running free desktops
4# compatible with (but not using) File-BaseDir-0.03
5
6# See POD at the end of the file for more documentation.
7
8239µs118µs
# spent 18µs within File::HomeDir::FreeDesktop::BEGIN@8 which was called: # once (18µs+0s) by File::HomeDir::_DRIVER at line 8
use 5.00503;
# spent 18µs making 1 call to File::HomeDir::FreeDesktop::BEGIN@8
9217µs213µs
# spent 10µs (8+3) within File::HomeDir::FreeDesktop::BEGIN@9 which was called: # once (8µs+3µs) by File::HomeDir::_DRIVER at line 9
use strict;
# spent 10µs making 1 call to File::HomeDir::FreeDesktop::BEGIN@9 # spent 3µs making 1 call to strict::import
10213µs12µs
# spent 2µs within File::HomeDir::FreeDesktop::BEGIN@10 which was called: # once (2µs+0s) by File::HomeDir::_DRIVER at line 10
use Carp ();
# spent 2µs making 1 call to File::HomeDir::FreeDesktop::BEGIN@10
11211µs12µs
# spent 2µs within File::HomeDir::FreeDesktop::BEGIN@11 which was called: # once (2µs+0s) by File::HomeDir::_DRIVER at line 11
use File::Spec ();
# spent 2µs making 1 call to File::HomeDir::FreeDesktop::BEGIN@11
12212µs12µs
# spent 2µs within File::HomeDir::FreeDesktop::BEGIN@12 which was called: # once (2µs+0s) by File::HomeDir::_DRIVER at line 12
use File::Which ();
# spent 2µs making 1 call to File::HomeDir::FreeDesktop::BEGIN@12
13262µs1626µs
# spent 626µs (393+232) within File::HomeDir::FreeDesktop::BEGIN@13 which was called: # once (393µs+232µs) by File::HomeDir::_DRIVER at line 13
use File::HomeDir::Unix ();
# spent 626µs making 1 call to File::HomeDir::FreeDesktop::BEGIN@13
14
15222µs243µs
# spent 24µs (6+19) within File::HomeDir::FreeDesktop::BEGIN@15 which was called: # once (6µs+19µs) by File::HomeDir::_DRIVER at line 15
use vars qw{$VERSION @ISA};
# spent 24µs making 1 call to File::HomeDir::FreeDesktop::BEGIN@15 # spent 19µs making 1 call to vars::import
16
# spent 7µs within File::HomeDir::FreeDesktop::BEGIN@16 which was called: # once (7µs+0s) by File::HomeDir::_DRIVER at line 19
BEGIN {
171200ns $VERSION = '1.00';
1816µs @ISA = 'File::HomeDir::Unix';
191237µs17µs}
# spent 7µs making 1 call to File::HomeDir::FreeDesktop::BEGIN@16
20
21# xdg uses $ENV{XDG_CONFIG_HOME}/user-dirs.dirs to know where are the
22# various "my xxx" directories. That is a shell file. The official API
23# is the xdg-user-dir executable. It has no provision for assessing
24# the directories of a user that is different than the one we are
25# running under; the standard substitute user mechanisms are needed to
26# overcome this.
27
2812µs1197µsmy $xdgprog = File::Which::which('xdg-user-dir');
# spent 197µs making 1 call to File::Which::which
29
30sub _my {
31 # No quoting because input is hard-coded and only comes from this module
32 my $thingy = qx($xdgprog $_[1]);
33 chomp $thingy;
34 return $thingy;
35}
36
37# Simple stuff
38sub my_desktop { shift->_my('DESKTOP') }
39sub my_documents { shift->_my('DOCUMENTS') }
40sub my_music { shift->_my('MUSIC') }
41sub my_pictures { shift->_my('PICTURES') }
42sub my_videos { shift->_my('VIDEOS') }
43
44sub my_data {
45 $ENV{XDG_DATA_HOME}
46 or
47 File::Spec->catdir(
48 shift->my_home,
49 qw{ .local share }
50 );
51}
52
53sub my_config {
54 $ENV{XDG_CONFIG_HOME}
55 or
56 File::Spec->catdir(
57 shift->my_home,
58 qw{ .config }
59 );
60}
61
62# Custom locations (currently undocumented)
63sub my_download { shift->_my('DOWNLOAD') }
64sub my_publicshare { shift->_my('PUBLICSHARE') }
65sub my_templates { shift->_my('TEMPLATES') }
66
67sub my_cache {
68 $ENV{XDG_CACHE_HOME}
69 ||
70 File::Spec->catdir(shift->my_home, qw{ .cache });
71}
72
- -
77#####################################################################
78# General User Methods
79
80sub users_desktop { Carp::croak('The users_desktop method is not available on an XDG based system.'); }
81sub users_documents { Carp::croak('The users_documents method is not available on an XDG based system.'); }
82sub users_music { Carp::croak('The users_music method is not available on an XDG based system.'); }
83sub users_pictures { Carp::croak('The users_pictures method is not available on an XDG based system.'); }
84sub users_videos { Carp::croak('The users_videos method is not available on an XDG based system.'); }
85sub users_data { Carp::croak('The users_data method is not available on an XDG based system.'); }
86
8712µs1;
88
89=pod
90
91=head1 NAME
92
93File::HomeDir::FreeDesktop - Find your home and other directories on FreeDesktop.org Unix
94
95=head1 DESCRIPTION
96
97This module provides implementations for determining common user
98directories. In normal usage this module will always be
99used via L<File::HomeDir>.
100
101=head1 SYNOPSIS
102
103 use File::HomeDir;
104
105 # Find directories for the current user
106 $home = File::HomeDir->my_home; # /home/mylogin
107 $desktop = File::HomeDir->my_desktop;
108 $docs = File::HomeDir->my_documents;
109 $music = File::HomeDir->my_music;
110 $pics = File::HomeDir->my_pictures;
111 $videos = File::HomeDir->my_videos;
112 $data = File::HomeDir->my_data;
113
114=head1 AUTHORS
115
116Jerome Quelin E<lt>jquellin@cpan.org<gt>
117
118Adam Kennedy E<lt>adamk@cpan.orgE<gt>
119
120=head1 SEE ALSO
121
122L<File::HomeDir>, L<File::HomeDir::Win32> (legacy)
123
124=head1 COPYRIGHT
125
126Copyright 2009 - 2011 Jerome Quelin.
127
128Some parts copyright 2010 Adam Kennedy.
129
130This program is free software; you can redistribute
131it and/or modify it under the same terms as Perl itself.
132
133The full text of the license can be found in the
134LICENSE file included with this module.
135
136=cut