File: copyfile.pl

package info (click to toggle)
localization-config 1.05
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 668 kB
  • ctags: 44
  • sloc: perl: 3,170; sh: 67; makefile: 38
file content (24 lines) | stat: -rwxr-xr-x 621 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl
#
# copyfile.pl: commonly used routine to keep a logfile.
#
use strict;
use warnings;

require '/usr/lib/localization-config/common/log.pl';

sub copyfile {    
    my ($from, $to) = @_;
    log_msg("$0:copyfile(): copying $from -> $to");
    
    open(FROM, "$from");            # Open the file
    open(TO, ">$to");               # Open the file
    my @lines = <FROM>;             # Read it into an array
    print TO @lines;                # Print the array
    close(TO);                      # Close the dest file
    close(FROM);                    # Close the source file
    
    return 1;
}

1;