#!/usr/bin/perl -w # # $Id: uri2path,v 1.1 2007/08/09 00:35:07 vogelke Exp $ # #< uri2path: accept a URI starting with file://, and print the path. use Cwd 'realpath'; use strict; if (@ARGV) { foreach (@ARGV) { decode($_); } } else { while (<>) { chomp; decode($_); } } exit(0); sub decode { my $uri = shift; $uri =~ s!^file://!!; $uri =~ s/%([a-f0-9][a-f0-9])/chr( hex( $1 ) )/gei; print "$uri\n"; }