File Coverage

blib/lib/App/PS1/Plugin/Env.pm
Criterion Covered Total %
statement 15 22 68.1
branch 0 4 0.0
condition n/a
subroutine 5 6 83.3
pod 1 1 100.0
total 21 33 63.6


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