mirror of
https://github.com/troydhanson/tpl.git
synced 2024-12-27 08:05:39 +08:00
24 lines
360 B
Plaintext
24 lines
360 B
Plaintext
|
#!/usr/bin/perl
|
||
|
#
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
|
||
|
use lib "..";
|
||
|
use Tpl;
|
||
|
|
||
|
my $pwd = `pwd`;
|
||
|
chomp $pwd;
|
||
|
|
||
|
my $tmp1 = "$pwd/$0_1.out";
|
||
|
|
||
|
my $i;
|
||
|
my $tpl = Tpl->tpl_map("A(i)",\$i);
|
||
|
for($i=0; $i<10; $i++) { $tpl->tpl_pack(1); }
|
||
|
$tpl->tpl_dump($tmp1);
|
||
|
|
||
|
my $j;
|
||
|
my $tpl2 = Tpl->tpl_map("A(i)",\$j);
|
||
|
$tpl2->tpl_load($tmp1);
|
||
|
while($tpl2->tpl_unpack(1) > 0) { print "$j\n" }
|
||
|
|