App/Chart/Glib/Ex/MoreUtils.pm

filter: Statementstmt 81.8% 9 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 86.6% 13 / 15 CC 1 SCAR 0.7
CC
1
Cov
82%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« App/Chart/Weblink/SandP.pm ↑ Summary App/Chart/Gtk2/AnnotationsDialog.pm »
1 # Copyright 2008, 2009, 2010, 2011 Kevin Ryde
2  
3 # This file is part of Chart.
4 #
5 # Chart is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 3, or (at your option) any later version.
8 #
9 # Chart is distributed in the hope that it will be useful, but WITHOUT ANY
10 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12 # details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with Chart. If not, see <http://www.gnu.org/licenses/>.
16  
17 package App::Chart::Glib::Ex::MoreUtils;
18 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 0 ▶use Glib;
Subroutine BEGIN: called CC=1 SCAR=2.6
22 use Scalar::Util;
23  
24 use base 'Exporter';
25 our @EXPORT_OK = qw(ref_weak lang_select);
26 our %EXPORT_TAGS = (all => \@EXPORT_OK);
27  
28 sub ref_weak {
29 my ($obj) = @_;
30 Scalar::Util::weaken ($obj);
31 return \$obj;
32 }
33  
34 sub lang_select {
35 my %choices = @_;
36 my $default = $_[1];
37  
38 foreach my $lang (Glib::get_language_names()) {
39 if (exists $choices{$lang}) {
40 return $choices{$lang};
41 }
42 }
43 return $default;
44 }
45  
46 1;
47 __END__
« App/Chart/Weblink/SandP.pm ↑ Summary App/Chart/Gtk2/AnnotationsDialog.pm »