ldap - Why does Perl complain "Can't modify constant item in scalar assignment"? -


I have this Pearl sub-routine that is causing a problem:

  Sub new {my $ square = shift; My $ ldap_obj = Net :: LDAP- & gt; New ('test.company.com') or "$ @" die; My $ self = {_ldap = $ ldap_obj, _dn = 'dc = users, dc = ldap, dc = company, dc = com', _dn_login = 'dc = login, dc = ldap, dc = company, dc = com', _description = 'company',}; Print all the values ​​for #explantion. $ Self-blessing, $ square; Return $ self; }  

What's wrong with this code:

I got this error Continuous item can not be modified in scalar assignment on Core.pm line 12 "$ Ldap_obj,"

I think your code should be;

My $ self = {_ldap = & gt; $ Ldap_obj, _dn = & gt; 'DC = users, DC = LDAP, DC = company, DC = com', _dn_login = & gt; 'DC = Login, DC = LDAP, DC = Company, DC = COM', _description = & gt; 'company',};

Change it and try it with $ perl -c module.pm


Comments