Log-Shiras

 view release on metacpan or  search on metacpan

lib/Log/Shiras/Types.pm  view on Meta::CPAN

		for my $value (
			split /,|=>/,
				$item_ref->{alt_input}->[$item_ref->{alt_position}]->[2] ){
			$value =~ s/\s//g;
			$value =~ s/^['"]([^'"]*)['"]$/$1/g;
			push @$new_ref, $value;
			if( $dispatch ){
				$item_ref->{bump_count} -=
					( $value =~/^\d+$/ )? $value :
					( $value =~/^\*$/ )? 1 : 0 ;
				$dispatch = undef;
			}else{
				$dispatch = $value;
			}
		}
	}
	$item_ref->{alt_input}->[$item_ref->{alt_position}] = { commands => $new_ref };
	$item_ref->{alt_input}->[$item_ref->{alt_position}]->{start_at} =
		( exists $item_ref->{bump_list} ) ?
			$#{$item_ref->{bump_list}} + 1 : 0 ;
	$item_ref->{alt_position}++;
###InternalTypeSShirasFormat	warn "item ref:" . Dumper( $item_ref );
	return $item_ref;
}

sub _test_for_position_change{
	my ( $item, $item_ref ) = @_;
###InternalTypeSShirasFormat	warn "reached _test_for_position_change with:" . Dumper( $item );
	if( exists $item_ref->{conflict_test} ){
		$item_ref = "You cannot call for alternative location pull -" .
		$item_ref->{conflict_test} . "- and get data from the -$item- " .
		"source in ShirasFormat type coersion at line " . __LINE__ . ".\n";
	}
	return $item_ref;
}

sub _alt_position{
	my ( $item, $item_ref ) = @_;
###InternalTypeSShirasFormat	warn "reached _alt_position with:" . Dumper( $item );
	$item_ref->{conflict_test} = $item if $item;
	return $item_ref;
}

#########1 Phinish    	      3#########4#########5#########6#########7#########8#########9

1;
# The preceding line will help the module return a true value

#########1 main pod docs      3#########4#########5#########6#########7#########8#########9
__END__

=head1 NAME

Log::Shiras::Types - The Type::Tiny library for Log::Shiras

=head1 SYNOPSIS

	#!perl
	package Log::Shiras::Report::MyRole;

	use Modern::Perl;#suggested
	use Moose::Role;
	use Log::Shiras::Types v0.013 qw(
		ShirasFormat
		JsonFile
	);

	has	'someattribute' =>(
			isa     => ShirasFormat,#Note the lack of quotes
		);

	sub valuetestmethod{
		return is_JsonFile( 'my_file.jsn' );
	}

	no Moose::Role;

	1;

=head1 DESCRIPTION

This is the custom type class that ships with the L<Log::Shiras> package.

There are only subtypes in this package!  B<WARNING> These types should be
considered in a beta state.  Future type fixing will be done with a set of tests in
the test suit of this package.  (currently few are implemented)

See L<MooseX::Types> for general re-use of this module.

=head1 Types

=head2  PosInt

=over

=item B<Definition: >all integers equal to or greater than 0

=item B<Coercions: >no coersion available

=back

=head2  ElevenInt

=over

=item B<Definition: >any posInt less than 11

=item B<Coercions: >no coersion available

=back

=head2  ElevenArray

=over

=item B<Definition: >an array with up to 12 total positions [0..11]
L<I<This one goes to eleven>|https://en.wikipedia.org/wiki/This_Is_Spinal_Tap>

=item B<Coercions: >no coersion available

=back



( run in 0.731 second using v1.01-cache-2.11-cpan-d7f47b0818f )