Changeset 1904


Ignore:
Timestamp:
Oct 9, 2014, 12:14:41 PM (5 years ago)
Author:
bruno
Message:
  • Add a pb_conf_write function and its test
Location:
devel/pb-modules
Files:
1 added
1 edited

Legend:

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

    r1795 r1904  
    2929 
    3030our @ISA = qw(Exporter);
    31 our @EXPORT = qw(pb_conf_init pb_conf_add pb_conf_read pb_conf_read_if pb_conf_get pb_conf_get_if pb_conf_print pb_conf_get_all);
     31our @EXPORT = qw(pb_conf_init pb_conf_add pb_conf_read pb_conf_read_if pb_conf_write pb_conf_get pb_conf_get_if pb_conf_print pb_conf_get_all);
    3232($VERSION,$REVISION) = pb_version_init();
    3333
     
    222222}
    223223return(@ptr);
     224}
     225
     226=item B<pb_conf_write>
     227
     228This function writes in the file passed ias first parameter the hash of values passed as second parameter
     229
     230=cut
     231
     232sub pb_conf_write {
     233
     234my $conffile = shift;
     235my $h = $_;
     236
     237open(CONF,"> $conffile") || confess "Unbale to wirte into $conffile";
     238
     239foreach my $p (keys %$h) {
     240    foreach my $key ($p) {
     241        print CONF "$p $key = $p->{$key}\n";
     242    }
     243}
     244close(CONF);
    224245}
    225246
Note: See TracChangeset for help on using the changeset viewer.