Perl-Dist-WiX

changeset 1065:17532030e7f4

Deal with unknown argument error in Asset::File.
author Curtis Jewell <perl@curtisjewell.name>
date Tue Jun 21 00:12:56 2011 -0600 (2011-06-21)
parents 5b199d3c8e9e
children 21b89425069d
files lib/Perl/Dist/WiX/Role/Asset.pm
line diff
     1.1 --- a/lib/Perl/Dist/WiX/Role/Asset.pm	Sun Jun 19 05:02:13 2011 -0600
     1.2 +++ b/lib/Perl/Dist/WiX/Role/Asset.pm	Tue Jun 21 00:12:56 2011 -0600
     1.3 @@ -201,7 +201,7 @@
     1.4  	}
     1.5  
     1.6  	# Validate 'parent' parameter early.
     1.7 -	my $parent = $args{parent};
     1.8 +	my $parent = $args{'parent'};
     1.9  	if ( not defined _INSTANCE( $args{parent}, 'Perl::Dist::WiX' ) ) {
    1.10  		PDWiX::Parameter->throw(
    1.11  			parameter =>
    1.12 @@ -210,11 +210,11 @@
    1.13  		);
    1.14  	}
    1.15  
    1.16 -	if ( not defined $args{url} ) {
    1.17 -		if ( defined $args{share} ) {
    1.18 +	if ( not defined $args{'url'} ) {
    1.19 +		if ( defined $args{'share'} ) {
    1.20  
    1.21  			# Map share to url vis File::ShareDir
    1.22 -			my ( $dist, $name ) = split /\s+/ms, $args{share};
    1.23 +			my ( $dist, $name ) = split /\s+/ms, $args{'share'};
    1.24  			$parent->trace_line( 2, "Finding $name in $dist... " );
    1.25  			my $file = rel2abs( File::ShareDir::dist_file( $dist, $name ) );
    1.26  			if ( not -f $file ) {
    1.27 @@ -223,24 +223,24 @@
    1.28  					message => 'Did not find file'
    1.29  				);
    1.30  			}
    1.31 -			$args{url} = URI::file->new($file)->as_string();
    1.32 +			$args{'url'} = URI::file->new($file)->as_string();
    1.33  			$parent->trace_line( 2, " found\n" );
    1.34  
    1.35 -		} elsif ( defined $args{name} ) {
    1.36 +		} elsif ( defined $args{'name'} ) {
    1.37  
    1.38  			PDWiX->throw(q{'name' without 'url' is deprecated});
    1.39  
    1.40  			# Map name to URL via the default package path
    1.41 -			$args{url} = $parent->binary_url( $args{name} );
    1.42 +			$args{'url'} = $parent->binary_url( $args{'name'} );
    1.43  		}
    1.44  	} ## end if ( not defined $args...)
    1.45  
    1.46  	if ( $class ne 'Perl::Dist::WiX::Asset::DistFile' ) {
    1.47  
    1.48  		# Create the filename from the url
    1.49 -		$args{file} = $args{url};
    1.50 -		$args{file} =~ s{.+/}{}ms;
    1.51 -		if ( not defined $args{file} or not length $args{file} ) {
    1.52 +		$args{'file'} = $args{'url'};
    1.53 +		$args{'file'} =~ s{.+/}{}ms;
    1.54 +		if ( not defined $args{'file'} or not length $args{'file'} ) {
    1.55  			if ( $class ne 'Perl::Dist::WiX::Asset::Website' ) {
    1.56  				PDWiX::Parameter->throw(
    1.57  					parameter => 'file',
    1.58 @@ -249,17 +249,17 @@
    1.59  			} else {
    1.60  
    1.61  				# file is not used in Websites.
    1.62 -				$args{file} = q{ };
    1.63 +				$args{'file'} = q{ };
    1.64  			}
    1.65  		} ## end if ( not defined $args...)
    1.66  	} ## end if ( $class ne 'Perl::Dist::WiX::Asset::DistFile')
    1.67  
    1.68  	my %default_args = (
    1.69 -		url    => $args{url},
    1.70 -		file   => $args{file},
    1.71 -		parent => $args{parent},
    1.72 +		url    => $args{'url'},
    1.73 +		file   => $args{'file'},
    1.74 +		parent => $args{'parent'},
    1.75  	);
    1.76 -	delete @args{ 'url', 'file', 'parent' };
    1.77 +	delete @args{ 'url', 'file', 'parent', 'share' };
    1.78  
    1.79  	return { ( %default_args, %args ) };
    1.80  } ## end sub BUILDARGS