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

App::CharmKit::Sys - hook utilities

SYNOPSIS

  use charm;

or

  use App::CharmKit::Sys;

  apt_update;
  apt_upgrade;
  apt_install ['nginx-common', 'redis-server'];

DESCRIPTION

Provides system utilities such as installing packages, managing files, and more.

log($message)

Utilizies juju-log for any additional logging

spew(SCALAR $path, SCALAR $contents)

writes to a file, defaults to utf8

slurp(SCALAR $path)

reads a file, defaults to utf8

sh(SCALAR $command)

runs a local command:

   my $ret = sh 'juju-log a message';
   print $ret;

Arguments command: command to run

Returns output of command

apt_add_repo(SCALAR $repo, SCALAR $key, BOOL $update)

Adds a archive repository or ppa. key is required if adding http source.

source can be in the format of:

  ppa:charmers/example
  deb https://stub:key@private.example.com/ubuntu trusty main
apt_install(ARRAYREF $pkgs)

Installs packages via apt-get

   apt_install(['nginx']);
apt_upgrade

Upgrades system

   apt_upgrade();
apt_update

Update repository sources

   apt_update();

1;