File Coverage

blib/lib/DesktopWorkspaceRole/Source/DefHash.pm
Criterion Covered Total %
statement 30 33 90.9
branch 5 10 50.0
condition n/a
subroutine 9 9 100.0
pod 0 4 0.0
total 44 56 78.5


line stmt bran cond sub pod time code
1             package DesktopWorkspaceRole::Source::DefHash;
2              
3 3     3   237297 use strict;
  3         5  
  3         88  
4 3     3   41 use 5.010001;
  3         12  
5 3     3   425 use Role::Tiny;
  3         4604  
  3         14  
6 3     3   902 use Role::Tiny::With;
  3         233  
  3         306  
7             with 'DesktopWorkspaceRole::Spec::Basic';
8              
9             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10             our $DATE = '2026-03-29'; # DATE
11             our $DIST = 'DesktopWorkspaceRoles-Standard'; # DIST
12             our $VERSION = '0.001'; # VERSION
13              
14             sub new {
15 1     1 0 292265 my ($class, %args) = @_;
16              
17 1         3 my $defhash = delete $args{defhash};
18 1 50       9 unless ($defhash) {
19 3     3   15 no strict 'refs'; ## no critic: TestingAndDebugging::ProhibitNoStrict
  3         5  
  3         761  
20 1         2 $defhash = ${"$class\::SPEC"};
  1         3  
21             }
22              
23 1 50       3 die "Unknown argument(s): ". join(", ", sort keys %args)
24             if keys %args;
25              
26 1         5 bless {
27             defhash => $defhash,
28             }, $class;
29             }
30              
31             sub items {
32 1     1 0 4 my $self = shift;
33 1 50       8 if (@_) {
34 0         0 $self->{defhash}{items} = $_[0];
35             } else {
36 1         8 $self->{defhash}{items};
37             }
38             }
39              
40             sub kde_activity {
41 1     1 0 2 my $self = shift;
42 1 50       3 if (@_) {
43 0         0 $self->{defhash}{kde_activity} = $_[0];
44             } else {
45 1         5 $self->{defhash}{kde_activity};
46             }
47             }
48              
49             sub new_browser_window {
50 1     1 0 2 my $self = shift;
51 1 50       3 if (@_) {
52 0         0 $self->{defhash}{new_browser_window} = $_[0];
53             } else {
54 1         4 $self->{defhash}{new_browser_window};
55             }
56             }
57              
58             1;
59             # ABSTRACT: Get specification from a DefHash
60              
61             __END__