Advanced-Config
view release on metacpan or search on metacpan
lib/Advanced/Config/Reader.pm view on Meta::CPAN
DBUG_PRINT ("INFO", "Opening the config file named: %s", $file);
unless ( open ($READ_CONFIG, "<", $file) ) {
return DBUG_RETURN ( croak_helper ($opts,
"Unable to open the config file.", 0) );
}
# Misuse of this option makes the config file unreadable ...
if ( $opts->{use_utf8} ) {
binmode ($READ_CONFIG, "encoding(UTF-8)");
$pcfg->_allow_utf8 (); # Tells get_date() that wide char languages are OK!
}
# Some common RegExp strings ... Done here to avoid asking repeatably ...
my $decrypt_str = convert_to_regexp_string ($opts->{decrypt_lbl});
my $encrypt_str = convert_to_regexp_string ($opts->{encrypt_lbl});
my $hide_str = convert_to_regexp_string ($opts->{hide_lbl});
my $sect_str = convert_to_regexp_string ($opts->{source_file_section_lbl});
my $export_str = convert_to_regexp_string ($opts->{export_lbl});
lib/Advanced/Config/Reader.pm view on Meta::CPAN
DBUG_PRINT ("INFO", "Creating scratch file named: %s", $scratch);
unless ( open (NEW, ">", $scratch) ) {
close (ENCRYPT);
return DBUG_RETURN ( croak_helper ($rOpts,
"Unable to create the scratch config file.", 0) );
}
# Misuse of this option makes the config file unreadable ...
if ( $rOpts->{use_utf8} ) {
binmode (ENCRYPT, "encoding(UTF-8)");
binmode (NEW, "encoding(UTF-8)");
}
my $errMsg = "Unable to write to the scratch file.";
my $hide_section = 0;
my $count = 0;
while ( <ENCRYPT> ) {
chomp;
my $line = $_;
lib/Advanced/Config/Reader.pm view on Meta::CPAN
DBUG_PRINT ("INFO", "Creating scratch file named: %s", $scratch);
unless ( open (NEW, ">", $scratch) ) {
close (DECRYPT);
return DBUG_RETURN ( croak_helper ($rOpts,
"Unable to create the scratch config file.", 0) );
}
# Misuse of this option makes the config file unreadable ...
if ( $rOpts->{use_utf8} ) {
binmode (DECRYPT, "encoding(UTF-8)");
binmode (NEW, "encoding(UTF-8)");
}
my $errMsg = "Unable to write to the scratch file.";
my $hide_section = 0;
my $count = 0;
while ( <DECRYPT> ) {
chomp;
my $line = $_;
t/75-check_all_languages.t view on Meta::CPAN
my $file = $wide_flag ? $config_file_wide : $config_file_normal;
unless ( open (CONFIG, ">", $file) ) {
dbug_ok (0, "Creating the UTF-8 config file: $file");
return DBUG_RETURN (0);
}
my $msg;
if ( $wide_flag ) {
dbug_ok (1, "Creating the UTF-8 config file: $file");
binmode (CONFIG, "encoding(UTF-8)"); # Converts to wide-char / Unicode output.
$msg = "This file was created using UTF-8 Encoding";
} else {
dbug_ok (1, "Creating the normal config file: $file");
$msg = "This file was created without any special Encoding";
}
print CONFIG "\n";
print CONFIG "# This is an auto-genearted config file.\n";
print CONFIG "# Do not modify it by hand!\n\n";
print CONFIG "# ${msg}\n\n";
t/76-check_all_languages2.t view on Meta::CPAN
my $file = $wide_flag ? $config_file_wide : $config_file_normal;
unless ( open (CONFIG, ">", $file) ) {
dbug_ok (0, "Creating the UTF-8 config file: $file");
return DBUG_RETURN (0);
}
my $msg;
if ( $wide_flag ) {
dbug_ok (1, "Creating the UTF-8 config file: $file");
binmode (CONFIG, "encoding(UTF-8)"); # Converts to wide-char / Unicode output.
$msg = "This file was created using UTF-8 Encoding";
} else {
dbug_ok (1, "Creating the normal config file: $file");
$msg = "This file was created without any special Encoding";
}
print CONFIG "\n";
print CONFIG "# This is an auto-genearted config file.\n";
print CONFIG "# Do not modify it by hand!\n\n";
print CONFIG "# ${msg}\n\n";
( run in 0.891 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )