File: Utils.pm

package info (click to toggle)
libmime-lite-perl 3.033-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 660 kB
  • sloc: perl: 1,848; makefile: 9
file content (23 lines) | stat: -rw-r--r-- 390 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package Utils;

@ISA = qw(Exporter);
@EXPORT = qw(slurp spew cmp);

sub slurp { 
    my $path = shift;
    open IN, "<$path"; my $data = join('',<IN>); close IN; $data;
}

sub spew  { 
    my ($path, $data) = @_;
    open OUT, ">$path"; print OUT $data; close OUT;
}

sub cmp {
    my ($a, $b) = @_;
    $a =~ s/\r//g;
    $b =~ s/\r//g;
    return ($a eq $b);
}

1;