summaryrefslogtreecommitdiff
path: root/test/lib/Exim/Utils.pm
blob: 1dbd2d0da567b604db74cd6e39759fda3389fc0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package Exim::Utils;
use v5.10.1;
use strict;
use warnings;
use File::Copy;
use parent 'Exporter';
our @EXPORT_OK = qw(uniq numerically cp);


sub uniq {
    my %uniq = map { $_, undef } @_;
    return keys %uniq;
}

sub numerically { $::a <=> $::b }

sub cp {
    if ($File::Copy::VERSION >= 2.15) { # since Perl 5.11 we should have >= 2.15
        return File::Copy::cp(@_);
    }
    copy(@_) or return undef;
    my ($src, $dst) = @_;
    my @st = stat $src or return undef;
    chmod($st[2]&07777, $dst);
}

1;