The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Ixchel - Automate various sys admin stuff.

VERSION

Version 0.12.0

METHODS

new

Initiates a new instance of Ixchel.

One option argument is taken and that is a hash ref named config.

    my $ixchel=Ixchel->new( config=>$config );

If config is defined, it will be merged with Ixchel::DefaultConfig via Hash::Merge using the following behavior.

                        {
                                'SCALAR' => {
                                        'SCALAR' => sub { $_[1] },
                                        'ARRAY'  => sub { [ $_[0], @{ $_[1] } ] },
                                        'HASH'   => sub { $_[1] },
                                },
                                'ARRAY' => {
                                        'SCALAR' => sub { $_[1] },
                                        'ARRAY'  => sub { [ @{ $_[1] } ] },
                                        'HASH'   => sub { $_[1] },
                                },
                                'HASH' => {
                                        'SCALAR' => sub { $_[1] },
                                        'ARRAY'  => sub { [ values %{ $_[0] }, @{ $_[1] } ] },
                                        'HASH'   => sub { Hash::Merge::_merge_hashes( $_[0], $_[1] ) },
                                },
                        }

Using this, the passed config will be merged into the default config. Worth noting that any arrays in the default config will be completely replaced by the array from the passed config.

action

The action to perform.

    - action :: The action to perform. This a required variable.
      Default :: undef

    - opts :: What to pass for opts. If not defined, GetOptions will be used to parse the options
              based on the options as defined by the action in question. If passing one manually this
              should be be a hash ref as would be return via GetOptions.
      Default :: undef

    - argv :: What to use for ARGV instead of @ARGV.
      Default :: undef

    - no_die_on_error :: If the return from the action is a hash ref, check if $returned->{errors} is a array
          if it is then it will die with those be used in the die message.
      Default :: 1

So if you want to render the template akin to '-a template -t extend_logsize' you can do it like below.

    my $rendered_template=$ixchel->action( action=>'template', opts=>{ t=>'extend_logsize' });

Now if we want to pass '--np' to not print it, we would do it like below.

    my $rendered_template=$ixchel->action( action=>'template', opts=>{ t=>'extend_logsize', np=>1 });

If the following values are defined, the matching ENVs are set.

    .proxy.ftp       ->  FTP_PROXY, ftp_proxy
    .proxy.http      ->  HTTP_PROXY, http_proxy
    .proxy.https     ->  HTTPS_PROXY, https_proxy
    .perl.cpanm_home ->  PERL_CPANM_HOME

Additionally any of the variables defined under .env will also be set. So .env.TMPDIR will set $ENV{TMPDIR}.

AUTHOR

Zane C. Bowers-Hadley, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-ixchel at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Ixchel. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Ixchel

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2023 by Zane C. Bowers-Hadley.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007