Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Data::Util::JA(3)     User Contributed Perl Documentation    Data::Util::JA(3)

NAME
       Data::Util::JA -	aa1/4a?a"aa1/4a?aa(R)aaa(R)a|a1/4aaLaaaaLe

VERSION
       This document describes Data::Util version 0.63

SYNOPSIS
	       use Data::Util qw(:validate);

	       sub foo{
		       # they will die if invalid values are supplied
		       my $sref	= scalar_ref(shift);
		       my $aref	= array_ref(shift);
		       my $href	= hash_ref(shift);
		       my $cref	= code_ref(shift);
		       my $gref	= glob_ref(shift);
		       my $rref	= regex_ref(shift);
		       my $obj	= instance(shift, 'Foo');
		       # ...
	       }

	       use Data::Util qw(:check);

	       sub bar{
		       my $x = shift;
		       if(is_scalar_ref	$x){
			       # $x is an array	reference
		       }
		       # ...
		       elsif(is_instance $x, 'Foo'){
			       # $x is an instance of Foo
		       }
		       # ...
	       }

	       # miscelaneous
	       use Data::Util qw(:all);

	       my $x = anon_scalar();
	       $x = anon_scalar($x); # OK

	       my $stash = get_stash('Foo');

	       install_subroutine('Foo',
		       hello  => sub{ "Hello!\n" },
		       goodby => sub{ "Goodby!\n" },
	       );

	       print Foo::hello(); # Hello!

	       my($pkg,	$name) = get_code_info(\&Foo::hello); #	=> ('Foo', 'hello')
	       my $fqn	       = get_code_info(\&Foo::hello); #	=>  'Foo::Hello'
	       my $code	       = get_code_ref($fqn);	      #	=> \&Foo::hello

	       uninstall_subroutine('Foo', qw(hello goodby));

	       print neat("Hello!\n"); # => "Hello!\n"
	       print neat(3.14);       # => 3.14
	       print neat(undef);      # => undef

