P5__FILE__

Raku port of Perl's __FILE__ and associated functionality

NAME

Raku port of Perl's FILE and associated functionality

SYNOPSIS

use P5__FILE__;  # exports __FILE__, __LINE__, __PACKAGE__, __SUB__

DESCRIPTION

This module tries to mimic the behaviour of Perl's __FILE__, __LINE__, __PACKAGE__ and __SUB__ functionality as closely as possible in Raku.

TERMS

PACKAGE

A special token that returns the name of the package in which it occurs.

Raku

$?PACKAGE.^name

Because $?PACKAGE gives you the actual Package object (which can be used for introspection), you need to call the .^name method to get a string with the name of the package.

FILE

A special token that returns the name of the file in which it occurs.

Raku

$?FILE

LINE

A special token that compiles to the current line number.

Raku

$?LINE

SUB

A special token that returns a reference to the current subroutine, or "undef" outside of a subroutine.

Raku

&?ROUTINE

Because &?ROUTINE gives you the actual Routine object (which can be used for introspection), you need to call the .name method to get a string with the name of the subroutine.

AUTHOR

Elizabeth Mattijsen [email protected]

Source can be located at: https://github.com/lizmat/P5__FILE__ . Comments and Pull Requests are welcome.

COPYRIGHT AND LICENSE

Copyright 2018, 2019, 2020, 2021 Elizabeth Mattijsen

Re-imagined from Perl as part of the CPAN Butterfly Plan.

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

P5__FILE__ v0.0.6

Raku port of Perl's __FILE__ and associated functionality

Authors

  • Elizabeth Mattijsen

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • P5__FILE__

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.