Sub::Defer man page on MacOSX

Man page or keyword search:  
man Server   23457 pages
apropos Keyword Search (all sections)
Output format
MacOSX logo
[printable version]

Sub::Defer(3)	      User Contributed Perl Documentation	 Sub::Defer(3)

NAME
       Sub::Defer - defer generation of subroutines until they are first
       called

SYNOPSIS
	use Sub::Defer;

	my $deferred = defer_sub 'Logger::time_since_first_log' => sub {
	   my $t = time;
	   sub { time - $t };
	};

	 Logger->time_since_first_log; # returns 0 and replaces itself
	 Logger->time_since_first_log; # returns time - $t

DESCRIPTION
       These subroutines provide the user with a convenient way to defer
       creation of subroutines and methods until they are first called.

SUBROUTINES
   defer_sub
	my $coderef = defer_sub $name => sub { ... };

       This subroutine returns a coderef that encapsulates the provided sub -
       when it is first called, the provided sub is called and is -itself-
       expected to return a subroutine which will be goto'ed to on subsequent
       calls.

       If a name is provided, this also installs the sub as that name - and
       when the subroutine is undeferred will re-install the final version for
       speed.

   undefer_sub
	my $coderef = undefer_sub \&Foo::name;

       If the passed coderef has been deferred this will "undefer" it.	If the
       passed coderef has not been deferred, this will just return it.

       If this is confusing, take a look at the example in the "SYNOPSIS".

perl v5.16.2			  2012-07-04			 Sub::Defer(3)
[top]

List of man pages available for MacOSX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net