DESCRIPTION		  _
       aa(R)aca,aYa1/4a<<a aa1/4a?a"aa1/4a?aa(R)aaa(R)a|a1/4aaLaaaaLecae<degree>aaea3/4aa3/4aa

       a|a1/4aaLaaaaLa aa<section>aa ec_e<degree>c3/4xa"aexe"1/4ecae<degree>c3/4xa"aa(R)a>>a(R)ecae<degree>c3/4xaaaa3/4aa
       aa<section>aa ecae<degree>cxa	axa(R)aaea?a^1i1/4ca1/2axae?aae(C)e1/2aaea3/4aa3/4aa
       aexe"1/4ecae<degree>c3/4xa axa(R)aaea?a^1i1/4ca<section>aaa<degree>aa(R)axeaeo<<ae?ai1/4
       a1/2a<section>aaa<degree>e'a1/_ca"a(C)a1/4a"aaaae(C)e1/2aaea3/4aa3/4aa
       aa(R)a>>a(R)ecae<degree>c3/4xa i1/4c!aa^1a<<a(C)a1/4aaaa!a~a^3a^1a(R)caeaa.a^3aa<<aa1/4aa<<a(R)aea1/2i1/4
       a^3a1/4aaaaa!a~a^3aa(R)aea1/2aaa(C)a(R)ae(C)e1/2aaea3/4aa3/4aa
       aaaa|a1/4aaLaaaaLa aaaaa^3a1/4aa(R)c^1<degree>ae?aae?aaaaa<<e"-
       e"aaa3/4aaa
			  _
       aa(R)aca,aYa1/4a<<a XSa"Pure
       Perlaae^1a<section>a(R_eLaaa_aai1/4Ca^3a^3aaxa(C)a(R)aa		_
       c<degre_>aca<section>a XSaaa a"a^3aai1/4aaac<degree>aca<section>a Pure
       Perlaaa a"a^3aaa1/2?c"aaa3/4aa
       aaai1/4c<degree>acaxae<degree>"DATA_UTIL_PUREPERL"aca<<e"-
       a(R_aaaa"a<section>i1/4a1/4.a<paragraph>ca<<Pure	Perl
       aaa a"a^3aaa1/2?c"aaaa"aa<section>aa3/4aa
	    _	    _
       XSaaa a_a^3aa ae^3"aeae.+-aa(R)eLaaa|aai1/4 Pure
       Perlaaa a"a^3aaa2aaa10ac"ao|e<<ea<<aa1/2aa3/4aa		 _
       a(R)ei1/4XSaaa a"a^3aaaea3/4aaa>>a1/4a"a|a(R)ecae<degree>a i1/4c-
       a3/4!a(R)Pure Perla^3a1/4aa
       axa^3a(C)axa^3a<section>a+-eaaa^3a1/4aaaaae'a<<e<<ea<section>aa
							  _		    _
       aaLa^1aaaaaYa1/4a.a<section>a^3a(R)benchmark/aaLa~a aaaa<<aa^3aaa1/4a aaaa3/4aa

INTERFACE
   Check functions  _		       _								      _
       aa<section>aa ecae<degree>c3/4xa	":check"axa^3aa1/4aa?a<degree>a<<aaLa|a<degree>aYa<section>aa3/4aaaaaa aaax
       a(R)aac(R)ca(R)aa<section>aaa<degree>cai1/4aaa<section>aaaaa<degree>a1/2ae?aa3/4aa
				    _
       a3/4ai1/4aaaa(R)ecae<degree>a aaa1/4aa1/4a-
       a1/4aaa,aa aea?a^1a3/4aaaa"aa<_egree>i1/4"${}"a aaa1/4aa1/4a-
       a1/4aaaa|aaaaaa,a<section>a aa i1/4a^1a<<a(C)a1/4aaaa!a~a^3a^1a"aa|ae+-aaa3/4aa
				      _		       _		    _		       _       _
       aaaa!a~a^3a^1a(R)aaa<section>aa aaaecae<degree>a	i1/4aaaa,a<section>a aaaaa!a~a^3a^1a<<a	3/4aa|a	i1/4
       aaa_/4aa1/4aa1/4aaaa|aaaaeaa,,a<<a1/2ae?aa3/4aa
       aaa i1/4aaaa,a<section>a	aa(R)a(R)eLa<<a3/4a-
       aaa^3a1/4aaae,aaaaaaa<<aaaaa<section>aa

       is_scalar_ref(value)				      _
	   a^1a<<a(C)a1/4aaaa!a~a^3a^1aa(C)aaa(R)aa<section>aa ae!aa3/4aa

       is_array_ref(value)			  _
	   eaaaaa!a~a^3a^1aa(C)aaa(R)aa<section>aa ae!aa3/4aa

       is_hash_ref(value)			      _
	   aaa.aYaaaa!a~a^3a^1aa(C)aaa(R)aa<section>aa ae!aa3/4aa

       is_code_ref(value)				_
	   a^3a1/4aaaaa!a~a^3a^1aa(C)aaa(R)aa<section>aa ae!aa3/4aa

       is_glob_ref(value)				   _
	   a<degree>aaaaaa!a~a^3a^1aa(C)aaa(R)aa<section>aa ae!aa3/4aa

       is_regex_ref(value)
	   "qr//"a<<aaLa|a1/2aaaae-	     _
	   Le|e!"c3/4aa(C)aaa(R)aa<section>aa ae!aa3/4aa

       is_instance(value, class)			    _
	   classa(R)axa^3a^1a?a^3a^1aa(C)aaa(R)aa<section>aa ae!aa3/4aa

	   "Scalar::Util::blessed($value) &&
	   $value->isa($class)"a"aaa^3a1/4aa" a>>a1/4ca3/4!a<section>aa
				       _
	   classaaeaa(R)c3/4(C)axa3/4aa	aaaa!a~a^3a^1a<section>aaa<degree>e'a1/2ca"a(C)a1/4a"aaaa3/4aa

       is_invocant(v_lue)						       _
	   valuea<<a 3/4aa|a!a1/2aaae<micro>.aa<section>aaaa(C)aaaaa<section>aa	aa3/4aa

       is_value(value)				_
	   valueaaaaaaaLaaxaa(C)aaaaa<section>aa aa3/4aaaaaaa!i1/4a(R)c3/4(C)ae,a?a<section>aai1/4
	   aaaa!a~a^3a^1a<section>a aaai1/4aa<degree>a-
	   aa<section>aaaaaa<degree>cae?aa3/4aa
									    _
	   aa(R)ecae<degree>_(aaa^3"is_string"/_is_numb_r()"/"is_integer()")a i1/4
	   aaaa,a<section>a aaaaa!a~a^3a^1a<<a 3/4aa|a a,,a<<a1/2ae?aa3/4aa
	   aa"avalueaaeaaa/ae<de_ree>axa/ca1/2axaaaa1/4aa1/4aa1/4aa!a1/2aaa
	   aeaLa|aaa"aa|ai1/4aaa aaaaaaLaaxa"aa|a axaeaa3/4aaa
				_	      _
	   aa(R)ecae<degree>a<<a aexe"1/4ae!aa 3/4a?ecae<degree>aaaa3/4aaa

       is_string(value)
	   valueaaaaaaaLaaxa<section>aai1/4 aaxaeaaaaaa"aa<<1aea-
	   a>>Ya,a(R)aa(R)^1aaeaxaxaa(C)aaaaa<section>aa aa3/4aa

	   "do{	is_value($value) && length($value) > 0 }"a"aaa<section>aa
				_	      _
	   aa(R)ecae<degree>a<<a aexe"1/4ae!aa 3/4a?ecae<degree>aaaa3/4aaa

       is_number(value)				  _
	   valueaae<degree>axaa(C)aaaaaaa aa3/4aa
	   aaa<section>ae<degree>oaoxa"a i1/4ae<degree>axa^3a^3aa-
	   a^1a(aa"aa<degree>"sprintf '%g_, $value"i1/4	a<section>e-
	   |aaaoaaa<<ae<degree>axa<<axaea e1/2a<section>aai1/4 aaxPerlaa-
	   a<degree>a(C)a a,-
	   a<<aaaa(C)a<<a"aa|aaaa"aa<section>aaaxa"aaaea^3a<section>aa
				       _
	   aaaaa!i1/4aa(R)ec_e<degree>a	"Scalar::Util::looks_like_number()"a"c<degree>aaai1/4
	   "Infinity"a"NaN_a aaaa(C)a<<a"aa|aaa<degree>a(C)a a,-
	   a<<c1/2(R)aaa"a a<section>aaaaaai1/4
	   ae<degree>axa"aa|ae+-aa3/4aaaa3/4ai1/4ae<degree>axaaaa"aa<<e-
	   |aaaoaaaaa3/4axa<section>aa "0 but
	   true"aaacc+-a<section>ae<degree>axa"aa|ae+-aa3/4aaa
				_	      _
	   aa(R)ecae<degree>a<<a aexe"1/4ae!aa 3/4a?ecae<degree>aaaa3/4aaa

       is_integer(value)			   _	      _
	   valueaae'ae<degree>aa(C)aaaaa<sectio_>aa aa3/4aaaaa "is_number()"a(R)axa(R)a<<a aa|i1/4
	   ae'ae<degree>axaa(C)aaaaa<section>aa	aa3/4aa
				_	      _
	   aa(R)ecae<degree>a<<a aexe"1/4ae!aa 3/4a?ecae<degree>aaaa3/4aaa

   Validating functions	    _								   _		 _
       aexe"1/4ecae<degree>a ":validate"aa<degree>a<<aaLa|a<degree>aYa<section>aa3/4aaaaaa aa<section>aa ecae<degree>a"
       aaae^1ae^3a<section>aa<section>aa ae!aa3/4aa
       aa ai1/4aa(R)c<micro>aeaca<section>aaa<degree>c~~a,a1/4ae<degree>aaa(R)a3/4a3/4e?ai1/4
       a1/2a<section>aaa<degree>e'a1/2ca"a(C)a1/4a"aaaa3/4aa
						 _
       aaaa(R)ecae<degree>aaaa1/4aa1/4aa1/4aaa,aa aeae(R)aa3/4aa

       scalar_ref(value)
	   a^1a<<a(C)a1/4aaaa!a~a^3a^1aa(C)aaa(R)aexe"1/4ae!aa3/4aa

       array_ref(value)
	   eaaaaa!a~a^3a^1aa(C)aaa(R)aexe"1/4ae!aa3/4aa

       hash_ref(value)
	   aaa.aYaaaa!a~a^3a^1aa(C)aaa(R)aexe"1/4ae!aa3/4aa

       code_ref(value)
	   a^3a1/4aaaaa!a~a^3a^1aa(C)aaa(R)aexe"1/4ae!aa3/4aa

       glob_ref(value)
	   a<degree>aaaaaa!a~a^3a^1aa(C)aaa(R)aexe"1/4ae!aa3/4aa

       regex_ref(value)
	   "qr//"a<<aaLa|a1/2aaaaeLe|e!"c3/4aa(C)aaa(R)aexe"1/4ae!aa3/4aa

       instance(value, class)
	   classa(R)axa^3a^1a?a^3a^1aa(C)aaa(R)aexe"1/4ae!aa3/4aa
				       _
	   classaaeaa(R)c3/4(C)axa3/4aa	aaaa!a~a^3a^1a<section>aaa<degree>e'a1/2ca"a(C)a1/4a"aaaa3/4aa

       invocant(valu_)
	   valuea<<a 3/4aa|a!a1/2aaae<micro>.aa<section>aaaa(C)aaa(R)aexe"1/4ae!aa3/4aa
		  _				     _
	   valueaa a(C)a^1aa<section>aaa 'ai1/4aa(R)a a(C)a^1aaaeLe|aaaaea-
	   aae?aa3/4aa aaaaa!i1/4"::Foo"a"main::Foo"aa,aaa""Foo"ae?aa3/4aa

   Micellaneous	utilities
       aa(R)a>>i1/4aaYa<<axa^3aa1/4aa<section>aaaaaxaa(R)a|a1/4aaLaaaaLecae<degree>aaaa3/4aa

       anon_scalar()
	   "undef"aac<section>aaa?aa^1a<<a(C)a1/4aaaa!a~a^3a^1acaeaa3/4aa

       anon_scalar(value)
	   valuea(R)a^3aa1/4aac<section>aaa?aa^1a<<a(C)a1/4aaaa!a~a^3a^1acaeaa3/4aa
	      _
	   aaa "do{ my $tmp = $value; \$value; }"a"aaa^3a1/4aa"c-
	   a3/4!a<section>aa

       neat(value)
	   valueae!"cxoa<<e(C)aaaaae'a1/2caaaeaaae?aa3/4aa "do{
	   defined($value) ? qq{"$value"} : 'undef' }"ac1/2(R)aaeaaae(C)e1/2
	   a"aa|aea3/4aaa3/4aai1/4aae<<ae(C)e1/2a<section>aa

       get_stash(invocant)
	   invodanta(R)a^1a?aa.aY stashi1/4axa3/4aa.a^3aa<<aa1/4aa<<aaa.aYa a-
	   a"aaa<degree>i1/4aa(R)a^1a?aa.aYae?aa3/4aa
				    _								 _
	   invocantaaaaa,a<section>a aaaaa!a~a^3a^1a<section>aaa<degree>i1/4aa(R)aaaa,a<section>a aa(R)aaa+-a1/4a,a(R)
	   a^1a?aa.aYae?aa3/4aa

	   invocantaaaa+-a1/4a,aa<section>aai1/4aa(R)aaa+-a1/4a,aaeca<<a-
	   a"aaa<degree>i1/4 aa(R)aaa+-a1/4a,a(R)a^1a?aa.aYae?aa3/4aa

       install_subroutine(package, name	=> subr	[, ...])
	   a<micro>aa<<a1/4aa^3subrapackagea<<namea"aa|axa^3a^1aa1/4a<<aa3/4aa

	   "do{	no strict 'refs'; *{$package.'::'.$name} = \&subr;
	   }"a"aaa^3a1/4aa" a>>a1/4c-
	   a3/4!a<section>aaaaa<<i1/4subraa?aa<micro>aa<<a1/4aa^3a<section>aaa<degree>i1/4packagea<<
	   aaa>>aa<micro>aa<<a1/4aa^3_p_ckage::namea"aa|a1/2aaa3/4a(aa ai_/4Pure
	   Perlca(R)a^3a1/4aa<section>a	a?aa<micro>aa<<a1/4aa^3a(R)a1/2aa e!aa3/4aa)a
						       _
	   a<micro>aa<<a1/4aa_3aaaxa^3a^1aa1/4a<<aaa"aa	i1/4"no	warnings
	   'redefine'" aaLa~a aaLaaa1/2?aLa|aa aaa

		   no warnings 'redefine';
		   install_subrouitne($package,	$name => $subr);
					      _
	   packageanameaaeaa(R)c3/4(C)axa3/4aa aaaa!a~a^3a^1a<section>aaa<degree>e'a1/2ca"a(C)a1/4a"aaaa3/4aa
	   subraa^3a1/4aaaaa!a~a^_a_1a<section>aaaa"aae'a1/2ca"a(C)a1/4a"aaaa3/4aai1/4
	   aaa1/4aa1/4aa1/4aaa,aa a eae(R)aaa3/4aa
			     _
	   aa(R)ecae<degree>a "no strict		   _							_
	   'refs'"aa?e|a"aaaaaai1/4strict,c!oa^1oa~a(R)`e<I>aox`e~~ac aa+-eoae<section>aaaa3/4aaastrictc!a^1aa(R)eaxe~~a"a i1/4a>>Ya,a(R)aaaac<paragraph>ae^3aaeaa3/4aa

		   my $property	= ...;
		   # ...

		   no strict 'refs';
		   # simple read-only accessor
		   *{$pkg . '::' . $sub_name} =	sub{
			   my($self) = @_;
			   return $self->{$property};
		   }
	      _		       _
	   aaa aaaa,a<section>a	aa(R)aa-				      _		   _
	   aaaLaac<section>aaaca aa<_icro>acaeaaa^3a1/4aa<section>aaaa(R)aca a>>a<micro>a i1/4ae-
	   Laaa1/2?aeaa<se_tion>a ae!a aaa3/4aaa
	   aaai1/4aa(R)aca a>>a<micro>aa a(C)a^_a_a1/2aaa"aa|a1/4a^3aoaa"i1/4ae!ae!a"aaa3/4aa
	   axa3/4aaa(R)a"a$selfa<<aYaLa|aaa(R)a	a a(C)a^1ae!"aaea-
	   aa<section>aai1/4		    _	       _
	   "$self->_$property}"a"aaa^3a1/4aa a.a^3aaaaa	aaaa!a~a^3a^1a"e<section>Leaai1/4
	   aa(R)aca a>>a<micro>aa(R)c3/4(C)aaaaaa+-a1/4a,a(R)a<degree>a-
	   a1/_aa<<axae<degree>a"aa|aaaaa!a~a^3a^1aaa3/4aa
	   aaa axaa(_)a	'ai1/4aa<<"undef"ae?aa aa<sect_on>aaaa "<use strict
	   'refs'">a a3/4aa<<aa(R)aaaaeaxaLaa.a^3aaaaa aaaa!a~a^3a^1a(R)		    _
	   aaaaa!a~a^3a^1aaexaoaaaaa<<c"aeaaa|aaae(C)e1/2aaa(R)a<section>aai1/4aaa<section>a aa(R)ae(C)ae<micro>a
	   a3/4aaa"aa<section>aai1/4aaaa<degree>a(R)eLaaa^3a1/4aacaeaa|aa3/4aa3/4aa
									_
	   aa(R)a+-a1/4a^1a<section>stricta(R)ae(C)ae<micro>aa3/4aaaa<<a i1/4a>>Ya,a(R)aaa<<c!aecae<degree>aa<section>aao|
	   "use	strict"aaea^1a<<aaa?e|aaaa3/4aa

		   no strict 'refs';
		   *{$pkg . '::' . $sub_name} =	sub{
			   use strict 'refs';
			   my($self) = @_;
			   return $self->{$property};
		   }

	   aaa<section>i1/4"install_subroutine()"aa1/2?aa"a"strict"aa1/2?c"aaa?e|aaaaaaaa3/4aa

		   install_subroutine $pkg => (
			   $sub_name =>	sub{
				   my($self) = @_;
				   return $self->{$property};
			   },
		   );
					       _
	   aa(R)strictc!a^1aa(R)eaxe~~a<<axaa|a	i1/4"18.10" in
	   "Perlaa^1aaa(C)a aaLa_a_a_paragraph__c'_a(R)_c!_a^1_a -
	   _a_paragraph__c'_a3/4_a_a	_e-
	   |_a_a_c!_a^1_a___a_a_a '_a_a _i1/4ae_c_xo_c_a___i1/4ae(R)_micro__e_c_a___i1/4ae_a_c-
	   _a_a^1_a^3_a1/4_a_a_section__e!_a_a a<<e<section>Lea~aaaa3/4aa

       uninstall_subroutine(package, name [=> code], ...)
	   a<micro>aa<<a1/4aa^3nameaaaa+-a1/4a,packageaaaexaa3/4aa

	   "undef &subr"a&subraaeaa(R)c3/4(C)a<<aa|aa<degree>a-
	   aa(R)a^3a1/4aa^1aaaa	     _				       _
	   aa(R)a3/4a3/4a<<aaa(R)a<<a 3/4aa|i1/4"uninstall_subroutine"a	aa<degree>a-
	   aa a.a^3aa<<aa1/4aa<<aaaexai1/4a^3a1/4aa^1a-
	   aaaa>>Yaxaaxaa.a^3aa<<aa1/4aa<<a<< ae>>aa3/4aa
	   aa(R)aeaa "namespace::clean"a"constant::lexical"aa(R)c3/4aaaaa(R)aa(R)a<section>aa
		   _			     _
	   namea<<a 3/4aa|codeaa,aaaa|aaa 'aa i1/4&package::nameacod_a<section>aa
	   a 'aa(R)a?aexaa3/4aaaaaaa!i1/4a>>Ya,a(R)aoaxa(R)a^3a1/4aa c-
	   a3/4!a<section>aa

		   uninstall_subroutine($pkg, $name) if	\&{$pkg	. '::' . $name}	== $code;
		   uninstall_subroutine($pkg, $name => $code);
			     _
	   aa(R)ecae<degree>a "Sub::Delete::delete_sub()"a"aaaca<<a'aaaoa a<<aoaYaa|aa3/4aai1/4
	   exae<degree>a(R)a<micro>aa<<a1/4aa^3aa,ao|a<<aexa<section>aa3/4aa

       get_code_info(subr)
	   a<m_cro>aa<<a1/4aa^3subra(R)aaa+-a1/4a,a"aaa(R)aacae?aa3/4aa
	   aaa "Sub::Identify::get_code_info()"a"a>>a1/4aaae(C)e1/2a<section>aa
	   aa ai1/4a^1a<<a_C)a1/4a^3a^3aa-
	   a^1aa<section>a a(R)a"a?(R)eL3/4aae?aa3/4aa
				_
	   subra(R)aaaa,aeaaa"aa i1/4aaa^1aa^3a^3aa-
	   a^1aa<section>a_c(C)oaaa^1aai1/4 a^1a<<a(C)a1/4a^3a^3aa-
	   a^1aa<section>a "undef"ae?aa3/4aa

       get_code_ref(package, name)			     _
	   \_package::nameaaa"aaa<degree>i1/4aaae?aa3/4aa aaa "do{ no strict
	   'refs'; *{$package .	'::' . $name}{CODE} }"
	   a<<a1/41/4a|aa3/4aai1/4\_package::nameaaa"aaaaa 'aa<section>a
	   *package::nameacaeaa3/4aaa

	   c~~a,a1/4ae<degree>a"aa|"-create"aa,aaa_i1/4\_package::nameaa-
	   a"aaaaa|a a^1a?aacaeaa|aaae?aa3/4aa aaa "do{	no strict 'refs';
	   \&{$package . '::' .	$name} }"a"aaa<section>aa

       curry(subr, args	and/or placeholders)
	   a<micro>aa<<a1/4aa^3subra(R)a<<aaa1/4aae!aaaa
	   axa3/4ac^1a(R)a(R)a1/4ae<degree>aaoa(R)aaa aa1/4a,aLacaeaa3/4aa

	   args	and/or	   _
	   placeholdersa<<a i1/4aoa(R)aaa1/4ae<degree>ai1/4a<<aaa1/4aa<_icro>aa<<a1/4aa^3a(R)a1/4ae<degree>a<<
	   c1/2(R)aaeaaaaaa~a1/4a^1aa<<aaae,!aa3/4aaaa~a1/4a^1aa<<aa<<a	i1/4ae.>>aa-
	   xaac<section>
	   aa"\x"a"i1/4"\x"a<section>ac<section>aaaeax<section>a(R)ae.>>aa-
	   a(R)a>>Yea(R)a1/4ae<degree>aaa^1aaac<section>aa *_aaaa3/4aa
							 _
	   aa"aa<degree>i1/4a>>Ya,a(R)$closurea"$currieda aaae(C)e1/2aaeaxa<micro>aa<<a1/4aa^3a"aaaa3/4aa

		   my $class = 'Foo';
		   $closure = sub{ is_instance($_[0], $class) };
		   $curried = curry \&is_instance, \0, $class;

		   $closure = sub{ install_subroutine($class, @_) };
		   $curried = curry \&install_subroutine, $class, *_;
		     _								     _
	   aaai1/4*_a "\x"a<section>ac<section>aaaaaLaa1/4ae<degree>aaa^1aa<section>a aaaa(R)a<section>ae^3"aeaa|aa aaa
	   aa"aa<degree>i1/4"curry(\&su_r, *_, \1)->(0,	1, 2,
	   3)"a"aaa<<aaa1/4aa<section>a	i1/4 "subr(2, 3,
	   1)"aa1/4a^3aoaai1/4a<<aaa1/4aaaaa<micro>aa<<a1/4aa^3a<<a,aaaa
	   $_[0](axa3/4a0)ac!e|aaa3/4aa
		      _	_
	   a<<aaa1/4aa a aa1/4a,aLaaacaea>>a1/4a^3aoaae<<ea<section>aa

	   aae(C)^3aaa<micro>a^3aa<<a^3a1/4aaData::Util::Currya<<aaa3/4aa

       modify_subroutine(subr, modifier_type =>	[subroutines], ...)
	   a<micro>aa<<a1/4aa^3subramodifier_typea<<aaaaLa|subroutinesa<section>a?(R)eL3/4ai1/4
	   c!aecae<degree>modified_subra"aa|e?aa3/4aa
			    _						_
	   modifier_typea<<a "before", "aroun_", "after"aaai1/4"before"a
	   subra(R)a1/4a^3aoaaa<<i1/4"after"a subra(R)a1/4aoaa3/4a<<i1/4modified_subra<<_
	   a,aaaaa1/_ae<degree>a<section>a1/4a^3aoaaa3/4aa"before"a""after"a(R)ae>>aaxa	ae"a|aaa3/4aa
	   "around"a subra(R)aYaoaaaaLa<<a?aaa^3a<degree>aaaaa(R)a?(R)eL3/4a-
	   a<section>aa
				 _			 _
	   aa(R)ei1/4a1/4a^3aoe	a i1/4"before"a""a_ound"a a3/4a<section>a(R)c3/4(C)aaaaa(R)aaa<<a1/4a^3aoaa				      _
	   (last-defined-first-called)i1/4"after"a aa<<a(R)c3/4(C)aaaaa(R)aaa<<a1/4a^3aoaaa3/4a(first-defined-first-called)aaa(R)a1/4a^3aoae a "subroutine_modifier()"a<section>aaa
	   a<section>aa

	   aa"aa<degree>i1/4

		   $modified = modify_subroutine(\&foo,	around => [sub{
			   my $next = shift;
			   do_something();
			   goto	&{$next}; # continuation
		   }]);
		   $modified->();

		   $modified = modify_subroutine(\&foo,
			   before => \@befores,
			   around => \@arounds,
			   after  => \@afters,
		   );
		   $modified->();
				   _
	   XSa<<aaa(R)eLa<section>a i1/4a<micro>aa<<a1/4aa^3a?(R)eL3/4a-
	   a(R)a^3a^1aaea,,a<<a(R)aaaaLa|aa3/4aa

	   aa(R)aaLa^1aaaaaYa1/4a.a<section>a^3a<<a>>a+-aa|aaexample/lib/Method/_odifiers.pm
	   ("modify_subroutine()"/"subroutine_modifier()"a(R)aac)a(R)aa^3aaa1/4a     _
	   benchmark/methext_bench.pla<<aaa<degree>i1/4a!a1/2aaa?(R)eL3/4a(R)a^3a^1aa a>>a1/4ae~!a(R)aaa<<aaaa3/4ai1/4

		   with	before modifier: 100% slower
		   with	after  modifier: 100% slower
		   with	around modifier: 200% slower
				       _		  _
	   c^1a<<i1/4"before"a""after"a	"SUPER::"ca1/41/4a a(C)a^1a<<aaLa|a!a1/2aaaae!a1/4<micro>aaaaae<<ea<section>aa
				_
	   aa?(R)eL3/4aa<<axaa|a i1/4"Method Modifiers"	in
	   Class::MOP::Classa<<
	   e(C)^3aae<section>Lea~aaaa3/4aa_lass::Method::Modifiersa<<ae<section>Lea~aaaa3/4aa
	   aa(R)aca,aYa1_4a<<aaea3/4aaAPIa aaaa(R)aca,aYa1/4a<<aaa1/2ae<degree>'aeoa<section>aai1/4
	   ae(C)e1/2a<<a aoaeae<section>aaaa3/4aa

       subroutine_modifier(modified, modifier_type => subroutines, ...)
	   "modify_subroutine()"a<section>caeaamodifiedaaea1/2aa3/4aa
						   _
	   a1/4ae<degree>amodifieda(R)a?ae,!aaa	'aa i1/4aa(R)modifieda"modify_subroutine()"a<section>
	   caeaaaaa(R)aa(C)aaacxoaca1/2axae?aa3/4aa

		   if(subroutine_mo_ifier $subr){
			   # $subra a?(R)eL3/4aaxaa<micro>aa<<a1/4aa^3
		   }

	   modifieda"modifier_type("before", "around", "after")
	   aae,!aa"i1/4aa(R)modifier_typea<<a?aaa?(R)eL3/4ecae<degree>ae?aa3/4aa

		   @befores = subroutine_modifier $modified, 'before';
								   _
	   aa(R)a>>ai1/4ae'a<<ecae<degree>a(R)aaa^1aaae,!aaa 'aa<<a i1/4modifieda(R)modifier_typea<<
	   aa(R)ecae<degree>ae?1/2a aa3/4aa

		   subroutine_modifier $modified, before => @befores;

       mkopt(input, moniker, require_unique, must_be)
	   inputaaa<<aaa"axa(R)aaceaaaaaaeaaaaa!a~a^3a^1aa1/2aeaa3/4aa
	      _									_
	   aaa "Data::OptList::mkopt()"a<<a1/41/4a|aa3/4aaaaa<<a aa|i1/4must_bea
	   aaa"aa(R)aacaaaaaaaa.aYaaaa!a~a^3a^1a<section>aaa3/4aa3/4aaa

	   For example:

		   $array_ref =	mkopt([qw(foo bar), baz	=> [42]], 'moniker');
		   # $array_ref	== [ [foo => undef], [bar => undef], baz => [42] ]

       mkopt_hash(input, moniker, must_be)
	   inputaaa<<aaa.aYaaaa!a~a^3a^1aa1/2aeaa3/4aa
	      _									     _
	   aaa "Data::OptList::mkopt_hash()"a<<a1/41/4a|aa3/4aaaaa<<a aa|i1/4must_bea
	   aaa"aa(R)aacaaaaaaaa.aYaaaa!a~a^3a^1a<section>aaa3/4aa3/4aaa

	   For example:

		   $hash_ref = mkopt([qw(foo bar), baz => [42]], 'moniker');
		   # $hash_ref == { foo	=> undef, bar => undef,	baz => [42] }

   Error handling					       _
       aexe"1/4ecae<degree>a<<aaLa|ae3/4aoaaae'a1/2ca"a(C)a1/4a	i1/4"Data::Util::Error"aca,aYa1/4a<<a<<aaLa|axae'aaaa"aa<section>aa3/4aa

	       package Foo;
	       use Data::Util::Error sub{ Foo::InvalidArgument->throw(@_) };
	       use Data::Util qw(:validate);

	       # ...
				_	      _
       aa(R)a"a(C)a1/4aa^3aa(C)a aaa+-a1/4a,ae a<<e"-			     _
       a(R)aai1/4aa(R)aaa+-a1/4a,aa<section>"Data::Util"acocaaaa"a(C)a1/4a<<a aa(R)a"a(C)a1/4aa^3aa(C)aa1/2?aaa3/4aa

