GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Sub::Current(3) User Contributed Perl Documentation Sub::Current(3)

Sub::Current - Get the current subroutine

    use Sub::Current;
    sub f {
        # ...
        if ($some_condition) {
            # let's recurse!
            ROUTINE->();
        }
        # ...
    }

Sub::Current makes available a function "ROUTINE()", that returns a code reference pointing at the currently executing subroutine.

In a special block (BEGIN, END, CHECK, INIT, and UNITCHECK in Perl 5.10) this function will return undef.

Outside of a special block (that is, at the top level of a program) "ROUTINE()" will return undef as well.

Note: on perl 5.16.0 and later you can use the built-in "__SUB__" instead, enabled by the pragma "use feature 'current_sub'".

A repository for the sources is at <https://github.com/rgs/p5-Sub-Current>.

(c) Copyright 2007, 2017 by Rafael Garcia-Suarez.

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

2017-01-30 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.