```{index} single: B::CV ``` # B::CV ```{pperl-module-badges} B::CV ``` ## Functions ### B::CV methods #### [`GV`](CV/GV) Return the `B::GV` that a named CV belongs to. #### `STASH` Return the `B::HV` for the package the CV was compiled in. #### `FILE` Return the source filename the CV was compiled from. **Synopsis** ```perl print $cv->FILE; # e.g. "MyModule.pm" ``` Returns an empty string for XSUBs that do not carry a file record. #### `ROOT` Return the root op of the CV's optree, or `B::NULL` for an XSUB. **Synopsis** ```perl my $root = $cv->ROOT; ``` XSUBs carry compiled C code and have no optree, so `ROOT` returns a `B::NULL`. Test with `$cv->CvFLAGS & B::CVf_ISXSUB` first if it matters. #### `XSUB` Return the CV's C function pointer as an integer, or `0` for a Perl sub. **Synopsis** ```perl my $addr = $cv->XSUB; # non-zero iff the sub is an XSUB ``` #### `XSUBANY` Return `CvXSUBANY` - per-XSUB private data. **Synopsis** ```perl my $any = $cv->XSUBANY; # any_iv; 0 for Perl subs my $sv = $const_cv->XSUBANY; # B object of the constant for CvCONST subs ``` #### `START` Return the first op executed in the CV's body, or `B::NULL` for an XSUB. #### `DEPTH` Return the current recursion depth of the sub. #### `CvFLAGS` Return the raw `CvFLAGS` word of the CV. #### [`NAME_HEK`](CV/NAME_HEK) Return the CV's name when it was stored as a HEK rather than via a GV. #### `OUTSIDE` Return the lexically enclosing CV (`CvOUTSIDE`). #### `PADLIST` Return the CV's padlist as a `B::PADLIST`, or `B::NULL` for an XSUB. #### `OUTSIDE_SEQ` Return the COP sequence number at which the CV was closed over. #### `CONST` Return `CVf_CONST` if the CV is a constant (inlinable) sub, else 0. #### `HSCXT` Return the XS handshake context pointer as an integer, or `0` for a Perl sub. #### `const_sv` Return the SV a constant sub yields, as a B:: object (`const_sv`). ```{toctree} :hidden: :maxdepth: 1 CV/GV CV/NAME_HEK ```