Changeset 2484


Ignore:
Timestamp:
Mar 22, 2020, 6:51:01 PM (10 days ago)
Author:
Bruno Cornec
Message:

Adds an internal YAML module from YAML::Tiny to allow distribution without YAML support to work

Location:
devel/pb-modules/lib/ProjectBuilder
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r2434 r2484  
    220220        };
    221221        if ($@) {
    222             die "Unable to handle YAML configuration files without a YAML.pm module\n";
     222            eval {
     223                # No YAML found using a more std but less complete one. Old perl only
     224                require YAML::Tiny;
     225                YAML::Tiny->import();
     226            };
     227            if ($@) {
     228                eval {
     229                    # No YAML found using an embedded pne
     230                    require ProjectBuilder::YAML;
     231                    ProjectBuilder::YAML->import();
     232                };
     233                if ($@) {
     234                    # Here we should be in the setup phase, with an embedded YAML code
     235                    $ldfunc = \&LoadFile;
     236                    #die "Unable to handle YAML configuration files without a YAML.pm module\n";
     237                } else {
     238                    $ldfunc = \&ProjectBuilder::YAML::LoadFile;
     239                }
     240            } else {
     241                $ldfunc = \&YAML::Tiny::LoadFile;
     242            }
    223243        } else {
    224244            $ldfunc = \&Module::Build::YAML::LoadFile;
Note: See TracChangeset for help on using the changeset viewer.