File: readme.pl

package info (click to toggle)
colorize 0.67-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 804 kB
  • sloc: ansic: 1,828; perl: 764; makefile: 31; sh: 7
file content (30 lines) | stat: -rwxr-xr-x 535 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
26
27
28
29
30
#!/usr/bin/perl

use strict;
use warnings;

my $readme      = 'README';
my $readme_cgit = 'README.cgit';

die "$0: $readme does not exist\n" unless -e $readme;

open(my $fh, '<', $readme) or die "Cannot open $readme for reading: $!\n";
my $text = do { local $/; <$fh> };
close($fh);

$text = do {
    local $_ = $text;
    s/</&lt;/g;
    s/>/&gt;/g;
    $_
};

print "Writing $readme_cgit\n";

open($fh, '>', $readme_cgit) or die "Cannot open $readme_cgit for writing: $!\n";
print {$fh} <<"CGIT";
<pre>
$text
</pre>
CGIT
close($fh);