From igor.sutton em gmail.com Mon Feb 5 02:13:15 2007 From: igor.sutton em gmail.com (Igor Sutton) Date: Mon, 5 Feb 2007 10:13:15 +0000 Subject: [PortoAlegre-pm] Um pequeno agito na lista Message-ID: <6c65a53f0702050213q41e6ba8by33d2bc3d52efc546@mail.gmail.com> Pessoal, Nossa lista anda um tanto parada, recebendo apenas uns cross-postings da Cascavel-pm, porém gostaria de mudar isso e começar a dar mais atenção cá. Como alguns de vocês devem ter lido tempos atrás, o excelentíssimo Er Galvão Abbott deixou a lista e a organização da Porto Alegre-pm. O que vocês não sabem, é que ele deixou a honrosa tarefa de cuidar da lista para mim. Tarefa que não pude dar muita atenção nos últimos meses - mudança de país e trabalho -, atenção esta que pretendo retomar e voltar a fomentar a utilização de Perl em Porto Alegre e, se possível no Rio Grande do Sul. Um grande abraço a todos, e espero que consigamos deixar esta lista o mais movimentada possível! -- Igor Sutton Lopes From igor.sutton em gmail.com Mon Feb 5 06:53:29 2007 From: igor.sutton em gmail.com (Igor Sutton) Date: Mon, 5 Feb 2007 14:53:29 +0000 Subject: [PortoAlegre-pm] Quiz Message-ID: <6c65a53f0702050653w4a3e1e5fu2e7f77962a63dbdd@mail.gmail.com> Quiz :-) Assumindo que ref($data) devolve 'ARRAY', o que acontece quando utilizamos o seguinte código? foreach($data) { print; } Caso ele não tenha o comportamento esperado, o que devemos modificar no código e por que? Boa sorte :-) -- Igor Sutton Lopes From igorgf em gmail.com Mon Feb 5 07:04:26 2007 From: igorgf em gmail.com (Igor Garcia) Date: Mon, 5 Feb 2007 13:04:26 -0200 Subject: [PortoAlegre-pm] Quiz In-Reply-To: <6c65a53f0702050653w4a3e1e5fu2e7f77962a63dbdd@mail.gmail.com> References: <6c65a53f0702050653w4a3e1e5fu2e7f77962a63dbdd@mail.gmail.com> Message-ID: Fácil... $data é uma referência para um array... Deve ter sido definida como algo do tipo: $data = \@meu_array... Pro for funcionar, precisamos pegar a referência e transformá-la em array denovo... Ou seja, foreach (@{$data}){ print; } É isso... Em 05/02/07, Igor Sutton escreveu: > > Quiz :-) > > Assumindo que ref($data) devolve 'ARRAY', o que acontece quando > utilizamos o seguinte código? > > foreach($data) { > print; > } > > Caso ele não tenha o comportamento esperado, o que devemos modificar > no código e por que? > > Boa sorte :-) > > -- > Igor Sutton Lopes > _______________________________________________ > PortoAlegre-pm mailing list > PortoAlegre-pm em pm.org > http://mail.pm.org/mailman/listinfo/portoalegre-pm > -------------- Próxima Parte ---------- Um anexo em HTML foi limpo... URL: http://mail.pm.org/pipermail/portoalegre-pm/attachments/20070205/af58875d/attachment.html From igor.sutton em gmail.com Mon Feb 5 07:15:04 2007 From: igor.sutton em gmail.com (Igor Sutton) Date: Mon, 5 Feb 2007 15:15:04 +0000 Subject: [PortoAlegre-pm] Quiz In-Reply-To: References: <6c65a53f0702050653w4a3e1e5fu2e7f77962a63dbdd@mail.gmail.com> Message-ID: <6c65a53f0702050715w41aea275v484cbc0b0cf3aa74@mail.gmail.com> Em 05/02/07, Igor Garcia escreveu: > Fácil... > > $data é uma referência para um array... > Deve ter sido definida como algo do tipo: $data = \@meu_array... > Pro for funcionar, precisamos pegar a referência e transformá-la em array > denovo... > Ou seja, > > foreach (@{$data}){ > print; > } > > É isso... > Hrm... Parece bom. Mais alguém? -- Igor Sutton Lopes From a.r.ferreira em gmail.com Mon Feb 5 08:27:16 2007 From: a.r.ferreira em gmail.com (Adriano Ferreira) Date: Mon, 5 Feb 2007 14:27:16 -0200 Subject: [PortoAlegre-pm] Quiz In-Reply-To: <6c65a53f0702050653w4a3e1e5fu2e7f77962a63dbdd@mail.gmail.com> References: <6c65a53f0702050653w4a3e1e5fu2e7f77962a63dbdd@mail.gmail.com> Message-ID: <73ddeb6c0702050827v7921b86ep104da778ac5aaa65@mail.gmail.com> On 2/5/07, Igor Sutton wrote: > Assumindo que ref($data) devolve 'ARRAY', o que acontece quando > utilizamos o seguinte código? > > foreach($data) { > print; > } Só completando a resposta do Igor, o foreach sobre uma variável escalar é um laço que executa uma vez só e faz um alias da variável do loop. Isto pode ser útil às vezes: foreach ($data->{struct1}->{struct2}->[2]->{struct3}) { $a = $_ * (1 - $_)/(1 + $_) } ao invés de $a = $data->{struct1}->{struct2}->[2]->{struct3} * (1 - $data->{struct1}->{struct2}->[2]->{struct3})/ (1 + $data->{struct1}->{struct2}->[2]->{struct3}) (É óbvio que $v = $data->{struct1}->{struct2}->[2]->{struct3}; $a = $v * (1 - $v)/(1 + $v) funciona também mas não é tão sexy. No entanto é diferente porque a atribuição $v = faz cópia de números e strings.) No caso em que ref($data) eq 'ARRAY', a resposta é que a representação string do array vai ser impressa, algo como $ perl -e '$a = []; foreach ($a) { print }' ARRAY(0x10240170) ############ Como um comentário, para um laço tão pequeno, um modificador pode ser usado também passando > foreach($data) { > print; > } para print foreach ($data); # ou print foreach (@$data); # se era esta a idéia Adriano. From igor.sutton em gmail.com Mon Feb 5 15:09:47 2007 From: igor.sutton em gmail.com (Igor Sutton Lopes) Date: Mon, 5 Feb 2007 23:09:47 +0000 Subject: [PortoAlegre-pm] Quiz In-Reply-To: <73ddeb6c0702050827v7921b86ep104da778ac5aaa65@mail.gmail.com> References: <6c65a53f0702050653w4a3e1e5fu2e7f77962a63dbdd@mail.gmail.com> <73ddeb6c0702050827v7921b86ep104da778ac5aaa65@mail.gmail.com> Message-ID: <0D5FD60D-6BAB-436D-BE66-347555BE8EFE@gmail.com> Adriano, On 2007/02/05, at 16:27, Adriano Ferreira wrote: > On 2/5/07, Igor Sutton wrote: >> Assumindo que ref($data) devolve 'ARRAY', o que acontece quando >> utilizamos o seguinte código? >> >> foreach($data) { >> print; >> } > > Só completando a resposta do Igor, o foreach sobre uma variável > escalar é um laço que executa uma vez só e faz um alias da variável do > loop. Isto pode ser útil às vezes: > > foreach ($data->{struct1}->{struct2}->[2]->{struct3}) { > $a = $_ * (1 - $_)/(1 + $_) > } > > ao invés de > > $a = $data->{struct1}->{struct2}->[2]->{struct3} * > (1 - $data->{struct1}->{struct2}->[2]->{struct3})/ > (1 + $data->{struct1}->{struct2}->[2]->{struct3}) > > (É óbvio que > > $v = $data->{struct1}->{struct2}->[2]->{struct3}; > $a = $v * (1 - $v)/(1 + $v) > > funciona também mas não é tão sexy. No entanto é diferente porque a > atribuição $v = faz cópia de números e strings.) Você conhece alguma maneira de fazer um alias para uma estrutura de dados, como o foreach, porém fora do mesmo? -- Igor Sutton Lopes -------------- Próxima Parte ---------- Um anexo em HTML foi limpo... URL: http://mail.pm.org/pipermail/portoalegre-pm/attachments/20070205/418b70ad/attachment.html -------------- Próxima Parte ---------- Um anexo não texto foi limpo... Nome : PGP.sig Tipo : application/pgp-signature Tam : 186 bytes Descr.: This is a digitally signed message part Url : http://mail.pm.org/pipermail/portoalegre-pm/attachments/20070205/418b70ad/attachment.bin From igor.sutton em gmail.com Mon Feb 5 15:40:31 2007 From: igor.sutton em gmail.com (Igor Sutton Lopes) Date: Mon, 5 Feb 2007 23:40:31 +0000 Subject: [PortoAlegre-pm] Quiz In-Reply-To: <73ddeb6c0702050827v7921b86ep104da778ac5aaa65@mail.gmail.com> References: <6c65a53f0702050653w4a3e1e5fu2e7f77962a63dbdd@mail.gmail.com> <73ddeb6c0702050827v7921b86ep104da778ac5aaa65@mail.gmail.com> Message-ID: <9F3ED9C3-3785-4C2A-8D23-8AA4BD291B7C@gmail.com> Adriano, Respondendo a minha pergunta. Encontrei o módulo Lexical::Alias, que faz o que eu perguntei: #!env perl -l use strict; use warnings; use Lexical::Alias; use Test::More tests => 3; my $this = 23; my $that; alias $this, $that; is($this, $that); $this = 12; is($this, $that); $that = 36; is($this, $that); Fica aí a dica :-) -- Igor Sutton Lopes -------------- Próxima Parte ---------- Um anexo em HTML foi limpo... URL: http://mail.pm.org/pipermail/portoalegre-pm/attachments/20070205/4eeb6711/attachment.html -------------- Próxima Parte ---------- Um anexo não texto foi limpo... Nome : PGP.sig Tipo : application/pgp-signature Tam : 186 bytes Descr.: This is a digitally signed message part Url : http://mail.pm.org/pipermail/portoalegre-pm/attachments/20070205/4eeb6711/attachment.bin From a.r.ferreira em gmail.com Tue Feb 6 02:50:34 2007 From: a.r.ferreira em gmail.com (Adriano Ferreira) Date: Tue, 6 Feb 2007 08:50:34 -0200 Subject: [PortoAlegre-pm] Quiz In-Reply-To: <9F3ED9C3-3785-4C2A-8D23-8AA4BD291B7C@gmail.com> References: <6c65a53f0702050653w4a3e1e5fu2e7f77962a63dbdd@mail.gmail.com> <73ddeb6c0702050827v7921b86ep104da778ac5aaa65@mail.gmail.com> <9F3ED9C3-3785-4C2A-8D23-8AA4BD291B7C@gmail.com> Message-ID: <73ddeb6c0702060250re71e999k4e845f252262c645@mail.gmail.com> On 2/5/07, Igor Sutton Lopes wrote: > Adriano, > > Respondendo a minha pergunta. Encontrei o módulo Lexical::Alias, que faz o > que eu perguntei: Obrigado. Eu não conhecia este módulo. Mas há ainda uma outra resposta para >Você conhece alguma maneira de fazer um alias para uma estrutura de dados, como o foreach, porém fora do mesmo? que é passar a estrutura como argumento para uma subrotina: sub foo { print $_[0]; } Os argumentos em @_ são alias dos parâmetros usados e podem modificá-los. > > > #!env perl -l > > use strict; > use warnings; > > use Lexical::Alias; > use Test::More tests => 3; > > my $this = 23; > my $that; > > alias $this, $that; > > is($this, $that); > > $this = 12; > > is($this, $that); > > $that = 36; > > is($this, $that); > > > Fica aí a dica :-) > > > -- > Igor Sutton Lopes > > > > > _______________________________________________ > PortoAlegre-pm mailing list > PortoAlegre-pm em pm.org > http://mail.pm.org/mailman/listinfo/portoalegre-pm > > > From igor.sutton em gmail.com Thu Feb 22 03:32:54 2007 From: igor.sutton em gmail.com (Igor Sutton) Date: Thu, 22 Feb 2007 11:32:54 +0000 Subject: [PortoAlegre-pm] Fwd: [pm_groups] YAPC::Europe 2007 - Call for Participation In-Reply-To: <20070222111641.GB25910@domm2.zsi.at> References: <20070222111641.GB25910@domm2.zsi.at> Message-ID: <6c65a53f0702220332p238dc468y58cd7be2514e213a@mail.gmail.com> Pessoal, Quem estiver de férias na Europa e quiser aparecer no YAPC::Europe 2007, em Vienna :-) ---------- Forwarded message ---------- From: Thomas Klausner Date: 22/02/2007 11:16 Subject: [pm_groups] YAPC::Europe 2007 - Call for Participation To: pm_groups em pm.org (please forward to your local groups and all other potentially interested people...) Call for Participation - YAPC::Europe 2007 in Vienna ==================================================== Vienna.pm is officially announcing the call for participation for Yet Another Perl Conference Europe 2007. This years conference theme is "Social Perl". Location -------- The conference will be held in Vienna, Austria, from 29th to 31st August 2007 at the Vienna University of Economics and Business Administration. Star guests ----------- We found sponsors to invite some famous international Perl hackers. Thanks to nfotex for inviting Larry (and Gloria) Wall, to Anonymous Donor for getting Damian Conway from Australia to Austria (it's quite expensive to get the 'al' out of Australia...) and to geizhals.at for inviting Audrey Tang and Mark Jason Dominus. Schedule -------- The final schedule will be announced on 22nd of July 2007. Would-be speakers please see the Call for Papers available on the conference website for more information on key dates and talks. Costs ----- * Regular attendance: 100 EUR * Students and Early Birds: 80 EUR * Business/Sponsor Tariff: 200 EUR Regular attendance costs 100 Euro, and 80 Euros for students. Early birds only pay 80 Euros (if paid until 31st March 2007). There is also a voluntary business/sponsor tariff at 200 Euros, which is an easy way to sponsor YAPC::Europe 2007 and Perl in general. You will not only get three days packed with interesting talks and people, but also a goodie bag, a conference t-shirt, an invitation to the attendees dinner and the unique opportunity to see renowned members of the Perl community with orange mohawks. As YAPC::Europe is a community-driven conference, we're not in it for the profit. But should we make one, all money will be used for funding further Perl 5|6 development, future YAPC::Europe conferences and for advancing Perl usage / the Perl community in Austria. How to register --------------- To register for YAPC::Europe 2007 go to our website: http://vienna.yapceurope.org Click on the 'New user'-Link in the navbar and fill out the subsequent form. Accomodation & Getting to Vienna -------------------------------- Please note that you should *definitly* book your hotel room as soon as possible. While you will be able to get a room later, the hotels near the venue will fill up. So to prevent long trips through the city or paying more than you want to, book your hotel room!. You can find more information on accomodation in Vienna, and how to get to Vienna by plain, train, car etc at the conference website. Contact ------- For more information please see the YAPC Europe 2007 website: http://vienna.yapceurope.org If you have any questions, do not hesitate to send an email to vienna2007 em yapceurope.org The organisers will get back to you as soon as possible. Thomas Klausner, on behalfe of Vienna.pm -- #!/usr/bin/perl http://domm.zsi.at for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/} -- Request pm.org Technical Support via support em pm.org pm_groups mailing list pm_groups em pm.org http://mail.pm.org/mailman/listinfo/pm_groups -- Igor Sutton Lopes