Perlbrew installation issue on ubuntu server

We are trying to install Perlbrew on ubuntu server through chef cookbook as this server is in AWS so we are launching the server in cluster mode using the AWS Cloud formation template
Perlbrew version-0.3.0
Ubuntu version-14.04

Here is a part of the log file where we have seen the error:-

[2018-10-29T08:45:36+00:00] INFO: Processing apt_package[gettext] action nothing (build-essential::_debian line 108)
[2018-10-29T08:45:36+00:00] INFO: Processing apt_package[ncurses-dev] action nothing (build-essential::_debian line 108)
[2018-10-29T08:45:36+00:00] INFO: Processing apt_package[patch] action install (perlbrew::default line 23)
[2018-10-29T08:45:36+00:00] INFO: Processing apt_package[perl] action install (perlbrew::default line 23)
[2018-10-29T08:45:36+00:00] INFO: Processing apt_package[curl] action install (perlbrew::default line 23)
[2018-10-29T08:45:36+00:00] INFO: Processing directory[/opt/perlbrew] action create (perlbrew::default line 29)
[2018-10-29T08:45:36+00:00] INFO: directory[/opt/perlbrew] created directory /opt/perlbrew
[2018-10-29T08:45:36+00:00] INFO: Processing bash[perlbrew self-upgrade] action run (perlbrew::default line 32)
[2018-10-29T08:45:36+00:00] INFO: Processing bash[perlbrew-install] action run (perlbrew::default line 43)

================================================================================
Error executing action `run` on resource 'bash[perlbrew-install]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '3'
---- Begin output of "bash"  "/tmp/chef-script20181029-3311-m3vobj" ----
STDOUT: ## Download the latest perlbrew

## Installing perlbrew
Using Perl </usr/bin/perl>
STDERR: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   170  100   170    0     0    431      0 --:--:-- --:--:-- --:--:--   432

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1548  100  1548    0     0   3270      0 --:--:-- --:--:-- --:--:-- 38700
Received an undefined entry as a parameter (all parameters are: , .perlbrew) at perlbrew.wX5Wu5 line 119.
---- End output of "bash"  "/tmp/chef-script20181029-3311-m3vobj" ----
Ran "bash"  "/tmp/chef-script20181029-3311-m3vobj" returned 3

Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/perlbrew/recipes/default.rb

 43: bash "perlbrew-install" do
 44:   cwd Chef::Config[:file_cache_path]
 45:   environment ({'PERLBREW_ROOT' => perlbrew_root})
 46:   code <<-EOC
 47:   curl -kL http://install.perlbrew.pl > perlbrew-install
 48:   source perlbrew-install
 49:   #{perlbrew_root}/bin/perlbrew -f install-cpanm
 50:   EOC
 51:   not_if {::File.exists?(perlbrew_bin)}
 52: end
 53: 

Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/perlbrew/recipes/default.rb:43:in `from_file'

bash("perlbrew-install") do
  action "run"
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  command "perlbrew-install"
  backup 5
  cwd "/var/chef/cache"
  environment {"PERLBREW_ROOT"=>"/opt/perlbrew"}
  returns 0
  code "  curl -kL http://install.perlbrew.pl > perlbrew-install\n  source perlbrew-install\n  /opt/perlbrew/bin/perlbrew -f install-cpanm\n"
  interpreter "bash"
  declared_type :bash
  cookbook_name "perlbrew"
  recipe_name "default"
  not_if { #code block }
end

[2018-10-29T08:45:37+00:00] INFO: Running queued delayed notifications before re-raising exception
[2018-10-29T08:45:37+00:00] INFO: template[/etc/ntp.conf] sending restart action to service[ntp] (delayed)
[2018-10-29T08:45:37+00:00] INFO: Processing service[ntp] action restart (ntp::default line 82)
[2018-10-29T08:45:39+00:00] INFO: service[ntp] restarted
[2018-10-29T08:45:39+00:00] INFO: template[/etc/init.d/chef-client] sending restart action to service[chef-client] (delayed)
[2018-10-29T08:45:39+00:00] INFO: Processing service[chef-client] action restart (chef-client::init_service line 31)
[2018-10-29T08:45:40+00:00] INFO: service[chef-client] restarted
[2018-10-29T08:45:40+00:00] INFO: template[/etc/snmp/snmpd.conf] sending restart action to service[snmpd] (delayed)
[2018-10-29T08:45:40+00:00] INFO: Processing service[snmpd] action restart (snmp::default line 31)
[2018-10-29T08:45:41+00:00] INFO: service[snmpd] restarted
[2018-10-29T08:45:41+00:00] INFO: template[/etc/ssh/sshd_config] sending restart action to service[ssh] (delayed)
[2018-10-29T08:45:41+00:00] INFO: Processing service[ssh] action restart (openssh::default line 32)
[2018-10-29T08:45:41+00:00] INFO: service[ssh] restarted
[2018-10-29T08:45:41+00:00] ERROR: Running exception handlers
[2018-10-29T08:45:41+00:00] ERROR: Exception handlers complete
[2018-10-29T08:45:41+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2018-10-29T08:45:41+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: bash[perlbrew-install] (perlbrew::default line 43) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '3'
---- Begin output of "bash"  "/tmp/chef-script20181029-3311-m3vobj" ----
STDOUT: ## Download the latest perlbrew

## Installing perlbrew
Using Perl </usr/bin/perl>
STDERR: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   170  100   170    0     0    431      0 --:--:-- --:--:-- --:--:--   432

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  1548  100  1548    0     0   3270      0 --:--:-- --:--:-- --:--:-- 38700
Received an undefined entry as a parameter (all parameters are: , .perlbrew) at perlbrew.wX5Wu5 line 119.
---- End output of "bash"  "/tmp/chef-script20181029-3311-m3vobj" ----
Ran "bash"  "/tmp/chef-script20181029-3311-m3vobj" returned 3
+ echo ERROR while running chef-client
ERROR while running chef-client
+ EXIT_CODE=1

Please suggest us any solution for this issue.

Thanks
pankaj