DISCUSSIONS
What is	a X-reference?	      _					       _
       aXa(R)aaaa!a~a^3a^1aa"a a1/2aaeaa(R)a<section>aaaaaaaa<section>a	aaa.aYaaaa!a~a^3a^1aa3/4a<<a"aLa|eaa3/4aa
       a3/4ai1/4axaee|c' a a>>Ya,a(R)3axaae^3a(R)aa3/4aa

       1.  "ref($x) eq 'HASH'"

       2.  "Scalar::Util::reftype($x) eq 'HASH'"

       3.  "overload::Method($x, '%{}')"
	       _					_							    _
       "ref()"a	eaa<<e<<eaaa(R)a<section>i1/4a(R)c"a,a aaa<section>aoe<paragraph>^3aaaa"aaxaa"aeaaa3/4aaaaai1/4aaa aaa1/4aa1/4a-
       a1/4aaa,aa aeae(R)aa3/4aaa
					_			     _					   _
       "reftype()"aa1/2?aa^1aa<section>a aaa3/4aaa$xaaaaa,a<section>a aa<section>aaa 'ai1/4aaaa,a<section>a aa(R)a(R)eLaaac<section>ai1/4a<<aa>>a<<aaaLaa|aa3/4aaa"a<<aaaaaa<section>aa
					 _		      _
       aaa|"overload::Method"aaeaeaaa(R)a i1/4aaaa,a<section>a aaaaaa(R)aaaa!a~a^3a^1a"a?aaaa|aac^1ae(R)aaa+-a1/4a^1a<section>aa
										 _			 _
       aaai1/4c'aeY$xaaaa.aYaaaa!a~a^3a^1a"a?aaaa|ac<section>aaaa"("$x->{$key}")a eaaaaa<section>aaaaa $xaaaa.aYaaaa_a~a^3a^1a<sect_on>aaaa 'aa<<ae-_
       Laae'a1/2ca"a(C)a1/4acocaaa3/4aai1/4aa~a^1aaaaaa.aYaaaa!a~a^3a^1a(R)a"aa<<a aca a>>a^1aaeaaa3/4aaaaai1/4aa(R)aca	a>>a^1a(R)aeaa aaaa,a<section>a	aa(R)a(R)eLa<<a3/4a-
       aa|aa3/4aa
			   _		    _
       aa|i1/4aaaa "is_hash_ref()"a a1/2aea?a^1aa<degree>aaa(R)a<section>aaaaaac-
       a(R)a,axa "Params::Util"acxoaa|aa3/4aaVersi_n			     _			    _					      _
       0.35a(R)aeca<section>a	i1/4"P::U::_HASH"a (1)ai1/4"P::U::_HASH_IKE"a (2)a"(3)aaaaa aa3/4aaaaaaa<<e?<degree>a^1aaaa<_<i1/4(1)a e<<ea<section>aaaaa1/4aa1/4a-	 _			    _
       a1/4aaa,aa aeae(R)aaaaa(R)a<section>a,a(R)a"a<section>aai1/4(2)a	aaaa,a<section>a aa(R)a<<aa>>a<<aaaLaaaa1/2?aa^1aa<section>a aaa3/4aaaaa(R)aaa<<eaaa"i1/4"is_hash_ref()"a (1)a"(3)a<<aaaa<section>aa ae!aa(R)aae-
       Laaa(R)eLa"aaaa"a<<aaaa3/4aa
					    _
       aaaaLa|i1/4"is_hash_ref()"a<section>a "ref()"a""overload::Method()"aa1/2?aLa|aaaa!a~a^3a^1a(R)aaea?a^1a3/4aa"is_scalar_ref()"i1/4"is_array_ref()"i1/4"is_code_ref()"i1/4"is_glob_ref()"aaae<section>a<section>aa

