Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sub::defer(3) [mojave man page]

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". undefer_all undefer_all(); This will undefer all defered subs in one go. This can be very useful in a forking environment where child processes would each have to undefer the same subs. By calling this just before you start forking children you can undefer all currently deferred subs in the parent so that the children do not have to do it. SUPPORT
See Moo for support and contact information. AUTHORS
See Moo for authors. COPYRIGHT AND LICENSE
See Moo for the copyright and license. perl v5.18.2 2013-12-31 Sub::Defer(3)

Check Out this Related Man Page

Mason::Plugin::Defer(3pm)				User Contributed Perl Documentation				 Mason::Plugin::Defer(3pm)

NAME
Mason::Plugin::Defer - Defer computing parts of output until the end of the request SYNOPSIS
<head> <title><% $m->defer(sub { $m->page->title }) %></title> % $.Defer {{ % my $content = join(", ", @{ $m->page->meta_content }); <meta name="description" content="<% $content %>"> % }} <body> ... DESCRIPTION
The defer feature allows sections of output to be deferred til the end of the request. You can set up multiple deferred code blocks which will execute and insert themselves into the output stream at request end. REQUEST METHOD
defer (code) Returns a marker string that is unique and will not appear in normal output. At the end of the request, each marker string is replaced with the output of its associated code. e.g. <title><% $m->defer(sub { $m->page->title }) %></title> FILTER
Defer Applies "$m->defer" to the content block. e.g. % $.Defer {{ % my $content = join(", ", @{ $m->page->meta_content }); <meta name="description" content="<% $content %>"> % }} SEE ALSO
Mason AUTHOR
Jonathan Swartz <swartz@pobox.com> COPYRIGHT AND LICENSE
This software is copyright (c) 2011 by Jonathan Swartz. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-05-02 Mason::Plugin::Defer(3pm)
Man Page

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

User of the file OR Logger of the file. ?

How could I get the name of user of a file in a file path ? OR Who i accessing the particular file in a file path ? Any Idea ?? Please help !! Thanks :) (1 Reply)
Discussion started by: varungupta
1 Replies

2. UNIX for Dummies Questions & Answers

Testing the forking process.

Hey, first time poster and a new UNIX user here. My question is regarding the forking process. I logged in to tty1, and typed the command ls -1 and hit enter. How can i tell that the ls -1 command ran in a subshell? Thanks. (0 Replies)
Discussion started by: Vitamin254
0 Replies

3. Shell Programming and Scripting

Forking with Tclsh vs Wish

Hello, I am new to this site, so sorry ahead of time if this is not the right place for this question.......anywhooooo I am having troubles with forking new processes in wish. Take the following code example: **************************** package require Tclx puts "TCL VER: " proc... (3 Replies)
Discussion started by: pghamami
3 Replies

4. Programming

perl: Subroutine question

Hi everyone, I have given up finally trying to find a way to do this. I have a subroutine called LoginFirst where I am starting a new SSH session. I have bunch of subroutines, each one of them uses a (or I have to create a new SSH constructor everytime) ssh connection to get some value so ... (2 Replies)
Discussion started by: dummy_code
2 Replies

5. Programming

need help in forking

I have an input file with contents like: 5785690|68690|898809 7960789|89709|789789 7669900|87865|659708 7869098|65769|347658 so on.. I need to pass this file to 10 parallely running processes (forking)so that each line is processed by a process and no line is processed twice and write the... (1 Reply)
Discussion started by: rkrish
1 Replies

6. Shell Programming and Scripting

Help with automating a bash script

Hi Guys, There are some emails going deferred as we got some new IP's from our ISP. So I was trying to manually copy the deferred mail and forward it to our sales team so that they can contact our client. I am new to this script thing, but luckily I was able to write the code to extract the data... (1 Reply)
Discussion started by: linuxrulz
1 Replies