<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">Putz, que simples... :)<br>Maravilha, obrigadão...<br><div> </div>Daniel ® Antunes<br><em></em><em><font color="#007f40">gnu/linux user</font></em> #238553<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Mensagem original ----<br>De: Eden Cardim <edencardim@gmail.com><br>Para: Cascavel Perl Mongers <cascavel-pm@pm.org><br>Enviadas: Sexta-feira, 11 de Julho de 2008 12:28:37<br>Assunto: Re: [Cascavel-pm] Constant Functions<br><br>2008/7/11 Daniel (R) Antunes <<a ymailto="mailto:danielrantunes@yahoo.com.br" href="mailto:danielrantunes@yahoo.com.br">danielrantunes@yahoo.com.br</a>>:<br>> Bom dia amigos...<br>> Estou
utilizando "constant functions" em uma série de módulos. Estes<br>> módulos têm basicamente a mesma função, mas consultam lugares diferentes,<br>> têm alguns comportamentos diferentes e o retorno deles é diferente, tudo é<br>> tratado e agrupado após o retorno.<br>> Bom, as "constant functions" entram no sentido de facilitar a inclusão<br>> de novos módulos à medida da necessidade, constantemente entram novas fontes<br>> onde preciso buscar dados e para cada fonte crio um módulo.<br>> As "constant functions" tem o mesmo nome em todos estes módulos, porém,<br>> apontam para ações de webservice diferentes, eu crio o módulo e somente<br>> altero estas ações e em muito pouco tempo tenho uma nova fonte operando.<br>> Minha pergunta é, como referenciar de forma dinâmica estas constantes no<br>> 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->{supplier}; # Supplier = A ou B<br>> my $pkg='Supplier::'.$supplier; # Supplier::A ou Supplier::B<br>> my $obj=$pkg->new();<br>> if ($xml->{type} eq 'product'){<br>> $obj->{type}=$pkg::GET_PRODUCT_INFORMATION;<br>> }<br>> elsif ($xml->{type} eq 'destination'){<br>> $obj->{type}=$pkg::GET_DESTINATION_INFORMATION;<br>> }<br>> $obj->processdata();<br>><br>>
Meu problema é bastante simples, mas eu não estou conseguindo achar a<br>> solução.<br>><br>> $pkg::GET_DESTINATION_INFORMATION<br>><br>> Dá este erro :<br>><br>> Use of uninitialized value in print at /home/inquiry/s2Dev/Inquiry.pm line<br>> 440<br><br>Invoca a subrotina assim:<br><br>$pkg->GET_DESTINATION_INFORMATION<br><br>-- <br>edenc.vox.com<br>_______________________________________________<br>Cascavel-pm mailing list<br><a ymailto="mailto:Cascavel-pm@pm.org" href="mailto:Cascavel-pm@pm.org">Cascavel-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/cascavel-pm" target="_blank">http://mail.pm.org/mailman/listinfo/cascavel-pm</a><br></div></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>