5 die "$0: EPOCROOT unset\n" unless exists $ENV{EPOCROOT};
6 die "$0: EPOCROOT directory does exists\n" unless -d $ENV{EPOCROOT};
8 my $EPOC32 = "$ENV{EPOCROOT}epoc32";
9 my $EXE = "$EPOC32\\release\\thumb\\urel\\perlapp.app";
10 my $RSC = "$EPOC32\\data\\z\\system\\apps\\perlapp\\perlapp.rsc";
12 use Fcntl qw(O_RDONLY);
14 my %new = ($EXE => 'perlappmin.hex',
15 $RSC => 'perlrscmin.hex');
17 for my $fn ($EXE, $RSC) {
18 if (sysopen(my $fh, $fn, O_RDONLY)) {
22 my $newfn = $new{$fn};
24 if (($read = sysread($fh, $buffer, $size)) == $size) {
25 if (open(my $newfh, ">$newfn")) {
27 print $newfh unpack("H*", $buffer);
29 print "Created $newfn\n";
31 die qq[$0: open ">$newfn" failed: $!\n];
34 die qq[$0: sysread $size returned $read\n];
38 die qq[$0: sysopen "$fn": $!\n];