kde-projects: Fix runtime check for YAML modules.

My attempt to make the KDEProjectReader's check for YAML be a runtime check was
thwarted because I had separately used a "use KDEProjectReader" elsewhere,
which Perl ensures happens at compile time.

Instead make the check part of the constructor so that the package can at least
compile without throwing an error.
wilder
Michael Pyne 8 years ago
parent 62b5614f9b
commit fdbaaaa548
  1. 5
      modules/ksb/KDEProjectsReader.pm

@ -11,6 +11,8 @@ use 5.014;
use File::Find; use File::Find;
sub _verifyYAMLModuleLoaded
{
# Load YAML-reading module if available without causing compile error if it # Load YAML-reading module if available without causing compile error if it
# isn't. Note that YAML::Tiny and YAML do not work since some metadata files # isn't. Note that YAML::Tiny and YAML do not work since some metadata files
# use features it doesn't support # use features it doesn't support
@ -28,6 +30,7 @@ if (!$success) {
join(', ', @YAML_Mods) . join(', ', @YAML_Mods) .
" modules, one of which is needed to handle KDE project data."; " modules, one of which is needed to handle KDE project data.";
} }
}
# Method: new # Method: new
# #
@ -45,6 +48,8 @@ sub new
my $projectMetadataModule = shift; my $projectMetadataModule = shift;
my $desiredProtocol = shift; my $desiredProtocol = shift;
_verifyYAMLModuleLoaded();
my $self = { my $self = {
# Maps short names to repo info blocks # Maps short names to repo info blocks
repositories => { }, repositories => { },

Loading…
Cancel
Save