ENVIRONMENT VARIABLES
   DATA_UTIL_PUREPERL				  _
       ca<section>aaa<degree>i1/4Pure Perlca(R)aaa a"a^3aaa1/2?aaa3/4aa

DEPENDENCIES
       Perl 5.8.1 or later.

BUGS AND LIMITATIONS
       No bugs have been reported.

       Please report any bugs or feature requests to the author.

SEE ALSO
       overload.

       Scalar::Util.

       Class::MOP.
						_
       aa(R)aca,aYa1/4a<<a(R)aaaxaa(R)ae(C)e1/2a_a>>Ya,a(R)aca,aYa1/4a<<a(R)ae(C)e1/2aXSa<<c<section>>>aexaa|
       aee(C)aaaaa(R)a<section>aai1/4a3/4aaaaxaa aaa<<a	aa|ae'a<<ae!a1/4<micro>aae1/2aaaa(R)a<section>aa

       Params::Util.

       Sub::Install.

       Sub::Identify.

       Sub::Delete.

       Sub::Curry.

       Class::Method::Modifiers.

       Data::OptList.

AUTHOR
       Goro Fuji (gfx) <gfuji(at)cpan.org>

LICENSE	AND COPYRIGHT
       Copyright (c) 2008-2009,	Goro Fuji (gfx)	<gfuji(at)cpan.org>. Some
       rights reserved.

       This module is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

perl v5.32.1			  2014-03-05		     Data::Util::JA(3)

NAME | VERSION | SYNOPSIS | INTERFACE | DISCUSSIONS | ENVIRONMENT VARIABLES | DEPENDENCIES | BUGS AND LIMITATIONS | SEE ALSO | AUTHOR | LICENSE AND COPYRIGHT

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Data::Util::JA&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help