view bin/get_xml_image.pl @ 1615:2c6e9ed9db3b draft

merge
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 14 May 2013 13:38:17 +0900
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 .= $_;
    }
}