#NEWLINE# def install( module ) : #NEWLINE# #INDENT# "\n    Install a Perl module from CPAN\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' cpan.install Template::Alloy\n    " #NEWLINE# ret = { #NEWLINE# #INDENT# 'old' : None , #NEWLINE# 'new' : None , #NEWLINE# #UNINDENT# } #NEWLINE# old_info = show ( module ) #NEWLINE# cmd = 'cpan -i {0}' . format ( module ) #NEWLINE# out = __salt__ [ 'cmd.run' ] ( module ) #NEWLINE# import pprint #NEWLINE# pprint . pprint ( out ) #NEWLINE# if ( "don't know what it is" in out ) : #NEWLINE# #INDENT# ret [ 'error' ] = 'CPAN cannot identify this package' #NEWLINE# return ret #NEWLINE# #UNINDENT# new_info = show ( module ) #NEWLINE# ret [ 'old' ] = old_info . get ( 'installed version' , None ) #NEWLINE# ret [ 'new' ] = new_info [ 'installed version' ] #NEWLINE# return ret