Install a Perl module from CPAN

    CLI Example:

    .. code-block:: bash

        salt '*' cpan.install Template::Alloy

def install(module):
    '''
    Install a Perl module from CPAN

    CLI Example:

    .. code-block:: bash

        salt '*' cpan.install Template::Alloy
    '''
    ret = {
        'old': None,
        'new': None,
    }

    old_info = show(module)

    cmd = 'cpan -i {0}'.format(module)
    out = __salt__['cmd.run'](cmd)

    if "don't know what it is" in out:
        ret['error'] = 'CPAN cannot identify this package'
        return ret

    new_info = show(module)
    ret['old'] = old_info.get('installed version', None)
    ret['new'] = new_info['installed version']

    return ret