Changeset 940

Show
Ignore:
Timestamp:
10/31/07 07:08:20 (6 years ago)
Author:
miyagawa
Message:

skip Kwalify validation if it's not available

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/mobirc/trunk/mobirc/lib/Mobirc/ConfigLoader.pm

    r935 r940  
    22use strict; 
    33use warnings; 
    4 use Kwalify    (); 
    54use YAML::Syck (); 
    65use Storable; 
    76use Mobirc::Util; 
    87use Encode; 
     8 
     9our $HasKwalify; 
     10eval { 
     11    require Kwalify; 
     12    $HasKwalify++; 
     13}; 
    914 
    1015my $schema = { 
     
    120125    } 
    121126 
    122     my $res = Kwalify::validate( $schema, $config ); 
    123     unless ( $res == 1 ) { 
    124         die "config.yaml validation error : $res"; 
     127    if ($HasKwalify) { 
     128        my $res = Kwalify::validate( $schema, $config ); 
     129        unless ( $res == 1 ) { 
     130            die "config.yaml validation error : $res"; 
     131        } 
     132    } else { 
     133        warn "Kwalify is not installed. Skipping the config validation." if $^W; 
    125134    } 
    126135