Export...:Specs(3pm)

πŸ“¦
version 0.114 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

ok so bestie, this is Exporter::Declare::Specs β€” the import argument parser for Exporter::Declare. it's a Perl manual page, section 3pm, and it's literally the lil genius that reads your use line and figures out what you actually meant πŸŽ€


✨ DESCRIPTION ✨

ngl, import arguments can get messy. here's the tea: every single argument is assumed to be an export unless it's got a - or a : prefix in front of it. and that prefix? it could mean a tag, a boolean option, or an option that takes the next argument as its value. oh and also β€” almost all of these can be negated with the ! prefix. iconic behavior fr πŸ’…

this class's whole job is parsing the import arguments and generating the data structures that let the exporter find out what it needs to know. it's giving backstage crew energy πŸ¦‹


🌸 METHODS 🌸

  • $class->new( $package, @args ) β€” make a brand new instance and parse @args. yes that's it, that's the vibe ✨
  • $specs->package() β€” get the name of the package that's supposed to be doing the exporting. like, who's the main character here πŸ‘‘
  • $hashref = $specs->config() β€” get the configuration hash. all the specified options and tags are the keys πŸ”‘ the value is true/false/undef for tags and boolean options. for options that take arguments, the value is that argument. and when a config hash gets provided to a tag, that hash is the value. periodt πŸ’œ
  • @names = $specs->arguments()
  • @names = $specs->options()
  • @names = $specs->tags() β€” get the argument, option, or tag names that were specified for the import. three lil methods, one shared mission 🫢
  • $hashref = $specs->argument_info() β€” get the arguments that were specified for the import. the key is the name of the argument, and the value is whatever the user supplied during import 🌈
  • $hashref = $specs->option_info() β€” get the options that were specified for the import. the key is the name of the user supplied option, and the value will evaluate to true βœ…
  • $hashref = $specs->tag_info() β€” get the values associated with the tags used during import. the key is the name of the tag, and the value is an array ref containing the values given to export_tag() for the associated name. nested but make it fashion πŸŽ€
  • $hashref = $specs->exports() β€” get the exports hash. the keys are the names of the exports. the values are an array containing the export, the item specific config hash, and the arguments array. > heads up bestie: this is generally not intended for direct consumption πŸ™ˆ
  • $arrayref = $specs->excludes() β€” get the arrayref containing the names of all the excluded exports. bye felicia πŸ’€
  • $specs->export( $package ) β€” do the actual exporting. all the exports get injected straight into $package. this is the moment, the slay, the grand finale πŸ”₯
  • $specs->add_export( $name, $value )
  • $specs->add_export( $name, $value, \%config ) β€” add an export. name is required, sigil included, no skipping it. value is required too β€” if it's a sub it gets blessed as a ::Sub, otherwise it gets blessed as a ::Variable. look how cute that is:
$specs->add_export( '&foo' => sub { return 'foo' });

πŸ’œ AUTHORS πŸ’œ

Chad Granum β€” exodist7@gmail.com β€” thank you for your service 🫑


Copyright (C) 2010 Chad Granum

Exporter-Declare is free software; Standard perl licence.

Exporter-Declare is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. (yes bestie, the ALL CAPS is load-bearing, do not remove it 😭)


ok that's the whole page, you ate it, you understood it, you're literally a Perl girlie now πŸ’…βœ¨ this was perl v5.34.0, dated 2022-06-13 β€” mwah, take care of her, she's vintage πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from