diff options
author | Jonas Smedegaard <dr@jones.dk> | 2024-09-02 21:03:48 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-09-02 21:03:48 +0200 |
commit | 97b0d01cbed7c4a2ce7ea029881b79bdb0d02ef5 (patch) | |
tree | e8c0c694f037ec456d5f9110adcc1eef9f8c330c | |
parent | a420a7c6cfe5004a0b6c43d471775919099de8c5 (diff) |
-rw-r--r-- | lib/Object/Groupware.pm | 7 | ||||
-rw-r--r-- | lib/Object/Groupware/Calendar.pm | 7 | ||||
-rw-r--r-- | lib/Object/Groupware/DAV.pm | 7 | ||||
-rw-r--r-- | lib/Object/Groupware/Event.pm | 22 |
4 files changed, 30 insertions, 13 deletions
diff --git a/lib/Object/Groupware.pm b/lib/Object/Groupware.pm index 4efc627..eac1bf7 100644 --- a/lib/Object/Groupware.pm +++ b/lib/Object/Groupware.pm @@ -1,7 +1,7 @@ use v5.36; #use Feature::Compat::Class 0.07; -use Object::Pad 0.78 qw(:experimental(init_expr)); +use Object::Pad 0.78; package Object::Groupware 0.01; @@ -11,13 +11,16 @@ use utf8; use Log::Any qw( ); -field $log = Log::Any->get_logger; +field $log = undef; field $dt_locale : param : reader = undef; field $dt_time_zone : param : reader = undef; field $dt_span_time_prefix : param : reader = ''; ADJUST { + # TODO: use Object::Pad 0.07 and move this to field initializer + $log = Log::Any->get_logger; + if ( defined $self->dt_locale and not $self->dt_locale isa DateTime::Locale::FromData ) { diff --git a/lib/Object/Groupware/Calendar.pm b/lib/Object/Groupware/Calendar.pm index 28ae500..8d62e44 100644 --- a/lib/Object/Groupware/Calendar.pm +++ b/lib/Object/Groupware/Calendar.pm @@ -1,7 +1,7 @@ use v5.36; #use Feature::Compat::Class 0.07; -use Object::Pad 0.78 qw(:experimental(init_expr)); +use Object::Pad 0.78; package Object::Groupware::Calendar 0.01; @@ -15,13 +15,16 @@ use Encode qw(decode_utf8); use Object::Groupware::Event; -field $log = Log::Any->get_logger; +field $log = undef; # borrow from Data::ICal::new() signature field $data : param = undef; field $filename : param = undef; ADJUST { + # TODO: use Object::Pad 0.07 and move this to field initializer + $log //= Log::Any->get_logger; + if ($data) { if ( $data isa Data::ICal ) { } else { $data = Data::ICal->new( data => $data ) } diff --git a/lib/Object/Groupware/DAV.pm b/lib/Object/Groupware/DAV.pm index 4b12808..8487543 100644 --- a/lib/Object/Groupware/DAV.pm +++ b/lib/Object/Groupware/DAV.pm @@ -1,7 +1,7 @@ use v5.36; #use Feature::Compat::Class 0.07; -use Object::Pad 0.78 qw(:experimental(init_expr)); +use Object::Pad 0.78; package Object::Groupware::DAV 0.01; @@ -21,7 +21,7 @@ use DateTime; use Object::Groupware::Calendar; -field $log = Log::Any->get_logger; +field $log = undef; field $uri : param; field $user : param = undef; @@ -30,6 +30,9 @@ field $pass : param = undef; field $session; ADJUST { + # TODO: use Object::Pad 0.07 and move this to field initializer + $log //= Log::Any->get_logger; + $uri = URI->new($uri) or $log->fatal( 'failed to parse URI %s', $uri ) && exit 2; diff --git a/lib/Object/Groupware/Event.pm b/lib/Object/Groupware/Event.pm index 4b04393..a7f5842 100644 --- a/lib/Object/Groupware/Event.pm +++ b/lib/Object/Groupware/Event.pm @@ -1,7 +1,7 @@ use v5.36; #use Feature::Compat::Class 0.07; -use Object::Pad 0.78 qw(:experimental(init_expr)); +use Object::Pad 0.78; package Object::Groupware::Event 0.01; @@ -14,22 +14,30 @@ use Feature::Compat::Try; use DateTime::Locale; use Encode qw(decode_utf8); -field $log = Log::Any->get_logger; +field $log = undef; field $entry : param; field $dt_locale; field $span; -field $start : reader = $entry->start; -field $end : reader = $entry->end; -field $summary : reader = decode_utf8 $entry->summary; -field $description : reader = decode_utf8 $entry->description || ''; -field $location : reader = decode_utf8 $entry->_simple_property('location'); +field $start : reader = undef; +field $end : reader = undef; +field $summary : reader = undef; +field $description : reader = undef; +field $location : reader = undef; field $price : reader; field @attendees; field @attachments; ADJUST { + # TODO: use Object::Pad 0.07 and move these to field initializer + $log //= Log::Any->get_logger; + $start //= $entry->start; + $end //= $entry->end; + $summary //= decode_utf8 $entry->summary; + $description //= decode_utf8 $entry->description || ''; + $location //= decode_utf8 $entry->_simple_property('location'); + if ( $self->dt_locale ) { $dt_locale = $self->dt_locale; $start->set_locale($dt_locale); |