Mercurial > hg > Game > Cerium
changeset 1093:3e1caef39798 draft
add get_xml_image.pl
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 23 Dec 2010 11:21:52 +0900 |
parents | b99abedb5523 |
children | f10ec9bbd3f6 3b3b535baa51 |
files | bin/get_xml_image.pl |
diffstat | 1 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/get_xml_image.pl Thu Dec 23 11:21:52 2010 +0900 @@ -0,0 +1,18 @@ +#!/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 .= $_; + } +}