CPAN::...Config(3pm)

πŸ“¦
version 1.012 Β· 4 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– CPAN::Mini::Inject::Config πŸ’–

okay so bestie, welcome to the manual page for CPAN::Mini::Inject::Config β€” the config class for CPAN::Mini::Inject, from the User Contributed Perl Documentation corner of the universe. it's giving "tiny file, big responsibility" and honestly? we're obsessed. πŸ’…


✨ NAME ✨

CPAN::Mini::Inject::Config β€” Config for CPAN::Mini::Inject. that's it, that's the whole name, no cap. πŸŽ€


🌸 SYNOPSIS 🌸

        my $config = CPAN::Mini::Inject::Config->new;

literally one line and you're in. iconic behavior. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

πŸ’œ Configuration πŸ’œ

This is the default class dealing with the default CPAN::Mini::Inject config. The simplest config is a key-value file:

        local: t/local/CPAN
        remote : http://localhost:11027
        repository: t/local/MYCPAN
        dirmode: 0775
        passive: yes

This module digests that and returns it as a hash reference. Any module that wants to use a different sort of config structure needs to return the same hash:

        {
        local      => 't/local/CPAN',
        remote     => 'http://localhost:11027',
        repository => 't/local/MYCPAN',
        dirmode    => '0775',
        passive    => 'yes',
        }

so yeah, swap out the config format if you want, but the shape of the hash is non-negotiable. main character consistency. πŸ‘‘


here come the directives, bestie. all of them. no skipping, we don't do that here. 🫢

  • dirmode β€” sets the permissions of created directories to the specified mode. the default value is based on umask if that's supported. 🌈
  • force β€” passthrough to CPAN::Mini. just vibes, just passing it along.
  • local β€” (required) the location to store the local CPAN::Mini mirror. you literally cannot skip this one, it's the whole point. πŸ’€
  • log_level β€” passthrough to CPAN::Mini.
  • module_filters β€” passthrough to CPAN::Mini.
  • passive β€” enable passive FTP. 🐟
  • remote β€” (required) the CPAN site(s) to mirror from. multiple sites can be listed space separated. yes bestie, you can stack them. πŸ”₯
  • repository β€” the location to store modules to add to the local CPAN::Mini mirror.
  • skip_cleanup β€” passthrough to CPAN::Mini.
  • skip_perl β€” passthrough to CPAN::Mini.
  • trace β€” passthrough to CPAN::Mini.

🧚 Methods 🧚

πŸ’– "new" πŸ’–

the constructor. that's the entry point, that's the doorway, that's the moment. ✨

πŸŽ€ config_file( [FILE] ) πŸŽ€

give it a file if you want, or don't, it's flexible like that.

πŸ¦‹ load_config() πŸ¦‹

okay so loadcfg accepts a CPAN::Mini::Inject config file, or β€” if nothing is defined β€” it will search the following four places, in order:

  1. the file pointed to by the environment variable MCPANI_CONFIG 🌸
  2. $HOME/.mcpani/config
  3. /usr/local/etc/mcpani
  4. /etc/mcpani

loadcfg sets the instance variable cfgfile to the file found, or to undef if none is found. so if it comes back empty-handed, that's your sign. πŸ™ˆ

 print "$mcpi->{cfgfile}\n"; # /etc/mcpani

look at that, it found /etc/mcpani. slay. πŸ’…

🌈 parse_config() 🌈

parsecfg reads the config file stored in the instance variable cfgfile and creates a hash in config with each setting.

  $mcpi->{config}{remote} # CPAN sites to mirror from.

parsecfg expects the config file in the following format:

 local: /www/CPAN
 remote: http://cpan.metacpan.org/
 repository: /work/mymodules
 passive: yes
 dirmode: 0755
⚠️ heads up bestie: if either local or remote are not defined, parsecfg croaks. like, actually dies. do not test it. 😭

⭐ get( DIRECTIVE ) ⭐

return the value for the named configuration directive. simple, clean, effective. 🫢

πŸ’œ "set( DIRECTIVE, VALUE )" πŸ’œ

sets the value for the named configuration directive. now you're the one in charge. πŸ‘‘


πŸ’Œ AUTHOR πŸ’Œ

Shawn Sorichetti "<ssoriche@coloredblocks.net>" β€” legend behavior, honestly. πŸŽ€


πŸ”₯ SOURCE AVAILABILITY πŸ”₯

The main repository is on GitHub:

        https://github.com/briandfoy/cpan-mini-inject

There are also backup repositories on several other services:

        https://bitbucket.org/briandfoy/cpan-mini-inject
        https://codeberg.org/briandfoy/cpan-mini-inject
        https://gitlab.com/briandfoy/cpan-mini-inject

redundancy queen. we love a girl with backups. πŸ’…βœ¨


Copyright 2004 Shawn Sorichetti, All Rights Reserved.

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


and that's the whole page, bestie!! πŸ¦‹ this beauty shipped with perl v5.40.1 and it's dated 2025-04-12 β€” so go forth, write your config, and remember: local and remote are required, and we don't negotiate with croaks. πŸ’– mwah, bye!! πŸŽ€βœ¨

πŸ“¦ where this page comes from