File Coverage

blib/lib/Acme/Resume/Output/ToPlain.pm
Criterion Covered Total %
statement 72 111 64.8
branch 0 18 0.0
condition n/a
subroutine 21 23 91.3
pod n/a
total 93 152 61.1


line stmt bran cond sub pod time code
1 1     1   17444 use MoopsX::UsingMoose;
  2         459  
  1         11  
2 1     1   3092 use 5.14.0;
  1         5  
3 1     1   6 use strict;
  1         2  
  1         29  
4 1     1   8 use warnings;
  1         3  
  1         97  
5              
6             # ABSTRACT: Role for plain output
7             # PODNAME: Acme::Resume::Output::ToPlain
8             our $VERSION = '0.0104';
9              
10 1     1   5463 role Acme::Resume::Output::ToPlain {
  1     1   34  
  1     1   12  
  1     1   3  
  1     1   77  
  1     1   7  
  1     1   2  
  1     1   11  
  1     1   428  
  1     1   3  
  1     1   10  
  1     1   155  
  1     1   3  
  1     1   73  
  1         8  
  1         2  
  1         130  
  1         59  
  1         7  
  1         2  
  1         8  
  1         6347  
  1         3  
  1         16  
  1         6560  
  1         4  
  1         12  
  1         15168  
  1         4  
  1         16  
  1         121  
  1         3  
  1         12  
  1         336  
  1         3  
  1         11  
  1         1646  
  1         3  
  1         11  
  1         4038  
  1         5  
  1         45  
  1         4  
  1         58  
  1         8  
  1         2  
  1         99  
  1         7  
  1         2  
  1         172  
  1         5032  
  0            
11              
12 1     1   792 use String::Nudge;
  1         603  
  1         63  
13              
14 1 0   1   1883 method to_plain {
  1     0   3  
  1         945  
  1         21  
  0            
  0            
15              
16 0           my @lines = ($self->name, '',
17             $self->email, '',
18             $self->phone, '',
19             $self->formatted_address, '');
20              
21 0 0         if($self->has_education) {
22 0           push @lines => 'Education', '-' x length 'education';
23              
24 0           foreach my $edu ($self->all_educations) {
25 0           push @lines => 'School: ' . $edu->school;
26 0 0         push @lines => 'Url: ' . $edu->url if $edu->has_url;
27 0           push @lines => 'Location: ' . $edu->location;
28 0           push @lines => 'Program: ' . $edu->program;
29 0           push @lines => 'Started: ' . $edu->started->strftime('%Y-%m-%d');
30 0 0         push @lines => 'Left: ' . $edu->left->strftime('%Y-%m-%d') if $edu->has_left;
31 0           push @lines => "Description:\n" . nudge($edu->description), '', '';
32             }
33             }
34              
35 0 0         if($self->has_job_history) {
36 0           push @lines => '', 'Work experience', '-' x length 'work experience';
37              
38 0           foreach my $job ($self->all_jobs) {
39              
40 0           push @lines => 'Company: ' . $job->company;
41 0 0         push @lines => 'Url: ' . $job->url if $job->has_url;
42 0           push @lines => 'Location: ' . $job->location;
43 0           push @lines => 'Role: ' . $job->role;
44 0           push @lines => 'Started: ' . $job->started->strftime('%Y-%m-%d');
45              
46 0 0         if($job->has_left) {
    0          
47 0           my $start = $job->started;
48 0           my $left = $job->left;
49              
50 0           $left = $left->minus_years($start->year);
51 0           $left = $left->minus_months($start->month);
52 0           $left = $left->minus_days($start->day_of_month);
53              
54 0           push @lines => 'Left: ' . $job->left->strftime('%Y-%m-%d') . ' ' . sprintf '(%d years, %d months and %d days)', $left->year, $left->month, $left->day_of_month;
55             }
56             elsif($job->current) {
57 0           my $start = $job->started;
58 0           my $now = Time::Moment->now;
59              
60 0           $now = $now->minus_years($start->year);
61 0           $now = $now->minus_months($start->month);
62 0           $now = $now->minus_days($start->day_of_month);
63 0           push @lines => 'Left: Current job' . ' ' . sprintf '(%d years, %d months and %d days - and counting)', $now->year, $now->month, $now->day_of_month;
64             }
65 0           push @lines => "Description:\n" . nudge($job->description), '', '';
66             }
67             }
68              
69 0           return join "\n" => @lines;
70             }
71              
72 1 0   1   1413 method formatted_address {
  1     0   3  
  1         140  
  0            
  0            
73             return $self->join_address("\n");
74             }
75             }
76              
77             1;
78              
79             __END__
80              
81             =pod
82              
83             =encoding UTF-8
84              
85             =head1 NAME
86              
87             Acme::Resume::Output::ToPlain - Role for plain output
88              
89             =head1 VERSION
90              
91             Version 0.0104, released 2021-08-31.
92              
93             =head1 SOURCE
94              
95             L<https://github.com/Csson/p5-Acme-Resume>
96              
97             =head1 HOMEPAGE
98              
99             L<https://metacpan.org/release/Acme-Resume>
100              
101             =head1 AUTHOR
102              
103             Erik Carlsson <info@code301.com>
104              
105             =head1 COPYRIGHT AND LICENSE
106              
107             This software is copyright (c) 2021 by Erik Carlsson.
108              
109             This is free software; you can redistribute it and/or modify it under
110             the same terms as the Perl 5 programming language system itself.
111              
112             =cut