Module-JSAN

 view release on metacpan or  search on metacpan

inc/Module/Build/Functions.pm  view on Meta::CPAN

	} ## end else [ if ( $type eq 'dist' )]

	# Set the path to install to.
	install_path( $sharecode, $installation_path );

	# This helps for testing purposes...
	if ( $Module::Build::VERSION >= 0.31 ) {
		Module::Build->add_property( $sharecode . '_files',
			default => sub { return {} } );
	}

	# 99% of the time we don't want to index a shared dir
	no_index($dir);

	# This construction requires 0.26.
	_mb_required('0.26');
	return;
} ## end sub install_share

# Module::Build syntax

sub _af_hashref {
	my $feature = shift;
	unless ( exists $ARGS{auto_features} ) {
		$ARGS{auto_features} = {};
	}
	unless ( exists $ARGS{auto_features}{$feature} ) {
		$ARGS{auto_features}{$feature} = {};
		$ARGS{auto_features}{$feature}{requires} = {};
	}
	return;
}

sub auto_features {
	my $feature = shift;
	my $type    = shift;
	my $param1  = shift;
	my $param2  = shift;
	_af_hashref($type);

	if ( 'description' eq $type ) {
		$ARGS{auto_features}{$feature}{description} = $param1;
	} elsif ( 'requires' eq $type ) {
		$ARGS{auto_features}{$feature}{requires}{$param1} = $param2;
	} else {
		croak "Invalid type $type for auto_features";
	}
	_mb_required('0.26');
	return;
} ## end sub auto_features

sub extra_compiler_flags {
	my $flag = shift;
	if ( 'ARRAY' eq ref $flag ) {
		foreach my $f ( @{$flag} ) {
			extra_compiler_flags($f);
		}
	}

	if ( $flag =~ m{\s} ) {
		my @flags = split m{\s+}, $flag;
		foreach my $f (@flags) {
			extra_compiler_flags($f);
		}
	} else {
		_create_arrayref('extra_compiler_flags');
		push @{ $ARGS{'extra_compiler_flags'} }, $flag;
	}
	_mb_required('0.19');
	return;
} ## end sub extra_compiler_flags

sub extra_linker_flags {
	my $flag = shift;
	if ( 'ARRAY' eq ref $flag ) {
		foreach my $f ( @{$flag} ) {
			extra_linker_flags($f);
		}
	}

	if ( $flag =~ m{\s} ) {
		my @flags = split m{\s+}, $flag;
		foreach my $f (@flags) {
			extra_linker_flags($f);
		}
	} else {
		_create_arrayref('extra_linker_flags');
		push @{ $ARGS{'extra_linker_flags'} }, $flag;
	}
	_mb_required('0.19');
	return;
} ## end sub extra_linker_flags

sub module_name {
	my ($name) = shift;
	$ARGS{'module_name'} = $name;
	unless ( exists $ARGS{'dist_name'} ) {
		my $dist_name = $name;
		$dist_name =~ s/::/-/g;
		dist_name($dist_name);
	}
	_mb_required('0.03');
	return;
}

sub no_index {
	my $name = pop;
	my $type = shift || 'directory';

	# TODO: compatibility code.

	_create_hashref('no_index');
	_create_hashref_arrayref( 'no_index', $type );
	push @{ $ARGS{'no_index'}{$type} }, $name;
	_mb_required('0.28');
	return;
} ## end sub no_index

sub PL_files { ## no critic(Capitalization)
	my $pl_file = shift;
	my $pm_file = shift || [];
	if ( 'HASH' eq ref $pl_file ) {
		my ( $k, $v );
		while ( ( $k, $v ) = each %{$pl_file} ) {
			PL_files( $k, $v );
		}
	}

	_create_hashref('PL_files');
	$ARGS{PL_files}{$pl_file} = $pm_file;
	_mb_required('0.06');
	return;
} ## end sub PL_files

sub meta_merge {
	my $key   = shift;
	my $value = shift;
	if ( 'HASH' eq ref $key ) {
		my ( $k, $v );
		while ( ( $k, $v ) = each %{$key} ) {
			meta_merge( $k, $v );
		}



( run in 2.273 seconds using v1.01-cache-2.11-cpan-71847e10f99 )