1cdf0e10cSrcweir: 2cdf0e10cSrcweireval 'exec perl -wS $0 ${1+"$@"}' 3cdf0e10cSrcweir if 0; 4cdf0e10cSrcweir 5*7e90fac2SAndrew Rist#************************************************************** 6*7e90fac2SAndrew Rist# 7*7e90fac2SAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 8*7e90fac2SAndrew Rist# or more contributor license agreements. See the NOTICE file 9*7e90fac2SAndrew Rist# distributed with this work for additional information 10*7e90fac2SAndrew Rist# regarding copyright ownership. The ASF licenses this file 11*7e90fac2SAndrew Rist# to you under the Apache License, Version 2.0 (the 12*7e90fac2SAndrew Rist# "License"); you may not use this file except in compliance 13*7e90fac2SAndrew Rist# with the License. You may obtain a copy of the License at 14*7e90fac2SAndrew Rist# 15*7e90fac2SAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 16*7e90fac2SAndrew Rist# 17*7e90fac2SAndrew Rist# Unless required by applicable law or agreed to in writing, 18*7e90fac2SAndrew Rist# software distributed under the License is distributed on an 19*7e90fac2SAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20*7e90fac2SAndrew Rist# KIND, either express or implied. See the License for the 21*7e90fac2SAndrew Rist# specific language governing permissions and limitations 22*7e90fac2SAndrew Rist# under the License. 23*7e90fac2SAndrew Rist# 24*7e90fac2SAndrew Rist#************************************************************** 25*7e90fac2SAndrew Rist 26*7e90fac2SAndrew Rist 27cdf0e10cSrcweir 28cdf0e10cSrcweiruse warnings; 29cdf0e10cSrcweiruse strict 'vars'; 30cdf0e10cSrcweir 31cdf0e10cSrcweir# package all .icns if XML::Parser module is not installed 32cdf0e10cSrcweireval 'use XML::Parser;'; if ( $@ ) { print '*.icns'; exit 0; }; 33cdf0e10cSrcweir 34cdf0e10cSrcweirmy $valuetype = "none"; 35cdf0e10cSrcweirmy $key = "none"; 36cdf0e10cSrcweir 37cdf0e10cSrcweir# 38cdf0e10cSrcweir# XML handlers 39cdf0e10cSrcweir# 40cdf0e10cSrcweir 41cdf0e10cSrcweirsub start_handler { 42cdf0e10cSrcweir my ($parser,$element,%attributes) = @_; 43cdf0e10cSrcweir $valuetype = "$element"; 44cdf0e10cSrcweir} 45cdf0e10cSrcweir 46cdf0e10cSrcweirsub char_handler { 47cdf0e10cSrcweir my ($parser,$string) = @_; 48cdf0e10cSrcweir if ( $key eq "CFBundleTypeIconFile" || $key eq "CFBundleIconFile" ) { 49cdf0e10cSrcweir $string =~ s/^\s+//; 50cdf0e10cSrcweir $string =~ s/\s+$//; 51cdf0e10cSrcweir print "$string " if length($string) > 0; 52cdf0e10cSrcweir } 53cdf0e10cSrcweir $key = "$string" if $valuetype eq "key"; 54cdf0e10cSrcweir} 55cdf0e10cSrcweir 56cdf0e10cSrcweirsub default_handler { 57cdf0e10cSrcweir my ($parser,$string) = @_; 58cdf0e10cSrcweir} 59cdf0e10cSrcweir 60cdf0e10cSrcweirsub end_handler { 61cdf0e10cSrcweir my ($parser,$element) = @_; 62cdf0e10cSrcweir 63cdf0e10cSrcweir $key = "none" if $valuetype ne "key"; 64cdf0e10cSrcweir $valuetype = "none"; 65cdf0e10cSrcweir} 66cdf0e10cSrcweir 67cdf0e10cSrcweir# 68cdf0e10cSrcweir# main 69cdf0e10cSrcweir# 70cdf0e10cSrcweir 71cdf0e10cSrcweirmy $parser = new XML::Parser(ErrorContext => 2, 72cdf0e10cSrcweir Namespaces => 1); 73cdf0e10cSrcweir 74cdf0e10cSrcweir$parser->setHandlers( Start => \&start_handler, 75cdf0e10cSrcweir End => \&end_handler, 76cdf0e10cSrcweir Char => \&char_handler, 77cdf0e10cSrcweir Default => \&default_handler); 78cdf0e10cSrcweir$parser->parse(STDIN); 79cdf0e10cSrcweir 80cdf0e10cSrcweirprint "\n"; 81