Skip to content

Commit 7684356

Browse files
committed
add a script to build a portable copy of perl
1 parent 0f2c558 commit 7684356

File tree

5 files changed

+57
-1
lines changed

5 files changed

+57
-1
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@
2626
/kryonet*
2727
/IO-Async-*
2828
/cpanfile.snapshot
29+
/perl
30+
/Logfile.CSV

build_perl.pl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
use strictures;
2+
3+
# this builds a portable copy of a windows system perl by scanning a
4+
# procmon log file and copying all files read by perl.exe in the capture
5+
6+
use 5.010;
7+
use Text::CSV_XS 'csv';
8+
use IO::All -binary, -utf8;
9+
10+
run();
11+
12+
sub run {
13+
my $base_path = $ARGV[0] || "c:\\perl";
14+
$base_path .= "\\";
15+
my $base_path_q = quotemeta $base_path;
16+
my $target_base = $ARGV[1] || "perl";
17+
18+
my @log = do {
19+
my $data = io( "Logfile.CSV" )->all;
20+
$data =~ s/^.*?\n//;
21+
@{ csv in => \$data };
22+
};
23+
for my $filter (
24+
sub { $_->[1] eq "perl.exe" }, #
25+
sub { $_->[4] eq "CreateFile" },
26+
sub { $_->[7] eq "SUCCESS" },
27+
sub { $_->[6] =~ /^$base_path_q/i },
28+
sub { $_->[6] !~ /\.bs$/ },
29+
sub { -f $_->[6] },
30+
)
31+
{
32+
@log = grep $filter->( $_ ), @log;
33+
}
34+
35+
my %files = map { $_->[6] => 1 } @log;
36+
my @files = sort keys %files;
37+
38+
for my $file ( @files ) {
39+
say $file;
40+
my $io = io( $file )->file;
41+
my $path = $io->filepath;
42+
$path =~ s/^$base_path_q//i;
43+
my $target_dir = io->catdir( $target_base, $path );
44+
$target_dir->mkpath if !$target_dir->exists;
45+
my $target_file = io->catfile( $target_dir->pathname, $io->filename )->name;
46+
$io->copy( $target_file );
47+
}
48+
49+
return;
50+
}

client_local.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
perl\bin\perl bin\microidium

dist.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ copyright_holder = Christian Walde
55
copyright_year = 2014
66

77
[@MITHALDU]
8-
exclude_match = ^(scratch|nytprof|kryonet|IO-Async-|local)
8+
exclude_match = ^(scratch|nytprof|kryonet|IO-Async-|local|perl|Logfile.CSV)
99
gitignore = /local*
1010
gitignore = /nytprof*
1111
gitignore = /kryonet*
1212
gitignore = /IO-Async-*
1313
gitignore = /cpanfile.snapshot
14+
gitignore = /perl
15+
gitignore = /Logfile.CSV
1416
skip_prereq = ^Microidium::Client$
1517
skip_prereq = ^IO::Async::Internals::Connector$
1618

server_local.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
perl\bin\perl bin\microidium_server

0 commit comments

Comments
 (0)