view bin/get_xml_image.pl @ 1134:80c1d74f2c7f draft

change the scope of id_count to member variables
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Thu, 17 Feb 2011 09:13:27 +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 .= $_;
    }
}