-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fuji Goro
committed
Aug 30, 2011
1 parent
b665c05
commit e0d967a
Showing
1 changed file
with
14 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
#!perl -w | ||
use strict; | ||
use Text::Xslate; | ||
use Data::MessagePack; | ||
use Data::Dumper; | ||
my $tx = Text::Xslate->new(cache => 2); | ||
use File::Slurp qw(slurp); | ||
|
||
$Data::Dumper::Indent = 0; | ||
$Data::Dumper::Terse = 1; | ||
$Data::Dumper::Useqq = 1; | ||
|
||
foreach my $file(@ARGV) { | ||
my $asm = $tx->load_file($file); | ||
foreach my $c(@{$asm}) { | ||
my $data = slurp($file); | ||
my $unpacker = Data::MessagePack::Unpacker->new(); | ||
|
||
my $offset = $unpacker->execute($data); | ||
my $is_utf8 = $unpacker->data(); | ||
$unpacker->reset(); | ||
$unpacker->utf8($is_utf8); | ||
|
||
while($offset < length($data)) { | ||
$offset = $unpacker->execute($data, $offset); | ||
my $c = $unpacker->data(); | ||
$unpacker->reset(); | ||
print Dumper($c), "\n"; | ||
} | ||
} |