| Filename | C:/tmp64ng/perl/vendor/lib/Portable/HomeDir.pm | 
| Statements | Executed 22 statements in 0s | 
| Calls | P | F | Exclusive Time  | 
        Inclusive Time  | 
        Subroutine | 
|---|---|---|---|---|---|
| 1 | 1 | 1 | 0s | 0s | Portable::HomeDir::BEGIN@5 | 
| 1 | 1 | 1 | 0s | 0s | Portable::HomeDir::BEGIN@6 | 
| 1 | 1 | 1 | 0s | 0s | Portable::HomeDir::BEGIN@7 | 
| 1 | 1 | 1 | 0s | 0s | Portable::HomeDir::BEGIN@8 | 
| 1 | 1 | 1 | 0s | 0s | Portable::HomeDir::CORE:sort (opcode) | 
| 0 | 0 | 0 | 0s | 0s | Portable::HomeDir::_SELF | 
| 0 | 0 | 0 | 0s | 0s | Portable::HomeDir::apply | 
| 0 | 0 | 0 | 0s | 0s | Portable::HomeDir::my_data | 
| 0 | 0 | 0 | 0s | 0s | Portable::HomeDir::my_documents | 
| 0 | 0 | 0 | 0s | 0s | Portable::HomeDir::my_home | 
| 0 | 0 | 0 | 0s | 0s | Portable::HomeDir::my_music | 
| 0 | 0 | 0 | 0s | 0s | Portable::HomeDir::my_pictures | 
| 0 | 0 | 0 | 0s | 0s | Portable::HomeDir::my_videos | 
| 1 | 1 | 1 | 0s | 0s | Portable::HomeDir::new | 
| 0 | 0 | 0 | 0s | 0s | Portable::HomeDir::platform | 
| Line | State ments  | 
      Time on line  | 
      Calls | Time in subs  | 
      Code | 
