File Coverage

blib/lib/App/PS1/Plugin/Perl.pm
Criterion Covered Total %
statement 12 17 70.5
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 1 1 100.0
total 17 25 68.0


line stmt bran cond sub pod time code
1             package App::PS1::Plugin::Perl;
2              
3             # Created on: 2011-06-21 09:48:47
4             # Create by: Ivan Wills
5             # $Id$
6             # $Revision$, $HeadURL$, $Date$
7             # $Revision$, $Source$, $Date$
8              
9 1     1   1027 use strict;
  1         3  
  1         30  
10 1     1   6 use warnings;
  1         2  
  1         25  
11 1     1   5 use Carp;
  1         2  
  1         58  
12 1     1   7 use English qw/ -no_match_vars /;
  1         2  
  1         5  
13              
14             our $VERSION = 0.08;
15             our @EXPORT_OK = qw//;
16             our %EXPORT_TAGS = ();
17             #our @EXPORT = qw//;
18              
19             sub perl {
20 0     0 1   my ($self, $options) = @_;
21 0           my $path = $ENV{PERLBREW_PERL};
22 0 0         return if !$path;
23              
24 0           my ($version) = $path =~ /perl-(.*)$/;
25              
26 0           return $self->surround(
27             5 + length $version,
28             $self->colour('branch_label') . 'perl ' . $self->colour('branch') . $version
29             );
30             }
31              
32             1;
33              
34             __END__
35              
36             =head1 NAME
37              
38             App::PS1::Plugin::Perl - Shows current version of Perl if using perlbrew
39              
40             =head1 VERSION
41              
42             This documentation refers to App::PS1::Plugin::Perl version 0.08.
43              
44             =head1 SYNOPSIS
45              
46             use App::PS1::Plugin::Perl;
47              
48             # Brief but working code example(s) here showing the most common usage(s)
49             # This section will be as far as many users bother reading, so make it as
50             # educational and exemplary as possible.
51              
52              
53             =head1 DESCRIPTION
54              
55             =head1 SUBROUTINES/METHODS
56              
57             =head2 C<perl ()>
58              
59             Determines the current version of Perl if using L<perlbrew>
60              
61             =head1 DIAGNOSTICS
62              
63             =head1 CONFIGURATION AND ENVIRONMENT
64              
65             =head1 DEPENDENCIES
66              
67             =head1 INCOMPATIBILITIES
68              
69             =head1 BUGS AND LIMITATIONS
70              
71             There are no known bugs in this module.
72              
73             Please report problems to Ivan Wills (ivan.wills@gmail.com).
74              
75             Patches are welcome.
76              
77             =head1 AUTHOR
78              
79             Ivan Wills - (ivan.wills@gmail.com)
80              
81             =head1 LICENSE AND COPYRIGHT
82              
83             Copyright (c) 2011 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077).
84             All rights reserved.
85              
86             This module is free software; you can redistribute it and/or modify it under
87             the same terms as Perl itself. See L<perlartistic>. This program is
88             distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
89             without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
90             PARTICULAR PURPOSE.
91              
92             =cut