Mercurial > hg > Game > Cerium
view bin/get_xml_image.pl @ 1198:2abd68a1ac2a draft
add example/regex
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 11 Jul 2011 23:50:10 +0900 (2011-07-11) |
parents | 3e1caef39798 |
children |
line wrap: on
line source
#!/usr/bin/perl use MIME::Base64; my $image; my $buf; while(<>) { if (/<image name="(.*)">/) { $image= $1; $buf = ''; } elsif (/<\/image>/ ) { open(OUT, ">/tmp/$image") ; print OUT decode_base64($buf); $image = ''; } elsif ($image) { $buf .= $_; } }