|---|---|---|---|---|---|
| 1 | package Portable::HomeDir; | ||||
| 2 | |||||
| 3 | # In the trivial case, only my_home is implemented | ||||
| 4 | |||||
| 5 | 2 | 0s | 1 | 0s | # spent 0s within Portable::HomeDir::BEGIN@5 which was called:
#    once (0s+0s) by Portable::new at line 5 # spent     0s making 1 call to Portable::HomeDir::BEGIN@5  | 
| 6 | 2 | 0s | 2 | 0s | # spent 0s within Portable::HomeDir::BEGIN@6 which was called:
#    once (0s+0s) by Portable::new at line 6 # spent     0s making 1 call to Portable::HomeDir::BEGIN@6
# spent     0s making 1 call to strict::import  | 
| 7 | 2 | 0s | 2 | 0s | # spent 0s within Portable::HomeDir::BEGIN@7 which was called:
#    once (0s+0s) by Portable::new at line 7 # spent     0s making 1 call to Portable::HomeDir::BEGIN@7
# spent     0s making 1 call to warnings::import  | 
| 8 | 2 | 0s | 1 | 0s | # spent 0s within Portable::HomeDir::BEGIN@8 which was called:
#    once (0s+0s) by Portable::new at line 8 # spent     0s making 1 call to Portable::HomeDir::BEGIN@8  | 
| 9 | |||||
| 10 | 1 | 0s | our $VERSION = '1.22'; | ||
| 11 | |||||
| 12 | ##################################################################### | ||||
| 13 | # Portable Driver API | ||||
| 14 | |||||
| 15 | # spent 0s within Portable::HomeDir::new which was called:
#    once (0s+0s) by Portable::new at line 164 of Portable.pm  | ||||
| 16 | 1 | 0s | my $class = shift; | ||
| 17 | 1 | 0s | my $parent = shift; | ||
| 18 | 1 | 0s | 2 | 0s |         unless ( Portable::_HASH($parent->portable_homedir) ) {         # spent     0s making 1 call to Portable::_HASH
        # spent     0s making 1 call to Portable::portable_homedir  | 
| 19 | die('Missing or invalid HomeDir key in portable.perl'); | ||||
| 20 | } | ||||
| 21 | |||||
| 22 | # Create the object | ||||
| 23 | 1 | 0s | my $self = bless { }, $class; | ||
| 24 | |||||
| 25 | # Map the | ||||
| 26 | 1 | 0s | 1 | 0s |         my $homedir = $parent->portable_homedir;         # spent     0s making 1 call to Portable::portable_homedir  | 
| 27 | 1 | 0s | 1 | 0s |         my $root    = $parent->dist_root;         # spent     0s making 1 call to Portable::dist_root  | 
| 28 | 1 | 0s | 1 | 0s |         foreach my $key ( sort keys %$homedir ) {         # spent     0s making 1 call to Portable::HomeDir::CORE:sort  | 
| 29 | 2 | 0s | unless ( | ||
| 30 | defined $homedir->{$key} | ||||
| 31 | and | ||||
| 32 | length $homedir->{$key} | ||||
| 33 | ) { | ||||
| 34 | $self->{$key} = $homedir->{$key}; | ||||
| 35 | next; | ||||
| 36 | } | ||||
| 37 | 2 | 0s | 2 | 0s |                 $self->{$key} = Portable::FileSpec::catdir(                 # spent     0s making 2 calls to Portable::FileSpec::catdir, avg 0s/call  | 
| 38 | $root, split /\//, $homedir->{$key} | ||||
| 39 | ); | ||||
| 40 | } | ||||
| 41 | |||||
| 42 | 1 | 0s | return $self; | ||
| 43 | } | ||||
| 44 | |||||
| 45 | sub apply { | ||||
| 46 | my $self = shift; | ||||
| 47 | |||||
| 48 | # Shortcut if we've already applied | ||||
| 49 | if ( $File::HomeDir::IMPLEMENTED_BY eq __PACKAGE__ ) { | ||||
| 50 | return 1; | ||||
| 51 | } | ||||
| 52 | |||||
| 53 | # Load File::HomeDir and the regular platform driver | ||||
| 54 | require File::HomeDir; | ||||
| 55 | |||||
| 56 | # Remember the platform we're on so we can default | ||||
| 57 | # to it properly if there's no portable equivalent. | ||||
| 58 | $self->{platform} = $File::HomeDir::IMPLEMENTED_BY; | ||||
| 59 | |||||
| 60 | # Hijack the implementation class to us | ||||
| 61 | $File::HomeDir::IMPLEMENTED_BY = __PACKAGE__; | ||||
| 62 | |||||
| 63 | return 1; | ||||
| 64 | } | ||||
| 65 | |||||
| 66 | sub platform { | ||||
| 67 | $_[0]->{platform}; | ||||
| 68 | } | ||||
| 69 | |||||
| - - | |||||
| 74 | ##################################################################### | ||||
| 75 | # File::HomeDir::Driver API | ||||
| 76 | |||||
| 77 | sub _SELF { | ||||
| 78 | ref($_[0]) ? $_[0] : Portable->default->homedir; | ||||
| 79 | } | ||||
| 80 | |||||
| 81 | sub my_home { | ||||
| 82 | _SELF(@_)->{my_home}; | ||||
| 83 | } | ||||
| 84 | |||||
| 85 | # The concept of "my_desktop" is incompatible with the idea of | ||||
| 86 | # a Portable Perl distribution (because Windows won't overwrite | ||||
| 87 | # the desktop with anything on the flash drive) | ||||
| 88 | # sub my_desktop | ||||
| 89 | |||||
| 90 | sub my_documents { | ||||
| 91 | _SELF(@_)->{my_documents}; | ||||
| 92 | } | ||||
| 93 | |||||
| 94 | sub my_music { | ||||
| 95 | _SELF(@_)->{my_music}; | ||||
| 96 | } | ||||
| 97 | |||||
| 98 | sub my_pictures { | ||||
| 99 | _SELF(@_)->{my_pictures}; | ||||
| 100 | } | ||||
| 101 | |||||
| 102 | sub my_videos { | ||||
| 103 | _SELF(@_)->{my_videos}; | ||||
| 104 | } | ||||
| 105 | |||||
| 106 | sub my_data { | ||||
| 107 | _SELF(@_)->{my_data}; | ||||
| 108 | } | ||||
| 109 | |||||
| 110 | 1 | 0s | 1; | ||
# spent 0s within Portable::HomeDir::CORE:sort which was called:
#    once (0s+0s) by Portable::HomeDir::new at line 28  |