Aion

 view release on metacpan or  search on metacpan

lib/Aion/Types.pm  view on Meta::CPAN

Subroutine with body.

	sub code_ref {};
	sub code_forward;
	
	\&code_ref ~~ ImplementRef     # -> 1
	\&code_forward ~~ ImplementRef # -> ""

=head2 Isa[A...]

A link to a subroutine with the corresponding signature.

	sub sig_ex :Isa(Aion => Int => Str) {}
	
	\&sig_ex ~~ Isa[Aion => Int => Str] # -> 1
	\&sig_ex ~~ Isa[Object['Aion'] => Int => Str] # -> 1
	\&sig_ex ~~ Isa[Aion => Str => Num] # -> ""
	\&sig_ex ~~ Isa[Int => Num] # -> ""

Subroutines without a body are not wrapped in a signature handler, and the signature is remembered to validate the conformity of a subsequently declared subroutine with a body. Therefore the function has no signature.

	sub unreachable_sig_ex :Isa(Int => Str);
	
	\&unreachable_sig_ex ~~ Isa[Int => Str] # -> ""

=head2 RegexpRef

Regular expression.

	qr// ~~ RegexpRef # -> 1
	\1 ~~ RegexpRef   # -> ""

=head2 ValueRef`[A]

A reference to a scalar or reference.

	\12    ~~ ValueRef                 # -> 1
	\12    ~~ ValueRef                 # -> 1
	\-1.2  ~~ ValueRef[Num]            # -> 1
	\\-1.2 ~~ ValueRef[ValueRef[Num]] # -> 1

=head2 ScalarRef`[A]

Reference to a scalar.

	\12   ~~ ScalarRef      # -> 1
	\\12  ~~ ScalarRef      # -> ""
	\-1.2 ~~ ScalarRef[Num] # -> 1

=head2 RefRef`[A]

Link to link.

	\12    ~~ RefRef                 # -> ""
	\\12   ~~ RefRef                 # -> 1
	\-1.2  ~~ RefRef[Num]            # -> ""
	\\-1.2 ~~ RefRef[ScalarRef[Num]] # -> 1

=head2 GlobRef

Link to global

	\*A::a ~~ GlobRef # -> 1
	*A::a ~~ GlobRef  # -> ""

=head2 FileHandle

File descriptor.

	\*A::a ~~ FileHandle         # -> ""
	\*STDIN ~~ FileHandle        # -> 1
	
	open my $fh, "<", "/dev/null";
	$fh ~~ FileHandle	         # -> 1
	close $fh;
	
	opendir my $dh, ".";
	$dh ~~ FileHandle	         # -> 1
	closedir $dh;
	
	use constant { PF_UNIX => 1, SOCK_STREAM => 1 };
	
	socket my $sock, PF_UNIX, SOCK_STREAM, 0;
	$sock ~~ FileHandle	         # -> 1
	close $sock;

=head2 ArrayRef`[A]

Array references.

	[] ~~ ArrayRef	# -> 1
	{} ~~ ArrayRef	# -> ""
	[] ~~ ArrayRef[Num]	# -> 1
	{} ~~ ArrayRef[Num]	# -> ''
	[1, 1.1] ~~ ArrayRef[Num]	# -> 1
	[1, undef] ~~ ArrayRef[Num]	# -> ""

=head2 Lim[from?, to]

Limits arrays from C<from> or 0 to C<to> elements.

	[] ~~ Lim[5]     # -> 1
	[1..5] ~~ Lim[5] # -> 1
	[1..6] ~~ Lim[5] # -> ""
	
	[1..5] ~~ Lim[1,5] # -> 1
	[1..6] ~~ Lim[1,5] # -> ""
	
	[1] ~~ Lim[1,5] # -> 1
	[] ~~ Lim[1,5]  # -> ""
	
	Lim[0, 10] <= Lim[0, 20]        # -> 1
	Lim[10, 'Inf'] <= Lim[0, 'Inf'] # -> 1
	
	Lim[3] <= Lim[5]          # -> 1
	Lim[3] <= Lim[2]          # -> ""
	Lim[2,5] < Lim[1,6]       # -> 1
	Lim[2,5] == Lim[2,5]      # -> 1

=head2 HashRef`[H]



( run in 0.713 second using v1.01-cache-2.11-cpan-84de2e75c66 )