Sponsored Content
The Lounge What is on Your Mind? Please Welcome Yoda (Bipin Ajith) to the Moderation Team Post 303038576 by RavinderSingh13 on Friday 6th of September 2019 12:20:32 PM
Old 09-06-2019
Thanks a TON Neo for doing so Smilie

Welcome Yoda(one of my inspirations in scripting) to the MODs group Smilie

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
 

3 More Discussions You Might Find Interesting

1. What is on Your Mind?

Please Welcome Ravinder Singh to the Moderation Team

On this special Happy News Year day, 1 January 2019, I am pleased to promote Ravinder Singh to UNIX.COM Moderator, for at least the following reasons: Ravinder Loves UNIX.COM Ravinder has 1,372 Thanks, which puts him in the Top Ten in that important single category. Ravinder is one of... (8 Replies)
Discussion started by: Neo
8 Replies

2. What is on Your Mind?

Please Welcome Peasant to the Moderation Team

Dear All, Following our new policy for future forum moderators to have active LinkedIn profiles (and increase mod team diversity), please join me in congratulating our new addition to our mod team, Peasant: Peasant (Filip Skoblar) on LinkedIn Peasant is also an active moderator on our... (10 Replies)
Discussion started by: Neo
10 Replies

3. What is on Your Mind?

Please Welcome Akshay Hegde to the Moderation Team

Dear All, Following our policy for forum moderators to have active LinkedIn profiles (and also to increase mod team diversity), please join me in congratulating the newest addition to our mod team, Akshay Hegde: Akshay Hegde on LinkedIn Akshay has been very helpful to the site over the... (3 Replies)
Discussion started by: Neo
3 Replies
Filter::EOF(3pm)					User Contributed Perl Documentation					  Filter::EOF(3pm)

NAME
Filter::EOF - Run a callback after a file has been compiled VERSION
0.04 SYNOPSIS
package MyPackage; use warnings; use strict; use Filter::EOF; sub import { my ($class, @args) = @_; my $caller = scalar caller; # set the COMPILE_TIME package var to a false value # when the file was compiled Filter::EOF->on_eof_call(sub { no strict 'refs'; ${ $caller . '::COMPILE_TIME' } = 0; }); # set the COMPILE_TIME package var to a true value when # we start compiling it. { no strict 'refs'; ${ $caller . '::COMPILE_TIME' } = 1; } } 1; ... package MyUsingPackage; use warnings; use strict; our $COMPILE_TIME; use MyPackage; # prints 'yes' BEGIN { print +( $COMPILE_TIME ? 'yes' : 'no' ), " " } # prints 'no' print +( $COMPILE_TIME ? 'yes' : 'no' ), " "; 1; DESCRIPTION
This module utilises Perl's source filters to provide you with a mechanism to run some code after a file using your module has been pro- cessed. METHODS
"import( @functions )" Currently, only a function equivalent of the "on_eof_call" method is provided for export. use Filter::EOF qw( on_eof_call ); sub import { my ($class) = @_; ... on_eof_call { ... }; } ... "on_eof_call( $code_ref )" Call this method in your own "import" method to register a code reference that should be called when the file "use"ing yours was compiled. The code reference will get a scalar reference as first argument to an empty string. if you change this string to something else, it will be appended at the end of the source. # call C<some_function()> after runtime. Filter->on_eof_call(sub { my $append = shift; $$append .= '; some_function(); 1;'; }); EXPORTS
on_eof_call You can optionally import the "on_eof_call" function into your namespace. EXAMPLES
You can find the example mentioned in "SYNOPSIS" in the distribution directory "examples/synopsis/". SEE ALSO
Filter::Call::Util, "Exporting without using Exporter's import method" in Exporter AUTHOR AND COPYRIGHT
Robert 'phaylon' Sedlacek - "<rs@474.at>". Many thanks to Matt S Trout for the idea and inspirations on this module. LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as perl itself. perl v5.8.8 2008-03-08 Filter::EOF(3pm)
All times are GMT -4. The time now is 11:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy