File: Utils.pm

package info (click to toggle)
libmodule-cpanfile-perl 1.1004-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 196 kB
  • sloc: perl: 531; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 388 bytes parent folder | download | duplicates (2)
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
package t::Utils;
use base qw(Exporter);
use File::pushd qw(tempd);

our @EXPORT = qw(write_cpanfile write_files);

sub write_cpanfile {
    write_files('cpanfile' => $_[0]);
}

sub write_files {
    my %files = @_;

    my $dir = tempd;

    for my $file (keys %files) {
        open my $fh, ">", $file or die "$file: $!";
        print $fh $files{$file};
    }

    return $dir;
}

1;