---
name: "Sub::Current"
section: "3pm"
platform: "linux"
package: "libsub-current-perl"
version: "0.02-2+b3"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/Sub::Current"
---

# Sub::Current(3pm)

Get the current subroutine

## NAME

Sub::Current - Get the current subroutine

## SYNOPSIS

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

## DESCRIPTION

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.

## COPYRIGHT

(c) Copyright 2007 by Rafael Garcia-Suarez.

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