Changeset 2362 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder/Conf.pm


Ignore:
Timestamp:
Feb 25, 2019, 12:20:27 PM (5 years ago)
Author:
Bruno Cornec
Message:

better usae of cluck instead of confess to avoid exiting abrutely when not needed

File:
1 edited

Legend:

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

    r2300 r2362  
    1515
    1616use strict;
    17 use Carp 'confess';
     17use Carp qw/cluck confess/;
    1818use Data::Dumper;
    1919use ProjectBuilder::Base;
     
    185185# Read the content of the config file and cache it in the %h hash then available for queries
    186186if ($PBCONFVER < 1) {
    187     open(CONF,$cf) || confess "Unable to open $cf";
     187    open(CONF,$cf) || cluck "Unable to open $cf" && return($lh);
    188188    # This is the original conf file format for versions up to 0.14
    189189    while(<CONF>) {
     
    331331confess "No configuration file defined to write into !" if (not defined $conffile);
    332332confess "No hash defined to read from !" if (not defined $h);
    333 open(CONF,"> $conffile") || confess "Unable to write into $conffile";
     333open(CONF,"> $conffile") || cluck "Unable to write into $conffile" && return;
    334334
    335335if ($PBCONFVER < 1) {
     
    547547my $dest = shift;
    548548
    549 open(ORIG,$orig) || confess "Unable to open $orig";
     549open(ORIG,$orig) || cluck "Unable to open $orig" && return;
    550550confess "Will not erase existing $dest while transforming $orig" if (-f $dest);
    551 open(DEST,"> $dest") || confess "Unable to write into $dest";
     551open(DEST,"> $dest") || cluck "Unable to write into $dest" && return;
    552552print DEST "---\n";
    553553my $pbconfverbkp = $PBCONFVER;
Note: See TracChangeset for help on using the changeset viewer.