Changeset 1063 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder/Base.pm


Ignore:
Timestamp:
Jun 25, 2010, 5:22:22 AM (14 years ago)
Author:
Bruno Cornec
Message:

r3929@dhcp184-49-175-84: bruno | 2010-06-24 05:12:13 +0200

  • Modify pb_display_file interface to allow printing to a logfile in addition if reqested to
File:
1 edited

Legend:

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

    r1060 r1063  
    8787  # Manages content of a file
    8888  #
    89   pb_display_file("/etc/passwd");
     89  pb_display_file("/etc/passwd",\*STDERR);
    9090  my $cnt = pb_get_content("/etc/passwd");
    9191
     
    267267
    268268This function print the content of the file passed in parameter.
     269If a second parameter is given, this is the descriptor of the logfile to write to in addtion to STDOUT.
    269270
    270271This is a cat equivalent function.
     
    275276
    276277my $file=shift;
     278my $desc=shift || undef;
    277279
    278280return if (not -f $file);
    279 printf "%s\n",pb_get_content($file);
     281my $cnt = pb_get_content($file);
     282print "$cnt\n";
     283print $desc "$cnt\n" if (defined $desc);
    280284}
    281285
Note: See TracChangeset for help on using the changeset viewer.