|
Lines 96-101
use Encode;
Link Here
|
| 96 |
use File::Spec; |
96 |
use File::Spec; |
| 97 |
use Module::Load::Conditional qw(can_load); |
97 |
use Module::Load::Conditional qw(can_load); |
| 98 |
use POSIX (); |
98 |
use POSIX (); |
|
|
99 |
use YAML qw/Load/; |
| 99 |
use ZOOM; |
100 |
use ZOOM; |
| 100 |
|
101 |
|
| 101 |
use C4::Boolean; |
102 |
use C4::Boolean; |
|
Lines 437-442
sub boolean_preference {
Link Here
|
| 437 |
return defined($it)? C4::Boolean::true_p($it): undef; |
438 |
return defined($it)? C4::Boolean::true_p($it): undef; |
| 438 |
} |
439 |
} |
| 439 |
|
440 |
|
|
|
441 |
=head2 yaml_preference |
| 442 |
|
| 443 |
Retrieves the required system preference value, and converts it |
| 444 |
from YAML into a Perl data structure. It throws an exception if |
| 445 |
the value cannot be properly decoded as YAML. |
| 446 |
|
| 447 |
=cut |
| 448 |
|
| 449 |
sub yaml_preference { |
| 450 |
my ( $self, $preference ) = @_; |
| 451 |
|
| 452 |
my $yaml = eval { YAML::Load( $self->preference( $preference ) ); }; |
| 453 |
if ($@) { |
| 454 |
warn "Unable to parse $preference syspref : $@"; |
| 455 |
return; |
| 456 |
} |
| 457 |
|
| 458 |
return $yaml; |
| 459 |
} |
| 460 |
|
| 440 |
=head2 enable_syspref_cache |
461 |
=head2 enable_syspref_cache |
| 441 |
|
462 |
|
| 442 |
C4::Context->enable_syspref_cache(); |
463 |
C4::Context->enable_syspref_cache(); |
| 443 |
- |
|
|