```{index} single: meta::package (pragma) ``` # meta::package ```{pperl-module-badges} meta::package ``` ## Functions ### Packages #### `get` `meta::package->get($name)`: the package `$name`, created if it does not exist. Called on an object, it croaks. #### `is_class` `$metapkg->is_class`: whether the package is a `class`. #### `name` `$metapkg->name`: the package's name. #### `list_subpackages` `$metapkg->list_subpackages`: name and package pairs of the package's subpackages. ### Globs #### `can_glob` `$metapkg->get_glob($name)`, `->try_get_glob($name)`: the package's glob `$name`; if there is none, `get_glob` croaks and `try_get_glob` returns undef. `can_glob` is a deprecated spelling of `try_get_glob`. Also available as `meta::package::get_glob`, `meta::package::try_get_glob`. #### `list_all_globs` `$metapkg->list_globs`, `->list_all_globs`, `->list_subpackage_globs`: the package's globs - those of its own names, all of them, or those of its subpackages. Also available as `meta::package::list_globs`, `meta::package::list_subpackage_globs`. ### Symbols #### `can_symbol` `$metapkg->get_symbol($name)`, `->try_get_symbol($name)`, `->get_or_add_symbol($name, $ref)`, `->add_symbol($name, $ref)`: the package's symbol `$name`, sigil first (`'$x'`, `'@x'`, `'%x'`, `'&x'`, `'*x'`). `get_symbol` croaks when it is missing, `try_get_symbol` returns undef, `get_or_add_symbol` creates it (from `$ref`, or empty), `add_symbol` creates it and croaks if it exists. `can_symbol` is a deprecated spelling of `try_get_symbol`. Also available as `meta::package::get_symbol`, `meta::package::try_get_symbol`, `meta::package::get_or_add_symbol`, `meta::package::add_symbol`. #### `remove_symbol` `$metapkg->remove_symbol($name)`: remove the package's symbol `$name` (sigil first); a missing one croaks. ### Subroutines #### `add_named_sub` `$metapkg->add_named_sub($name, $code)`: install `$code` as the package's sub `$name` and name it so; a sub already there croaks.