<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt">&nbsp;&nbsp; Bom dia amigos...<br>&nbsp;&nbsp; Estou utilizando "constant functions" em uma série de módulos. Estes módulos têm  basicamente a mesma função, mas consultam lugares diferentes, têm alguns comportamentos diferentes e o retorno deles é diferente, tudo é tratado e agrupado após o retorno.<br>&nbsp;&nbsp;&nbsp; Bom, as "constant functions" entram no sentido de facilitar a inclusão de novos módulos à medida da necessidade, constantemente entram novas fontes onde preciso buscar dados e para cada fonte crio um módulo.<br>&nbsp;&nbsp;&nbsp; As "constant functions" tem o mesmo nome em todos estes módulos, porém, apontam para ações de webservice diferentes, eu crio o módulo e somente altero estas ações e em muito pouco tempo tenho uma nova fonte
 operando.<br>&nbsp;&nbsp;&nbsp; Minha pergunta é, como referenciar de forma dinâmica estas constantes no módulo principal, segue uma forma muito simplificada do funcionamento :<br><br>MODULO A<br><br>sub SELFCODE {13};<br>sub SELFNAME {'SUPPLIERA'};<br>sub GET_PRODUCT_INFORMATION {'getStaticData_Product'};<br>sub GET_DESTINATION_INFORMATION {'getStaticData_Destination'};<br><br>
MODULO B<br><br>
sub SELFCODE {61};<br>
sub SELFNAME {'SUPPLIERB'};<br>
sub GET_PRODUCT_INFORMATION {'productsData'};<br>
sub GET_DESTINATION_INFORMATION {'destinations'};<br><br>MODULO PRINCIPAL<br><br>my $supplier=$xml-&gt;{supplier}; # Supplier = A ou B<br>my $pkg='Supplier::'.$supplier; # Supplier::A ou Supplier::B<br>my $obj=$pkg-&gt;new();<br>if ($xml-&gt;{type} eq 'product'){<br>&nbsp;&nbsp;&nbsp; $obj-&gt;{type}=$pkg::GET_PRODUCT_INFORMATION;<br>}<br>elsif ($xml-&gt;{type} eq 'destination'){<br>&nbsp;&nbsp;&nbsp; $obj-&gt;{type}=$pkg::GET_DESTINATION_INFORMATION;<br>}<br>$obj-&gt;processdata();<br><br>&nbsp;&nbsp;&nbsp; Meu problema é bastante simples, mas eu não estou conseguindo achar a solução.<br><div>&nbsp;<br>$pkg::GET_DESTINATION_INFORMATION<br><br>&nbsp;&nbsp;&nbsp; Dá este erro :<br><br>Use of uninitialized value in print at /home/inquiry/s2Dev/Inquiry.pm line 440<br></div><br>&nbsp;&nbsp;&nbsp; Ufa, acho que foi bem claro.<br>&nbsp;&nbsp;&nbsp; Obrigado.<br><br><br>Daniel ® Antunes<br><em></em><em><font color="#007f40">gnu/linux user</font></em>
 #238553<div><br></div></div><br>


      <hr size=1>Novos endereços, o Yahoo! que você conhece. <a href="http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses">Crie um email novo</a> com a sua cara @ymail.com ou @rocketmail.com.</body></html>