=head1 Getting Started

Follow the same guidelines as normal for creating a Juju charm.

=head2 Directory Layout

Structure your project should look similar to:

  charm-project/
    hooks/
      install
      config-changed
      start
      stop
    tests/
      00-basic.test
    config.yaml
    metadata.yaml
    LICENSE
    README.md

=head2 Writing charm hooks

Hooks are written using perl with automatically imported helpers for convenience.
When developing hooks they should reside in B<hooks>.

A requirement for all charms using this library is to make sure to "bootstrap" the
B<install> hook. For example, edit B<hooks/install>

   #!/usr/bin/env perl
   BEGIN {
    system 'sudo apt-get install -qyf cpanminus build-essential libssl-dev libxml2-dev libexpat1-dev';
    system 'cpanm -n App::CharmKit~">= 2.00"';
   }

   use charm;

   log 'Installing dokuwiki dependenices';

   pkg [
    'nginx-full', 'php-fpm',      'php-cgi',      'php-curl', 'php-gd', 'php-json',
    'php-mcrypt', 'php-readline', 'php-mbstring', 'php-xml'
   ],
   ensure    => "present",
   on_change => sub { log "All latest packages installed."; };

   my $hook_path = $ENV{JUJU_CHARM_DIR};

The B<BEGIN> block is the important bit here where we make sure that
L<App::CharmKit> is installed prior to use.

Now all other charms can simply B<use charm> and continue the hook processing.

A typical hook starts with

   #!/usr/bin/env perl

   use charm;

   log 'Starting install hook for database';

   pkg ['mysql-server', 'nginx', 'php5-fpm'];

   my $dbhost = run 'relation-get dbhost';
   my $dbuser = run 'relation-get dbuser';

   service 'nginx' => 'restart';

=cut
