From gwadej at anomaly.org Tue Aug 2 05:15:03 2016 From: gwadej at anomaly.org (G. Wade Johnson) Date: Tue, 2 Aug 2016 07:15:03 -0500 Subject: [pm-h] Fw: Houston.pm August meeting Message-ID: <20160802071503.5563815b@cygnus> And, I hit reply, instead of reply all. Any more interested in a short talk? Begin forwarded message: Subject: Re: [pm-h] Houston.pm August meeting Okay, that's one. I'll be willing to come up with one as well, if we have more than two. Who else is willing to give a 5-10 minute talk? - What are you working on? - Have you seen an interesting piece of code or technique? - Is there a module that you can't live without? - Is there a game that is consuming your life? Let's hear from you. G. Wade On Wed, 27 Jul 2016 10:58:17 -0500 Todd Rinaldo wrote: > > > On Jul 27, 2016, at 7:18 AM, G. Wade Johnson via Houston > > wrote: > > > > Mark has suggested he would be able to do September, but we are > > still missing someone for August. Any suggestions? > > > > Anyone willing to do a short 5-10 minute presentation? If we could > > get 4-6 of those together, we would have a reasonable topic for the > > month. > > > > Trac expressed interest in a hack-a-thon type meeting last time. Any > > interest? > > > > G. Wade > > If we're doing short presentations, I'm happy to do a short > presentation on what's going on with the Perl CVE-2016-1238 with a > example of how it can be exploited (no recordings though) > > Todd > -- You should never hand someone a gun unless you're sure where they'll point it. -- Jeffrey Sinclair in "By Any Means Necessary" -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald Knuth From gwadej at anomaly.org Thu Aug 4 20:45:49 2016 From: gwadej at anomaly.org (G. Wade Johnson) Date: Thu, 4 Aug 2016 22:45:49 -0500 Subject: [pm-h] August Houston.pm meeting Message-ID: <20160804224549.50c7dff8@cygnus> On Thursday, August 11, we have a small number of short talks on various topics leading to a discussion of our development processes and tools. If you have a module, technique, or tool that really makes your life better, now is a good time to spread the knowledge. If you have a problem that someone else might have insight into, this will be a good time to ask. As usual, the meeting will start at 7pm at the Hostgator offices at 5005 Mitchelldale, Suite #100 (https://maps.google.com/maps?q=HostGator,+Houston&fb=1&gl=us&hq=HostGator,&hnear=0x8640b8b4488d8501:0xca0d02def365053b,Houston,+TX&cid=2141572779937723859&t=h&z=16&iwloc=A). Looking forward to seeing you there, G. Wade -- Okay, that makes sense. I just don't understand it. -- Dan Muey From uri at stemsystems.com Mon Aug 8 01:33:49 2016 From: uri at stemsystems.com (Uri Guttman) Date: Mon, 8 Aug 2016 04:33:49 -0400 Subject: [pm-h] Join DFW.pm for a talk on dataflow In-Reply-To: <57A8432E.2080602@stemsystems.com> References: <57A8432E.2080602@stemsystems.com> Message-ID: <57A843ED.8020604@stemsystems.com> Hi all, I will be giving a remote talk to the Dallas/Ft. Worth Perl mongers (dfw.pm) on Monday night August 8, at 8pm CDT (GMT - 500). This talk will be about dataflow, a way to organize and architect your software which has many advantages. It is an expanded version of the lightning talk I gave in June at The Perl Conference in Orlando. If you plan to attend online, please install the hangouts app/plugin from google.com/hangouts ? This will allow you to view the live video stream, but if you'd like to participate interactively, please send your google ID *in advance* to dfw.perlmongers at gmail.com and we'll add you to the online classroom. -- Tommy Butler, John Fields, DFW.pm I will aim to answer questions via hangouts chat. thanx, Uri Guttman -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwadej at anomaly.org Wed Aug 10 05:35:40 2016 From: gwadej at anomaly.org (G. Wade Johnson) Date: Wed, 10 Aug 2016 07:35:40 -0500 Subject: [pm-h] Houston.pm short presentations tomorrow night Message-ID: <20160810073540.6b8db08b@cygnus> So far, this is what we have on the program for tomorrow night: - J.D. Lightsey, something cool - Todd Rinaldo, Perl CVE-2016-1238 - Robert Stone, Design discussion (potential) - Wade Johnson, Using Perl to do 2-color 3D Printing - Other? G. Wade -- If debugging is the process of removing software bugs, the programming must be the process of putting them in. -- Edsger Dijkstra From flbaker at sbcglobal.net Wed Aug 10 07:35:14 2016 From: flbaker at sbcglobal.net (Fraser Baker) Date: Wed, 10 Aug 2016 14:35:14 +0000 Subject: [pm-h] Houston.pm short presentations tomorrow night In-Reply-To: <20160810073540.6b8db08b@cygnus> References: <20160810073540.6b8db08b@cygnus> Message-ID: Hi Wade: Where is the meeting? Our home was flooded and have been displaced. Maybe able to attend this time. Fraser ------ Original Message ------ From: "G. Wade Johnson via Houston" To: "Houston Perl Mongers" Cc: "G. Wade Johnson" Sent: 8/10/2016 7:35:40 AM Subject: [pm-h] Houston.pm short presentations tomorrow night >So far, this is what we have on the program for tomorrow night: > > - J.D. Lightsey, something cool > - Todd Rinaldo, Perl CVE-2016-1238 > - Robert Stone, Design discussion (potential) > - Wade Johnson, Using Perl to do 2-color 3D Printing > - Other? > >G. Wade >-- >If debugging is the process of removing software bugs, the programming >must be the process of putting them in. -- Edsger >Dijkstra >_______________________________________________ >Houston mailing list >Houston at pm.org >http://mail.pm.org/mailman/listinfo/houston >Website: http://houston.pm.org/ From anaremore at hostgator.com Wed Aug 10 09:26:56 2016 From: anaremore at hostgator.com (Austin Naremore) Date: Wed, 10 Aug 2016 11:26:56 -0500 Subject: [pm-h] Houston.pm short presentations tomorrow night In-Reply-To: References: <20160810073540.6b8db08b@cygnus> Message-ID: Fraser, The meeting will be at the HostGator office: 5005 Mitchelldale Suite #100 Houston, TX 77092 On Wed, Aug 10, 2016 at 9:35 AM, Fraser Baker via Houston wrote: > Hi Wade: > Where is the meeting? Our home was flooded and have been displaced. Maybe > able to attend this time. > Fraser > > > ------ Original Message ------ > From: "G. Wade Johnson via Houston" > To: "Houston Perl Mongers" > Cc: "G. Wade Johnson" > Sent: 8/10/2016 7:35:40 AM > Subject: [pm-h] Houston.pm short presentations tomorrow night > > So far, this is what we have on the program for tomorrow night: >> >> - J.D. Lightsey, something cool >> - Todd Rinaldo, Perl CVE-2016-1238 >> - Robert Stone, Design discussion (potential) >> - Wade Johnson, Using Perl to do 2-color 3D Printing >> - Other? >> >> G. Wade >> -- >> If debugging is the process of removing software bugs, the programming >> must be the process of putting them in. -- Edsger Dijkstra >> _______________________________________________ >> Houston mailing list >> Houston at pm.org >> http://mail.pm.org/mailman/listinfo/houston >> Website: http://houston.pm.org/ >> > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > -- *Austin Naremore*HTX Development Manager HostGator.com anaremore at hostgator.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From jlbprof at gmail.com Wed Aug 10 17:59:20 2016 From: jlbprof at gmail.com (Julian Brown) Date: Wed, 10 Aug 2016 19:59:20 -0500 Subject: [pm-h] howdy Message-ID: My email has been messing up. I told Wade privately, I am ready with a 15 minute presentation on Lock and Wait free architectures. If there is time of course. Julian -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwadej at anomaly.org Wed Aug 10 19:52:41 2016 From: gwadej at anomaly.org (G. Wade Johnson) Date: Wed, 10 Aug 2016 21:52:41 -0500 Subject: [pm-h] Houston.pm short presentations tomorrow night In-Reply-To: <20160810073540.6b8db08b@cygnus> References: <20160810073540.6b8db08b@cygnus> Message-ID: <20160810215241.4691adc7@cygnus> Updating for the latest information: - J.D. Lightsey, something cool - Todd Rinaldo, Perl CVE-2016-1238 - Robert Stone, Design discussion (potential) - Wade Johnson, Using Perl to do 2-color 3D Printing - Julian Brown, Lock and Wait free architectures - Other? G. Wade PS. If anyone else would like to be on the list, let me know. -- You should never hand someone a gun unless you're sure where they'll point it. -- Jeffrey Sinclair in "By Any Means Necessary" From drzigman at drzigman.com Thu Aug 11 06:53:50 2016 From: drzigman at drzigman.com (Robert Stone) Date: Thu, 11 Aug 2016 08:53:50 -0500 Subject: [pm-h] Houston.pm short presentations tomorrow night In-Reply-To: <20160810215241.4691adc7@cygnus> References: <20160810073540.6b8db08b@cygnus> <20160810215241.4691adc7@cygnus> Message-ID: Greetings, Just letting folks know that I'm on track for discussing "Object" vs "Data" Driven modeling tonight. This is a conversation I've really been looking forward to having and it should stimulate some great discussion on "the right way" to structure your models. Given all the other topics also on the schedule, should be an exciting night! Best Regards, On Wed, Aug 10, 2016 at 9:52 PM, G. Wade Johnson via Houston wrote: > Updating for the latest information: > > - J.D. Lightsey, something cool > - Todd Rinaldo, Perl CVE-2016-1238 > - Robert Stone, Design discussion (potential) > - Wade Johnson, Using Perl to do 2-color 3D Printing > - Julian Brown, Lock and Wait free architectures > - Other? > > G. Wade > > PS. If anyone else would like to be on the list, let me know. > -- > You should never hand someone a gun unless you're sure where they'll > point it. -- Jeffrey Sinclair in "By Any Means Necessary" > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From drzigman at drzigman.com Fri Aug 12 16:35:09 2016 From: drzigman at drzigman.com (Robert Stone) Date: Fri, 12 Aug 2016 18:35:09 -0500 Subject: [pm-h] Job Posting - BrainStorm Incubator - Junior Perl Developer Message-ID: Greetings, For those of you not currently seeking employment, my apologies. Please feel free to disregard this message. Still reading? Great! I am looking for a Junior Perl Developer to join my team. If you are new to Perl or new to Software Development in general this could be an excellent opportunity for you to get your feet wet, work one on one with a Senior Developer, make some money, and work on some very interesting and exciting problems as you jump start your career! BrainStorm Incubator is a small technology based start up that is full of great ideas but short on talent in order to turn those ideas into a reality. The technology stack we work with includes: - Perl! (duh) - Moose - DBIx - Dancer - Mojolicious - MySQL - Websockets - SASS - Javascript - Backbone - StickIt - Bootstrap - Underscore - Amazon Web Services - Auto Scaling Groups - S3 - EC2 If any of that doesn't sound familiar don't worry, I am happy to train and help you build up your Perl Chops as we work towards global domination together. Mwwwwhahahaha! This is a full time position with all the benefits you've come to know and love ( vacation, retirement, health care ) as well company provided hardware and office space. Sadly, this is not a remote position so you'll need to be local in the Houston area. Responsibilities for the position include: - Attending Perl Mongers Meetings! - Implement Database Schemas, Models, and APIs from UML diagrams. - This is the part that can be great for a junior developer. You'll get a lot of code reviews to help you learn and grow as well as getting to know a range of different technologies. - Learn by doing! - Creating test coverage for new code - Test Driven Development can be quite powerful and allows you to take full advantage of the incredibly advanced testing framework Perl affords us. - Documentation - Contributing to Open Source Projects - Using git for Version Control For the right person this could be an excellent opportunity and I invite you to send me a resume and a code sample if you have one. I'm also happy to discuss in further detail the sort of work you would be doing, compensation, and the projects that I have lined up for anyone interested. Please reply directly to me at robert.stone at brainstormincubator.com and I look forward to hearing from you. Thank you everyone for allowing me to reach out and thank you for taking the time to consider this position. I'll see everyone at our next meeting. Best Regards, Robert Stone -------------- next part -------------- An HTML attachment was scrubbed... URL: From toddr at cpanel.net Fri Aug 12 17:33:53 2016 From: toddr at cpanel.net (Todd Rinaldo) Date: Fri, 12 Aug 2016 19:33:53 -0500 Subject: [pm-h] Missing Charger Message-ID: <229EDA8E-B467-4843-8EA9-D413A90200B6@cpanel.net> I seem to have left my laptop's charger at Hostgator Thursday. Is there anyone at Hostgator who might be able to email me offline and help me with getting it back? Thanks, Todd From anaremore at hostgator.com Wed Aug 17 08:29:39 2016 From: anaremore at hostgator.com (Austin Naremore) Date: Wed, 17 Aug 2016 10:29:39 -0500 Subject: [pm-h] Missing Charger In-Reply-To: <229EDA8E-B467-4843-8EA9-D413A90200B6@cpanel.net> References: <229EDA8E-B467-4843-8EA9-D413A90200B6@cpanel.net> Message-ID: Todd, Oh no! I was out on PTO and just now saw this. I'll ask front desk folks etc. Please email me contact info directly to anaremore at hostgator.com and I'll follow up with you. On Fri, Aug 12, 2016 at 7:33 PM, Todd Rinaldo via Houston wrote: > I seem to have left my laptop's charger at Hostgator Thursday. Is there > anyone at Hostgator who might be able to email me offline and help me with > getting it back? > > Thanks, > Todd > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > -- *Austin Naremore*HTX Development Manager HostGator.com anaremore at hostgator.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From drzigman at drzigman.com Tue Aug 23 12:02:21 2016 From: drzigman at drzigman.com (Robert Stone) Date: Tue, 23 Aug 2016 14:02:21 -0500 Subject: [pm-h] Using Moose Attributes In Regular Expressions - Question Regarding Magic ${\( ... )} Message-ID: Greetings, I find myself needing to use the value of a Moose Attribute in a regular expression every now and then. Typically I accomplish this via (warning that all examples are very contrived and may contain bugs): *Sample Using Variable Assignment First* my $value = $my_moose_object->attribute; if( $some_value =~ m/\Q$value/ ) { Needless to say this isn't the most efficient/easiest to work with. Given that fact, I've come across a way of using Moose Attributes directly in regular expressions: *MyObject* package MyObject; use Moose; has foo => ( is => 'ro', isa => 'Str' ); ...; *Script That Consumes MyObject* my $object = MyObject->new( foo => 'Value' ); if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { This works, but frankly I'm not entirely certain why. From the documentation at http://perldoc.perl.org/perlre.html#Regular-Expressions I have: \Q quote (disable) pattern metacharacters until \E \E end either case modification or quoted section, think vi Great, that makes sense. But what magic is the ${\( ... )} doing here? I'd be most grateful if anyone had some insight and could share it with us! Best Regards, Robert Stone -------------- next part -------------- An HTML attachment was scrubbed... URL: From jlbprof at gmail.com Tue Aug 23 12:19:17 2016 From: jlbprof at gmail.com (Julian Brown) Date: Tue, 23 Aug 2016 14:19:17 -0500 Subject: [pm-h] Using Moose Attributes In Regular Expressions - Question Regarding Magic ${\( ... )} In-Reply-To: References: Message-ID: I am not familiar with Moose, but am not convinced this is specific to Moose. I assume $object->foo is really a method call that returns the foo attribute? Or is it like a hash value? ? [root at julian64:~/work]# cat doit.pl #!/usr/local/cpanel/3rdparty/bin/perl use strict; use warnings; my $var = "A"; my $var_ref = \$var; print "VAR :${var}:\n"; print "VAR VAR :${$var_ref}:\n"; Output is: VAR :A: VAR VAR :A: I think we are in the same realm perhaps the parens inside the ${} is necessary to execute the method? Julian On Tue, Aug 23, 2016 at 2:02 PM, Robert Stone via Houston wrote: > Greetings, > > I find myself needing to use the value of a Moose Attribute in a regular > expression every now and then. Typically I accomplish this via (warning > that all examples are very contrived and may contain bugs): > > *Sample Using Variable Assignment First* > > my $value = $my_moose_object->attribute; > if( $some_value =~ m/\Q$value/ ) { > > Needless to say this isn't the most efficient/easiest to work with. Given > that fact, I've come across a way of using Moose Attributes directly in > regular expressions: > > *MyObject* > > package MyObject; > > use Moose; > > has foo => ( is => 'ro', isa => 'Str' ); > > ...; > > *Script That Consumes MyObject* > > my $object = MyObject->new( foo => 'Value' ); > if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > > This works, but frankly I'm not entirely certain why. From the > documentation at http://perldoc.perl.org/perlre.html#Regular-Expressions > I have: > > \Q quote (disable) pattern metacharacters until \E > \E end either case modification or quoted section, think vi > > Great, that makes sense. > > But what magic is the ${\( ... )} doing here? I'd be most grateful if > anyone had some insight and could share it with us! > > Best Regards, > Robert Stone > > > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From drzigman at drzigman.com Tue Aug 23 12:35:38 2016 From: drzigman at drzigman.com (Robert Stone) Date: Tue, 23 Aug 2016 14:35:38 -0500 Subject: [pm-h] Using Moose Attributes In Regular Expressions - Question Regarding Magic ${\( ... )} In-Reply-To: References: Message-ID: Greetings, You are correct in the sense that $object->foo actually calls a method "foo" created via Moose Magic that returns the value of the foo attribute. Good call! Are you thinking that given the above, the \( ) business makes $object->foo a coderef, and then ${ } executes it because it dereferences it? Given that, why does this not match: if( $some_value =~ m/\Q$object->foo\E/ ) { While this does: if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { Is that ${ } "protecting" the $object->foo so that the regex engine doesn't see it as regex-y? Best Regards, Robert Stone On Tue, Aug 23, 2016 at 2:19 PM, Julian Brown via Houston wrote: > I am not familiar with Moose, but am not convinced this is specific to > Moose. > > I assume $object->foo is really a method call that returns the foo > attribute? Or is it like a hash value? > > > ? [root at julian64:~/work]# cat doit.pl > #!/usr/local/cpanel/3rdparty/bin/perl > > use strict; > use warnings; > > my $var = "A"; > my $var_ref = \$var; > > print "VAR :${var}:\n"; > print "VAR VAR :${$var_ref}:\n"; > > Output is: > > VAR :A: > VAR VAR :A: > > I think we are in the same realm perhaps the parens inside the ${} is > necessary to execute the method? > > Julian > > > > On Tue, Aug 23, 2016 at 2:02 PM, Robert Stone via Houston > wrote: > >> Greetings, >> >> I find myself needing to use the value of a Moose Attribute in a regular >> expression every now and then. Typically I accomplish this via (warning >> that all examples are very contrived and may contain bugs): >> >> *Sample Using Variable Assignment First* >> >> my $value = $my_moose_object->attribute; >> if( $some_value =~ m/\Q$value/ ) { >> >> Needless to say this isn't the most efficient/easiest to work with. >> Given that fact, I've come across a way of using Moose Attributes directly >> in regular expressions: >> >> *MyObject* >> >> package MyObject; >> >> use Moose; >> >> has foo => ( is => 'ro', isa => 'Str' ); >> >> ...; >> >> *Script That Consumes MyObject* >> >> my $object = MyObject->new( foo => 'Value' ); >> if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { >> >> >> This works, but frankly I'm not entirely certain why. From the >> documentation at http://perldoc.perl.org/perlre.html#Regular-Expressions >> I have: >> >> \Q quote (disable) pattern metacharacters until \E >> \E end either case modification or quoted section, think vi >> >> Great, that makes sense. >> >> But what magic is the ${\( ... )} doing here? I'd be most grateful if >> anyone had some insight and could share it with us! >> >> Best Regards, >> Robert Stone >> >> >> >> _______________________________________________ >> Houston mailing list >> Houston at pm.org >> http://mail.pm.org/mailman/listinfo/houston >> Website: http://houston.pm.org/ >> > > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zaki.mughal at gmail.com Tue Aug 23 12:57:09 2016 From: zaki.mughal at gmail.com (Zakariyya Mughal) Date: Tue, 23 Aug 2016 14:57:09 -0500 Subject: [pm-h] Using Moose Attributes In Regular Expressions - Question Regarding Magic ${\( ... )} In-Reply-To: References: Message-ID: <20160823195709.GA9008@simulo> On 2016-08-23 at 14:35:38 -0500, Robert Stone via Houston wrote: > Greetings, > > You are correct in the sense that $object->foo actually calls a method > "foo" created via Moose Magic that returns the value of the foo attribute. > Good call! > > Are you thinking that given the above, the \( ) business makes $object->foo > a coderef, and then ${ } executes it because it dereferences it? Given > that, why does this not match: > > if( $some_value =~ m/\Q$object->foo\E/ ) { > > While this does: > > if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > Is that ${ } "protecting" the $object->foo so that the regex engine doesn't > see it as regex-y? Not a coderef, but a scalar ref. It is similar to the approach used by the baby cart operator: . @{[ ]} Reading inside out: - [ ... ] : turn into an ArrayRef - @{ ... } : circumfix ArrayRef dereference So that approach for the regexp does: - \ ... : turn into a reference (unary \ operator) - ${ ... } : circumfix ScalarRef dereference I use the baby cart operator enough that I have added a line in my vimrc to make it work with surround.vim: . Cheers, - Zaki Mughal > > Best Regards, > Robert Stone > > On Tue, Aug 23, 2016 at 2:19 PM, Julian Brown via Houston > wrote: > > > I am not familiar with Moose, but am not convinced this is specific to > > Moose. > > > > I assume $object->foo is really a method call that returns the foo > > attribute? Or is it like a hash value? > > > > > > ? [root at julian64:~/work]# cat doit.pl > > #!/usr/local/cpanel/3rdparty/bin/perl > > > > use strict; > > use warnings; > > > > my $var = "A"; > > my $var_ref = \$var; > > > > print "VAR :${var}:\n"; > > print "VAR VAR :${$var_ref}:\n"; > > > > Output is: > > > > VAR :A: > > VAR VAR :A: > > > > I think we are in the same realm perhaps the parens inside the ${} is > > necessary to execute the method? > > > > Julian > > > > > > > > On Tue, Aug 23, 2016 at 2:02 PM, Robert Stone via Houston > > wrote: > > > >> Greetings, > >> > >> I find myself needing to use the value of a Moose Attribute in a regular > >> expression every now and then. Typically I accomplish this via (warning > >> that all examples are very contrived and may contain bugs): > >> > >> *Sample Using Variable Assignment First* > >> > >> my $value = $my_moose_object->attribute; > >> if( $some_value =~ m/\Q$value/ ) { > >> > >> Needless to say this isn't the most efficient/easiest to work with. > >> Given that fact, I've come across a way of using Moose Attributes directly > >> in regular expressions: > >> > >> *MyObject* > >> > >> package MyObject; > >> > >> use Moose; > >> > >> has foo => ( is => 'ro', isa => 'Str' ); > >> > >> ...; > >> > >> *Script That Consumes MyObject* > >> > >> my $object = MyObject->new( foo => 'Value' ); > >> if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > >> > >> > >> This works, but frankly I'm not entirely certain why. From the > >> documentation at http://perldoc.perl.org/perlre.html#Regular-Expressions > >> I have: > >> > >> \Q quote (disable) pattern metacharacters until \E > >> \E end either case modification or quoted section, think vi > >> > >> Great, that makes sense. > >> > >> But what magic is the ${\( ... )} doing here? I'd be most grateful if > >> anyone had some insight and could share it with us! > >> > >> Best Regards, > >> Robert Stone > >> > >> > >> > >> _______________________________________________ > >> Houston mailing list > >> Houston at pm.org > >> http://mail.pm.org/mailman/listinfo/houston > >> Website: http://houston.pm.org/ > >> > > > > > > _______________________________________________ > > Houston mailing list > > Houston at pm.org > > http://mail.pm.org/mailman/listinfo/houston > > Website: http://houston.pm.org/ > > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ From drzigman at drzigman.com Tue Aug 23 13:16:42 2016 From: drzigman at drzigman.com (Robert Stone) Date: Tue, 23 Aug 2016 15:16:42 -0500 Subject: [pm-h] Using Moose Attributes In Regular Expressions - Question Regarding Magic ${\( ... )} In-Reply-To: <20160823195709.GA9008@simulo> References: <20160823195709.GA9008@simulo> Message-ID: Greetings, Wow, https://metacpan.org/pod/distribution/perlsecret/lib/perlsecret.pod is a treasure trove of goodies! Thanks for sharing that. I believe this is the part of the documentation that stands out to me as most relevant: *This is a container, or circumfix operator. The expression inside the [] is run in list context, stored in an anonymous array, which is immediately dereferenced by @{}.* The "trick" here, as you pointed out, is the ${ } circumfix ScalarRef dereference. However, in order to use it we have to have, unsurprisingly, a ScalarRef, hence the need for \( ) to convert the return value of $object->foo first into a ScalarRef and then usage of ${ } for both dereferencing it back and that tasty circumfixing action (which is higher in precedence then the regex-ing, which is why this code snippet works)! Does that sound about right? Best Regards, Robert Stone On Tue, Aug 23, 2016 at 2:57 PM, Zakariyya Mughal wrote: > On 2016-08-23 at 14:35:38 -0500, Robert Stone via Houston wrote: > > Greetings, > > > > You are correct in the sense that $object->foo actually calls a method > > "foo" created via Moose Magic that returns the value of the foo > attribute. > > Good call! > > > > Are you thinking that given the above, the \( ) business makes > $object->foo > > a coderef, and then ${ } executes it because it dereferences it? Given > > that, why does this not match: > > > > if( $some_value =~ m/\Q$object->foo\E/ ) { > > > > While this does: > > > > if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > > > Is that ${ } "protecting" the $object->foo so that the regex engine > doesn't > > see it as regex-y? > > Not a coderef, but a scalar ref. It is similar to the approach used by > the baby cart operator: . > > @{[ ]} > > Reading inside out: > > - [ ... ] : turn into an ArrayRef > - @{ ... } : circumfix ArrayRef dereference > > So that approach for the regexp does: > > - \ ... : turn into a reference (unary \ operator) > - ${ ... } : circumfix ScalarRef dereference > > I use the baby cart operator enough that I have added a line in my vimrc > to make it work with surround.vim: vimrc/commit/ad7894dcbe273b0ecb9703db88b51aa9a33d7f0c>. > > Cheers, > - Zaki Mughal > > > > > Best Regards, > > Robert Stone > > > > On Tue, Aug 23, 2016 at 2:19 PM, Julian Brown via Houston < > houston at pm.org> > > wrote: > > > > > I am not familiar with Moose, but am not convinced this is specific to > > > Moose. > > > > > > I assume $object->foo is really a method call that returns the foo > > > attribute? Or is it like a hash value? > > > > > > > > > ? [root at julian64:~/work]# cat doit.pl > > > #!/usr/local/cpanel/3rdparty/bin/perl > > > > > > use strict; > > > use warnings; > > > > > > my $var = "A"; > > > my $var_ref = \$var; > > > > > > print "VAR :${var}:\n"; > > > print "VAR VAR :${$var_ref}:\n"; > > > > > > Output is: > > > > > > VAR :A: > > > VAR VAR :A: > > > > > > I think we are in the same realm perhaps the parens inside the ${} is > > > necessary to execute the method? > > > > > > Julian > > > > > > > > > > > > On Tue, Aug 23, 2016 at 2:02 PM, Robert Stone via Houston < > houston at pm.org> > > > wrote: > > > > > >> Greetings, > > >> > > >> I find myself needing to use the value of a Moose Attribute in a > regular > > >> expression every now and then. Typically I accomplish this via > (warning > > >> that all examples are very contrived and may contain bugs): > > >> > > >> *Sample Using Variable Assignment First* > > >> > > >> my $value = $my_moose_object->attribute; > > >> if( $some_value =~ m/\Q$value/ ) { > > >> > > >> Needless to say this isn't the most efficient/easiest to work with. > > >> Given that fact, I've come across a way of using Moose Attributes > directly > > >> in regular expressions: > > >> > > >> *MyObject* > > >> > > >> package MyObject; > > >> > > >> use Moose; > > >> > > >> has foo => ( is => 'ro', isa => 'Str' ); > > >> > > >> ...; > > >> > > >> *Script That Consumes MyObject* > > >> > > >> my $object = MyObject->new( foo => 'Value' ); > > >> if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > >> > > >> > > >> This works, but frankly I'm not entirely certain why. From the > > >> documentation at http://perldoc.perl.org/perlre.html#Regular- > Expressions > > >> I have: > > >> > > >> \Q quote (disable) pattern metacharacters until \E > > >> \E end either case modification or quoted section, think vi > > >> > > >> Great, that makes sense. > > >> > > >> But what magic is the ${\( ... )} doing here? I'd be most grateful if > > >> anyone had some insight and could share it with us! > > >> > > >> Best Regards, > > >> Robert Stone > > >> > > >> > > >> > > >> _______________________________________________ > > >> Houston mailing list > > >> Houston at pm.org > > >> http://mail.pm.org/mailman/listinfo/houston > > >> Website: http://houston.pm.org/ > > >> > > > > > > > > > _______________________________________________ > > > Houston mailing list > > > Houston at pm.org > > > http://mail.pm.org/mailman/listinfo/houston > > > Website: http://houston.pm.org/ > > > > > > _______________________________________________ > > Houston mailing list > > Houston at pm.org > > http://mail.pm.org/mailman/listinfo/houston > > Website: http://houston.pm.org/ > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From zaki.mughal at gmail.com Tue Aug 23 14:08:17 2016 From: zaki.mughal at gmail.com (Zakariyya Mughal) Date: Tue, 23 Aug 2016 16:08:17 -0500 Subject: [pm-h] Using Moose Attributes In Regular Expressions - Question Regarding Magic ${\( ... )} In-Reply-To: References: <20160823195709.GA9008@simulo> Message-ID: <20160823210817.GB9008@simulo> On 2016-08-23 at 15:16:42 -0500, Robert Stone wrote: > Greetings, > > Wow, https://metacpan.org/pod/distribution/perlsecret/lib/perlsecret.pod is > a treasure trove of goodies! Thanks for sharing that. > > I believe this is the part of the documentation that stands out to me as > most relevant: > > *This is a container, or circumfix operator. The expression inside > the [] is run in list context, stored in an anonymous array, which is > immediately dereferenced by @{}.* > > The "trick" here, as you pointed out, is the ${ } circumfix ScalarRef > dereference. However, in order to use it we have to have, unsurprisingly, > a ScalarRef, hence the need for \( ) to convert the return value of > $object->foo first into a ScalarRef and then usage of ${ } for both > dereferencing it back and that tasty circumfixing action (which is higher > in precedence then the regex-ing, which is why this code snippet works)! > > Does that sound about right? Yep! However, I believe that the `${}` evaluation inside of `m//` is due to interpolation rather than precedence. In `perldoc perlop`, Perl puts terms (e.g., quote-like operators and variables) higher than anything else and these get processed left to right. You can also used B::Concise to see how Perl parses the expression: perl -MO=Concise -e 'qr/before\Q${\( $object->foo )}\Eafter/;' Really fascinating stuff to play around with! Cheers, - Zaki Mughal > > Best Regards, > Robert Stone > > On Tue, Aug 23, 2016 at 2:57 PM, Zakariyya Mughal > wrote: > > > On 2016-08-23 at 14:35:38 -0500, Robert Stone via Houston wrote: > > > Greetings, > > > > > > You are correct in the sense that $object->foo actually calls a method > > > "foo" created via Moose Magic that returns the value of the foo > > attribute. > > > Good call! > > > > > > Are you thinking that given the above, the \( ) business makes > > $object->foo > > > a coderef, and then ${ } executes it because it dereferences it? Given > > > that, why does this not match: > > > > > > if( $some_value =~ m/\Q$object->foo\E/ ) { > > > > > > While this does: > > > > > > if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > > > > > Is that ${ } "protecting" the $object->foo so that the regex engine > > doesn't > > > see it as regex-y? > > > > Not a coderef, but a scalar ref. It is similar to the approach used by > > the baby cart operator: . > > > > @{[ ]} > > > > Reading inside out: > > > > - [ ... ] : turn into an ArrayRef > > - @{ ... } : circumfix ArrayRef dereference > > > > So that approach for the regexp does: > > > > - \ ... : turn into a reference (unary \ operator) > > - ${ ... } : circumfix ScalarRef dereference > > > > I use the baby cart operator enough that I have added a line in my vimrc > > to make it work with surround.vim: > vimrc/commit/ad7894dcbe273b0ecb9703db88b51aa9a33d7f0c>. > > > > Cheers, > > - Zaki Mughal > > > > > > > > Best Regards, > > > Robert Stone > > > > > > On Tue, Aug 23, 2016 at 2:19 PM, Julian Brown via Houston < > > houston at pm.org> > > > wrote: > > > > > > > I am not familiar with Moose, but am not convinced this is specific to > > > > Moose. > > > > > > > > I assume $object->foo is really a method call that returns the foo > > > > attribute? Or is it like a hash value? > > > > > > > > > > > > ? [root at julian64:~/work]# cat doit.pl > > > > #!/usr/local/cpanel/3rdparty/bin/perl > > > > > > > > use strict; > > > > use warnings; > > > > > > > > my $var = "A"; > > > > my $var_ref = \$var; > > > > > > > > print "VAR :${var}:\n"; > > > > print "VAR VAR :${$var_ref}:\n"; > > > > > > > > Output is: > > > > > > > > VAR :A: > > > > VAR VAR :A: > > > > > > > > I think we are in the same realm perhaps the parens inside the ${} is > > > > necessary to execute the method? > > > > > > > > Julian > > > > > > > > > > > > > > > > On Tue, Aug 23, 2016 at 2:02 PM, Robert Stone via Houston < > > houston at pm.org> > > > > wrote: > > > > > > > >> Greetings, > > > >> > > > >> I find myself needing to use the value of a Moose Attribute in a > > regular > > > >> expression every now and then. Typically I accomplish this via > > (warning > > > >> that all examples are very contrived and may contain bugs): > > > >> > > > >> *Sample Using Variable Assignment First* > > > >> > > > >> my $value = $my_moose_object->attribute; > > > >> if( $some_value =~ m/\Q$value/ ) { > > > >> > > > >> Needless to say this isn't the most efficient/easiest to work with. > > > >> Given that fact, I've come across a way of using Moose Attributes > > directly > > > >> in regular expressions: > > > >> > > > >> *MyObject* > > > >> > > > >> package MyObject; > > > >> > > > >> use Moose; > > > >> > > > >> has foo => ( is => 'ro', isa => 'Str' ); > > > >> > > > >> ...; > > > >> > > > >> *Script That Consumes MyObject* > > > >> > > > >> my $object = MyObject->new( foo => 'Value' ); > > > >> if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > > >> > > > >> > > > >> This works, but frankly I'm not entirely certain why. From the > > > >> documentation at http://perldoc.perl.org/perlre.html#Regular- > > Expressions > > > >> I have: > > > >> > > > >> \Q quote (disable) pattern metacharacters until \E > > > >> \E end either case modification or quoted section, think vi > > > >> > > > >> Great, that makes sense. > > > >> > > > >> But what magic is the ${\( ... )} doing here? I'd be most grateful if > > > >> anyone had some insight and could share it with us! > > > >> > > > >> Best Regards, > > > >> Robert Stone > > > >> > > > >> > > > >> > > > >> _______________________________________________ > > > >> Houston mailing list > > > >> Houston at pm.org > > > >> http://mail.pm.org/mailman/listinfo/houston > > > >> Website: http://houston.pm.org/ > > > >> > > > > > > > > > > > > _______________________________________________ > > > > Houston mailing list > > > > Houston at pm.org > > > > http://mail.pm.org/mailman/listinfo/houston > > > > Website: http://houston.pm.org/ > > > > > > > > > _______________________________________________ > > > Houston mailing list > > > Houston at pm.org > > > http://mail.pm.org/mailman/listinfo/houston > > > Website: http://houston.pm.org/ > > > > From jlbprof at gmail.com Tue Aug 23 15:01:43 2016 From: jlbprof at gmail.com (Julian Brown) Date: Tue, 23 Aug 2016 17:01:43 -0500 Subject: [pm-h] Using Moose Attributes In Regular Expressions - Question Regarding Magic ${\( ... )} In-Reply-To: <20160823210817.GB9008@simulo> References: <20160823195709.GA9008@simulo> <20160823210817.GB9008@simulo> Message-ID: I need to know if I am an "old" dog trying to learn new tricks. -------------------------------------- $ cat ./doit.pl #!/usr/bin/perl use strict; use warnings; my $ref = \( "a", "b" ); print ":$ref:\n"; print ":${$ref}:\n"; my $other = ("a", "b"); print "other :$other:\n"; $ ./doit.pl Useless use of a constant (a) in void context at ./doit.pl line 11. :SCALAR(0xaf9998): :b: other :b: -------------------------------------- This is what confused me \( ). I think I am learning a new thing (not a trick). The "use warnings" is enlightening. I never really ever used a list in a scalar context before, in a scalar context it always returns the last item. The warning is telling me that I am essentially throwing away the value of "a". Julian On Tue, Aug 23, 2016 at 4:08 PM, Zakariyya Mughal via Houston < houston at pm.org> wrote: > On 2016-08-23 at 15:16:42 -0500, Robert Stone wrote: > > Greetings, > > > > Wow, https://metacpan.org/pod/distribution/perlsecret/lib/perlsecret.pod > is > > a treasure trove of goodies! Thanks for sharing that. > > > > I believe this is the part of the documentation that stands out to me as > > most relevant: > > > > *This is a container, or circumfix operator. The expression > inside > > the [] is run in list context, stored in an anonymous array, which is > > immediately dereferenced by @{}.* > > > > The "trick" here, as you pointed out, is the ${ } circumfix ScalarRef > > dereference. However, in order to use it we have to have, > unsurprisingly, > > a ScalarRef, hence the need for \( ) to convert the return value of > > $object->foo first into a ScalarRef and then usage of ${ } for both > > dereferencing it back and that tasty circumfixing action (which is higher > > in precedence then the regex-ing, which is why this code snippet works)! > > > > Does that sound about right? > > Yep! However, I believe that the `${}` evaluation inside of `m//` is due > to interpolation rather than precedence. In `perldoc perlop`, Perl puts > terms > (e.g., quote-like operators and variables) higher than anything else and > these get processed left to right. > > You can also used B::Concise to see how Perl parses the expression: > > perl -MO=Concise -e 'qr/before\Q${\( $object->foo )}\Eafter/;' > > Really fascinating stuff to play around with! > > Cheers, > - Zaki Mughal > > > > > Best Regards, > > Robert Stone > > > > On Tue, Aug 23, 2016 at 2:57 PM, Zakariyya Mughal > > > wrote: > > > > > On 2016-08-23 at 14:35:38 -0500, Robert Stone via Houston wrote: > > > > Greetings, > > > > > > > > You are correct in the sense that $object->foo actually calls a > method > > > > "foo" created via Moose Magic that returns the value of the foo > > > attribute. > > > > Good call! > > > > > > > > Are you thinking that given the above, the \( ) business makes > > > $object->foo > > > > a coderef, and then ${ } executes it because it dereferences it? > Given > > > > that, why does this not match: > > > > > > > > if( $some_value =~ m/\Q$object->foo\E/ ) { > > > > > > > > While this does: > > > > > > > > if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > > > > > > > Is that ${ } "protecting" the $object->foo so that the regex engine > > > doesn't > > > > see it as regex-y? > > > > > > Not a coderef, but a scalar ref. It is similar to the approach used by > > > the baby cart operator: >. > > > > > > @{[ ]} > > > > > > Reading inside out: > > > > > > - [ ... ] : turn into an ArrayRef > > > - @{ ... } : circumfix ArrayRef dereference > > > > > > So that approach for the regexp does: > > > > > > - \ ... : turn into a reference (unary \ operator) > > > - ${ ... } : circumfix ScalarRef dereference > > > > > > I use the baby cart operator enough that I have added a line in my > vimrc > > > to make it work with surround.vim: > > vimrc/commit/ad7894dcbe273b0ecb9703db88b51aa9a33d7f0c>. > > > > > > Cheers, > > > - Zaki Mughal > > > > > > > > > > > Best Regards, > > > > Robert Stone > > > > > > > > On Tue, Aug 23, 2016 at 2:19 PM, Julian Brown via Houston < > > > houston at pm.org> > > > > wrote: > > > > > > > > > I am not familiar with Moose, but am not convinced this is > specific to > > > > > Moose. > > > > > > > > > > I assume $object->foo is really a method call that returns the foo > > > > > attribute? Or is it like a hash value? > > > > > > > > > > > > > > > ? [root at julian64:~/work]# cat doit.pl > > > > > #!/usr/local/cpanel/3rdparty/bin/perl > > > > > > > > > > use strict; > > > > > use warnings; > > > > > > > > > > my $var = "A"; > > > > > my $var_ref = \$var; > > > > > > > > > > print "VAR :${var}:\n"; > > > > > print "VAR VAR :${$var_ref}:\n"; > > > > > > > > > > Output is: > > > > > > > > > > VAR :A: > > > > > VAR VAR :A: > > > > > > > > > > I think we are in the same realm perhaps the parens inside the ${} > is > > > > > necessary to execute the method? > > > > > > > > > > Julian > > > > > > > > > > > > > > > > > > > > On Tue, Aug 23, 2016 at 2:02 PM, Robert Stone via Houston < > > > houston at pm.org> > > > > > wrote: > > > > > > > > > >> Greetings, > > > > >> > > > > >> I find myself needing to use the value of a Moose Attribute in a > > > regular > > > > >> expression every now and then. Typically I accomplish this via > > > (warning > > > > >> that all examples are very contrived and may contain bugs): > > > > >> > > > > >> *Sample Using Variable Assignment First* > > > > >> > > > > >> my $value = $my_moose_object->attribute; > > > > >> if( $some_value =~ m/\Q$value/ ) { > > > > >> > > > > >> Needless to say this isn't the most efficient/easiest to work > with. > > > > >> Given that fact, I've come across a way of using Moose Attributes > > > directly > > > > >> in regular expressions: > > > > >> > > > > >> *MyObject* > > > > >> > > > > >> package MyObject; > > > > >> > > > > >> use Moose; > > > > >> > > > > >> has foo => ( is => 'ro', isa => 'Str' ); > > > > >> > > > > >> ...; > > > > >> > > > > >> *Script That Consumes MyObject* > > > > >> > > > > >> my $object = MyObject->new( foo => 'Value' ); > > > > >> if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > > > >> > > > > >> > > > > >> This works, but frankly I'm not entirely certain why. From the > > > > >> documentation at http://perldoc.perl.org/perlre.html#Regular- > > > Expressions > > > > >> I have: > > > > >> > > > > >> \Q quote (disable) pattern metacharacters until \E > > > > >> \E end either case modification or quoted section, think > vi > > > > >> > > > > >> Great, that makes sense. > > > > >> > > > > >> But what magic is the ${\( ... )} doing here? I'd be most > grateful if > > > > >> anyone had some insight and could share it with us! > > > > >> > > > > >> Best Regards, > > > > >> Robert Stone > > > > >> > > > > >> > > > > >> > > > > >> _______________________________________________ > > > > >> Houston mailing list > > > > >> Houston at pm.org > > > > >> http://mail.pm.org/mailman/listinfo/houston > > > > >> Website: http://houston.pm.org/ > > > > >> > > > > > > > > > > > > > > > _______________________________________________ > > > > > Houston mailing list > > > > > Houston at pm.org > > > > > http://mail.pm.org/mailman/listinfo/houston > > > > > Website: http://houston.pm.org/ > > > > > > > > > > > > _______________________________________________ > > > > Houston mailing list > > > > Houston at pm.org > > > > http://mail.pm.org/mailman/listinfo/houston > > > > Website: http://houston.pm.org/ > > > > > > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ryeddula86 at gmail.com Tue Aug 23 19:04:41 2016 From: ryeddula86 at gmail.com (Rishwanth Yeddula) Date: Wed, 24 Aug 2016 02:04:41 +0000 Subject: [pm-h] Using Moose Attributes In Regular Expressions - Question Regarding Magic ${\( ... )} In-Reply-To: References: <20160823195709.GA9008@simulo> <20160823210817.GB9008@simulo> Message-ID: This blog post by mst covers this "madness" in some detail: http://shadow.cat/blog/matt-s-trout/madness-with-methods/ The code blocks seem to be borked cause of the new theme his site is using though... On Tue, Aug 23, 2016 at 5:01 PM Julian Brown via Houston wrote: > I need to know if I am an "old" dog trying to learn new tricks. > > -------------------------------------- > $ cat ./doit.pl > #!/usr/bin/perl > > use strict; > use warnings; > > my $ref = \( "a", "b" ); > > print ":$ref:\n"; > print ":${$ref}:\n"; > > my $other = ("a", "b"); > > print "other :$other:\n"; > > $ ./doit.pl > Useless use of a constant (a) in void context at ./doit.pl line 11. > :SCALAR(0xaf9998): > :b: > other :b: > -------------------------------------- > > This is what confused me \( ). > > I think I am learning a new thing (not a trick). > > The "use warnings" is enlightening. > > I never really ever used a list in a scalar context before, in a scalar > context it always returns the last item. The warning is telling me that I > am essentially throwing away the value of "a". > > Julian > > > > On Tue, Aug 23, 2016 at 4:08 PM, Zakariyya Mughal via Houston < > houston at pm.org> wrote: > >> On 2016-08-23 at 15:16:42 -0500, Robert Stone wrote: >> > Greetings, >> > >> > Wow, >> https://metacpan.org/pod/distribution/perlsecret/lib/perlsecret.pod is >> > a treasure trove of goodies! Thanks for sharing that. >> > >> > I believe this is the part of the documentation that stands out to me as >> > most relevant: >> > >> > *This is a container, or circumfix operator. The expression >> inside >> > the [] is run in list context, stored in an anonymous array, which is >> > immediately dereferenced by @{}.* >> > >> > The "trick" here, as you pointed out, is the ${ } circumfix ScalarRef >> > dereference. However, in order to use it we have to have, >> unsurprisingly, >> > a ScalarRef, hence the need for \( ) to convert the return value of >> > $object->foo first into a ScalarRef and then usage of ${ } for both >> > dereferencing it back and that tasty circumfixing action (which is >> higher >> > in precedence then the regex-ing, which is why this code snippet works)! >> > >> > Does that sound about right? >> >> Yep! However, I believe that the `${}` evaluation inside of `m//` is due >> to interpolation rather than precedence. In `perldoc perlop`, Perl puts >> terms >> (e.g., quote-like operators and variables) higher than anything else and >> these get processed left to right. >> >> You can also used B::Concise to see how Perl parses the expression: >> >> perl -MO=Concise -e 'qr/before\Q${\( $object->foo )}\Eafter/;' >> >> Really fascinating stuff to play around with! >> >> Cheers, >> - Zaki Mughal >> >> > >> > Best Regards, >> > Robert Stone >> > >> > On Tue, Aug 23, 2016 at 2:57 PM, Zakariyya Mughal < >> zaki.mughal at gmail.com> >> > wrote: >> > >> > > On 2016-08-23 at 14:35:38 -0500, Robert Stone via Houston wrote: >> > > > Greetings, >> > > > >> > > > You are correct in the sense that $object->foo actually calls a >> method >> > > > "foo" created via Moose Magic that returns the value of the foo >> > > attribute. >> > > > Good call! >> > > > >> > > > Are you thinking that given the above, the \( ) business makes >> > > $object->foo >> > > > a coderef, and then ${ } executes it because it dereferences it? >> Given >> > > > that, why does this not match: >> > > > >> > > > if( $some_value =~ m/\Q$object->foo\E/ ) { >> > > > >> > > > While this does: >> > > > >> > > > if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { >> > > > >> > > > Is that ${ } "protecting" the $object->foo so that the regex engine >> > > doesn't >> > > > see it as regex-y? >> > > >> > > Not a coderef, but a scalar ref. It is similar to the approach used by >> > > the baby cart operator: < >> https://metacpan.org/pod/perlsecret#Baby-cart>. >> > > >> > > @{[ ]} >> > > >> > > Reading inside out: >> > > >> > > - [ ... ] : turn into an ArrayRef >> > > - @{ ... } : circumfix ArrayRef dereference >> > > >> > > So that approach for the regexp does: >> > > >> > > - \ ... : turn into a reference (unary \ operator) >> > > - ${ ... } : circumfix ScalarRef dereference >> > > >> > > I use the baby cart operator enough that I have added a line in my >> vimrc >> > > to make it work with surround.vim: > > > vimrc/commit/ad7894dcbe273b0ecb9703db88b51aa9a33d7f0c>. >> > > >> > > Cheers, >> > > - Zaki Mughal >> > > >> > > > >> > > > Best Regards, >> > > > Robert Stone >> > > > >> > > > On Tue, Aug 23, 2016 at 2:19 PM, Julian Brown via Houston < >> > > houston at pm.org> >> > > > wrote: >> > > > >> > > > > I am not familiar with Moose, but am not convinced this is >> specific to >> > > > > Moose. >> > > > > >> > > > > I assume $object->foo is really a method call that returns the foo >> > > > > attribute? Or is it like a hash value? >> > > > > >> > > > > >> > > > > ? [root at julian64:~/work]# cat doit.pl >> > > > > #!/usr/local/cpanel/3rdparty/bin/perl >> > > > > >> > > > > use strict; >> > > > > use warnings; >> > > > > >> > > > > my $var = "A"; >> > > > > my $var_ref = \$var; >> > > > > >> > > > > print "VAR :${var}:\n"; >> > > > > print "VAR VAR :${$var_ref}:\n"; >> > > > > >> > > > > Output is: >> > > > > >> > > > > VAR :A: >> > > > > VAR VAR :A: >> > > > > >> > > > > I think we are in the same realm perhaps the parens inside the >> ${} is >> > > > > necessary to execute the method? >> > > > > >> > > > > Julian >> > > > > >> > > > > >> > > > > >> > > > > On Tue, Aug 23, 2016 at 2:02 PM, Robert Stone via Houston < >> > > houston at pm.org> >> > > > > wrote: >> > > > > >> > > > >> Greetings, >> > > > >> >> > > > >> I find myself needing to use the value of a Moose Attribute in a >> > > regular >> > > > >> expression every now and then. Typically I accomplish this via >> > > (warning >> > > > >> that all examples are very contrived and may contain bugs): >> > > > >> >> > > > >> *Sample Using Variable Assignment First* >> > > > >> >> > > > >> my $value = $my_moose_object->attribute; >> > > > >> if( $some_value =~ m/\Q$value/ ) { >> > > > >> >> > > > >> Needless to say this isn't the most efficient/easiest to work >> with. >> > > > >> Given that fact, I've come across a way of using Moose Attributes >> > > directly >> > > > >> in regular expressions: >> > > > >> >> > > > >> *MyObject* >> > > > >> >> > > > >> package MyObject; >> > > > >> >> > > > >> use Moose; >> > > > >> >> > > > >> has foo => ( is => 'ro', isa => 'Str' ); >> > > > >> >> > > > >> ...; >> > > > >> >> > > > >> *Script That Consumes MyObject* >> > > > >> >> > > > >> my $object = MyObject->new( foo => 'Value' ); >> > > > >> if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { >> > > > >> >> > > > >> >> > > > >> This works, but frankly I'm not entirely certain why. From the >> > > > >> documentation at http://perldoc.perl.org/perlre.html#Regular- >> > > Expressions >> > > > >> I have: >> > > > >> >> > > > >> \Q quote (disable) pattern metacharacters until \E >> > > > >> \E end either case modification or quoted section, >> think vi >> > > > >> >> > > > >> Great, that makes sense. >> > > > >> >> > > > >> But what magic is the ${\( ... )} doing here? I'd be most >> grateful if >> > > > >> anyone had some insight and could share it with us! >> > > > >> >> > > > >> Best Regards, >> > > > >> Robert Stone >> > > > >> >> > > > >> >> > > > >> >> > > > >> _______________________________________________ >> > > > >> Houston mailing list >> > > > >> Houston at pm.org >> > > > >> http://mail.pm.org/mailman/listinfo/houston >> > > > >> Website: http://houston.pm.org/ >> > > > >> >> > > > > >> > > > > >> > > > > _______________________________________________ >> > > > > Houston mailing list >> > > > > Houston at pm.org >> > > > > http://mail.pm.org/mailman/listinfo/houston >> > > > > Website: http://houston.pm.org/ >> > > > > >> > > >> > > > _______________________________________________ >> > > > Houston mailing list >> > > > Houston at pm.org >> > > > http://mail.pm.org/mailman/listinfo/houston >> > > > Website: http://houston.pm.org/ >> > > >> > > >> _______________________________________________ >> Houston mailing list >> Houston at pm.org >> http://mail.pm.org/mailman/listinfo/houston >> Website: http://houston.pm.org/ >> > > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From gwadej at anomaly.org Wed Aug 24 05:32:38 2016 From: gwadej at anomaly.org (G. Wade Johnson) Date: Wed, 24 Aug 2016 07:32:38 -0500 Subject: [pm-h] Using Moose Attributes In Regular Expressions - Question Regarding Magic ${\( ... )} In-Reply-To: References: <20160823195709.GA9008@simulo> <20160823210817.GB9008@simulo> Message-ID: <20160824073238.41d39d97@cygnus> It's fun watching people run through this odd piece of Perl magic. The descriptions by Zaki Mughal are right on target. Julian's example below covers one weird edge case though. \( "a", "b" ) does not give a reference to an array, it gives an array of references. The only explanations I've ever seen of that suggest that we already have [] for array ref, so \( ) should do something different. I've never used the scalar ref version of this interpolation trick before. I'll have to keep it in mind. G. Wade On Tue, 23 Aug 2016 17:01:43 -0500 Julian Brown via Houston wrote: > I need to know if I am an "old" dog trying to learn new tricks. > > -------------------------------------- > $ cat ./doit.pl > #!/usr/bin/perl > > use strict; > use warnings; > > my $ref = \( "a", "b" ); > > print ":$ref:\n"; > print ":${$ref}:\n"; > > my $other = ("a", "b"); > > print "other :$other:\n"; > > $ ./doit.pl > Useless use of a constant (a) in void context at ./doit.pl line 11. > :SCALAR(0xaf9998): > :b: > other :b: > -------------------------------------- > > This is what confused me \( ). > > I think I am learning a new thing (not a trick). > > The "use warnings" is enlightening. > > I never really ever used a list in a scalar context before, in a > scalar context it always returns the last item. The warning is > telling me that I am essentially throwing away the value of "a". > > Julian > > > > On Tue, Aug 23, 2016 at 4:08 PM, Zakariyya Mughal via Houston < > houston at pm.org> wrote: > > > On 2016-08-23 at 15:16:42 -0500, Robert Stone wrote: > > > Greetings, > > > > > > Wow, > > > https://metacpan.org/pod/distribution/perlsecret/lib/perlsecret.pod > > is > > > a treasure trove of goodies! Thanks for sharing that. > > > > > > I believe this is the part of the documentation that stands out > > > to me as most relevant: > > > > > > *This is a container, or circumfix operator. The > > > expression > > inside > > > the [] is run in list context, stored in an anonymous array, > > > which is immediately dereferenced by @{}.* > > > > > > The "trick" here, as you pointed out, is the ${ } circumfix > > > ScalarRef dereference. However, in order to use it we have to > > > have, > > unsurprisingly, > > > a ScalarRef, hence the need for \( ) to convert the return value > > > of $object->foo first into a ScalarRef and then usage of ${ } for > > > both dereferencing it back and that tasty circumfixing action > > > (which is higher in precedence then the regex-ing, which is why > > > this code snippet works)! > > > > > > Does that sound about right? > > > > Yep! However, I believe that the `${}` evaluation inside of `m//` > > is due to interpolation rather than precedence. In `perldoc > > perlop`, Perl puts terms > > (e.g., quote-like operators and variables) higher than anything > > else and these get processed left to right. > > > > You can also used B::Concise to see how Perl parses the expression: > > > > perl -MO=Concise -e 'qr/before\Q${\( $object->foo )}\Eafter/;' > > > > Really fascinating stuff to play around with! > > > > Cheers, > > - Zaki Mughal > > > > > > > > Best Regards, > > > Robert Stone > > > > > > On Tue, Aug 23, 2016 at 2:57 PM, Zakariyya Mughal > > > > > > > > wrote: > > > > > > > On 2016-08-23 at 14:35:38 -0500, Robert Stone via Houston wrote: > > > > > Greetings, > > > > > > > > > > You are correct in the sense that $object->foo actually calls > > > > > a > > method > > > > > "foo" created via Moose Magic that returns the value of the > > > > > foo > > > > attribute. > > > > > Good call! > > > > > > > > > > Are you thinking that given the above, the \( ) business makes > > > > $object->foo > > > > > a coderef, and then ${ } executes it because it dereferences > > > > > it? > > Given > > > > > that, why does this not match: > > > > > > > > > > if( $some_value =~ m/\Q$object->foo\E/ ) { > > > > > > > > > > While this does: > > > > > > > > > > if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > > > > > > > > > Is that ${ } "protecting" the $object->foo so that the regex > > > > > engine > > > > doesn't > > > > > see it as regex-y? > > > > > > > > Not a coderef, but a scalar ref. It is similar to the approach > > > > used by the baby cart operator: > > > > > >. > > > > > > > > @{[ ]} > > > > > > > > Reading inside out: > > > > > > > > - [ ... ] : turn into an ArrayRef > > > > - @{ ... } : circumfix ArrayRef dereference > > > > > > > > So that approach for the regexp does: > > > > > > > > - \ ... : turn into a reference (unary \ operator) > > > > - ${ ... } : circumfix ScalarRef dereference > > > > > > > > I use the baby cart operator enough that I have added a line in > > > > my > > vimrc > > > > to make it work with surround.vim: > > > vimrc/commit/ad7894dcbe273b0ecb9703db88b51aa9a33d7f0c>. > > > > > > > > Cheers, > > > > - Zaki Mughal > > > > > > > > > > > > > > Best Regards, > > > > > Robert Stone > > > > > > > > > > On Tue, Aug 23, 2016 at 2:19 PM, Julian Brown via Houston < > > > > houston at pm.org> > > > > > wrote: > > > > > > > > > > > I am not familiar with Moose, but am not convinced this is > > specific to > > > > > > Moose. > > > > > > > > > > > > I assume $object->foo is really a method call that returns > > > > > > the foo attribute? Or is it like a hash value? > > > > > > > > > > > > > > > > > > ? [root at julian64:~/work]# cat doit.pl > > > > > > #!/usr/local/cpanel/3rdparty/bin/perl > > > > > > > > > > > > use strict; > > > > > > use warnings; > > > > > > > > > > > > my $var = "A"; > > > > > > my $var_ref = \$var; > > > > > > > > > > > > print "VAR :${var}:\n"; > > > > > > print "VAR VAR :${$var_ref}:\n"; > > > > > > > > > > > > Output is: > > > > > > > > > > > > VAR :A: > > > > > > VAR VAR :A: > > > > > > > > > > > > I think we are in the same realm perhaps the parens inside > > > > > > the ${} > > is > > > > > > necessary to execute the method? > > > > > > > > > > > > Julian > > > > > > > > > > > > > > > > > > > > > > > > On Tue, Aug 23, 2016 at 2:02 PM, Robert Stone via Houston < > > > > houston at pm.org> > > > > > > wrote: > > > > > > > > > > > >> Greetings, > > > > > >> > > > > > >> I find myself needing to use the value of a Moose > > > > > >> Attribute in a > > > > regular > > > > > >> expression every now and then. Typically I accomplish > > > > > >> this via > > > > (warning > > > > > >> that all examples are very contrived and may contain bugs): > > > > > >> > > > > > >> *Sample Using Variable Assignment First* > > > > > >> > > > > > >> my $value = $my_moose_object->attribute; > > > > > >> if( $some_value =~ m/\Q$value/ ) { > > > > > >> > > > > > >> Needless to say this isn't the most efficient/easiest to > > > > > >> work > > with. > > > > > >> Given that fact, I've come across a way of using Moose > > > > > >> Attributes > > > > directly > > > > > >> in regular expressions: > > > > > >> > > > > > >> *MyObject* > > > > > >> > > > > > >> package MyObject; > > > > > >> > > > > > >> use Moose; > > > > > >> > > > > > >> has foo => ( is => 'ro', isa => 'Str' ); > > > > > >> > > > > > >> ...; > > > > > >> > > > > > >> *Script That Consumes MyObject* > > > > > >> > > > > > >> my $object = MyObject->new( foo => 'Value' ); > > > > > >> if( $some_value =~ m/\Q${\( $object->foo )}\E/ ) { > > > > > >> > > > > > >> > > > > > >> This works, but frankly I'm not entirely certain why. > > > > > >> From the documentation at > > > > > >> http://perldoc.perl.org/perlre.html#Regular- > > > > Expressions > > > > > >> I have: > > > > > >> > > > > > >> \Q quote (disable) pattern metacharacters until \E > > > > > >> \E end either case modification or quoted > > > > > >> section, think > > vi > > > > > >> > > > > > >> Great, that makes sense. > > > > > >> > > > > > >> But what magic is the ${\( ... )} doing here? I'd be most > > grateful if > > > > > >> anyone had some insight and could share it with us! > > > > > >> > > > > > >> Best Regards, > > > > > >> Robert Stone > > > > > >> > > > > > >> > > > > > >> > > > > > >> _______________________________________________ > > > > > >> Houston mailing list > > > > > >> Houston at pm.org > > > > > >> http://mail.pm.org/mailman/listinfo/houston > > > > > >> Website: http://houston.pm.org/ > > > > > >> > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > Houston mailing list > > > > > > Houston at pm.org > > > > > > http://mail.pm.org/mailman/listinfo/houston > > > > > > Website: http://houston.pm.org/ > > > > > > > > > > > > > > > _______________________________________________ > > > > > Houston mailing list > > > > > Houston at pm.org > > > > > http://mail.pm.org/mailman/listinfo/houston > > > > > Website: http://houston.pm.org/ > > > > > > > > > > _______________________________________________ > > Houston mailing list > > Houston at pm.org > > http://mail.pm.org/mailman/listinfo/houston > > Website: http://houston.pm.org/ > > -- The mere formulation of a problem is far more essential than its solution, which may be merely a matter of mathematical or experimental skills. -- Albert Einstein From mrallen1 at yahoo.com Sun Aug 28 09:24:22 2016 From: mrallen1 at yahoo.com (Mark Allen) Date: Sun, 28 Aug 2016 11:24:22 -0500 Subject: [pm-h] September talk Message-ID: <305454DA-0F0F-4989-8AF1-8EBA3243C753@yahoo.com> I'd like to propose this talk for September's Perl meeting- How Functional Programming Made Me Better at Perl Although most people treat Perl as an imperative language, it has always been possible to use functional programming idioms in Perl 5. Vastly better described by Mark Jason Dominius in what I consider to be one of the best books about programming (in general, not just about Perl) Higher Order Perl (full text can be found here: http://hop.perl.plover.com) I will illustrate many ways that functional programming constructions bring great power and conciseness to your Perl code. Thanks! Sent from my iPhone From gwadej at anomaly.org Sun Aug 28 10:01:23 2016 From: gwadej at anomaly.org (G. Wade Johnson) Date: Sun, 28 Aug 2016 12:01:23 -0500 Subject: [pm-h] September talk In-Reply-To: <305454DA-0F0F-4989-8AF1-8EBA3243C753@yahoo.com> References: <305454DA-0F0F-4989-8AF1-8EBA3243C753@yahoo.com> Message-ID: <20160828120123.1de556b4@cygnus> On Sun, 28 Aug 2016 11:24:22 -0500 Mark Allen via Houston wrote: > I'd like to propose this talk for September's Perl meeting- > > How Functional Programming Made Me Better at Perl It looks like we have two proposals for a presentation next month. Julian Brown had suggested "Read Copy Update in the Linux Kernel" as a topic earlier and I had not gotten a chance to post it yet. Now, Mark is suggesting a new talk. You guys want to work out who goes first, and we can push the other talk to October? G. Wade > > Although most people treat Perl as an imperative language, it has > always been possible to use functional programming idioms in Perl 5. > Vastly better described by Mark Jason Dominius in what I consider to > be one of the best books about programming (in general, not just > about Perl) Higher Order Perl (full text can be found here: > http://hop.perl.plover.com) I will illustrate many ways that > functional programming constructions bring great power and > conciseness to your Perl code. > > Thanks! > > Sent from my iPhone > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ -- You should never hand someone a gun unless you're sure where they'll point it. -- Jeffrey Sinclair in "By Any Means Necessary" From mrallen1 at yahoo.com Sun Aug 28 10:04:11 2016 From: mrallen1 at yahoo.com (Mark Allen) Date: Sun, 28 Aug 2016 12:04:11 -0500 Subject: [pm-h] September talk In-Reply-To: <20160828120123.1de556b4@cygnus> References: <305454DA-0F0F-4989-8AF1-8EBA3243C753@yahoo.com> <20160828120123.1de556b4@cygnus> Message-ID: I can go in October - didn't know Julian had a topic ?? Sounds good Sent from my iPhone > On Aug 28, 2016, at 12:01 PM, G. Wade Johnson via Houston wrote: > > On Sun, 28 Aug 2016 11:24:22 -0500 > Mark Allen via Houston wrote: > >> I'd like to propose this talk for September's Perl meeting- >> >> How Functional Programming Made Me Better at Perl > > It looks like we have two proposals for a presentation next month. > > Julian Brown had suggested "Read Copy Update in the Linux Kernel" as a > topic earlier and I had not gotten a chance to post it yet. > > Now, Mark is suggesting a new talk. > > You guys want to work out who goes first, and we can push the other > talk to October? > > G. Wade > >> >> Although most people treat Perl as an imperative language, it has >> always been possible to use functional programming idioms in Perl 5. >> Vastly better described by Mark Jason Dominius in what I consider to >> be one of the best books about programming (in general, not just >> about Perl) Higher Order Perl (full text can be found here: >> http://hop.perl.plover.com) I will illustrate many ways that >> functional programming constructions bring great power and >> conciseness to your Perl code. >> >> Thanks! >> >> Sent from my iPhone >> _______________________________________________ >> Houston mailing list >> Houston at pm.org >> http://mail.pm.org/mailman/listinfo/houston >> Website: http://houston.pm.org/ > > > -- > You should never hand someone a gun unless you're sure where they'll > point it. -- Jeffrey Sinclair in "By Any Means > Necessary" > _______________________________________________ > Houston mailing list > Houston at pm.org > http://mail.pm.org/mailman/listinfo/houston > Website: http://houston.pm.org/ From gwadej at anomaly.org Sun Aug 28 18:54:08 2016 From: gwadej at anomaly.org (G. Wade Johnson) Date: Sun, 28 Aug 2016 20:54:08 -0500 Subject: [pm-h] September Houston.pm technical meeting: The Read Copy Update pattern in the Linux Kernel Message-ID: <20160828205408.72919353@cygnus> This month, Julian Brown will follow up on his discussion of lock-free architectures with a description of the Read Copy Update pattern in the Linux kernel. If there is any time left over (and any interest), Wade Johnson will give the short talk on two color 3D printing with Perl he was going to do last meeting. As usual, the meeting will begin at 7pm on Thursday, September 8. We'll be meeting at the cPanel offices this month (https://www.google.com/maps/place/2550+N+Loop+W,+Houston,+TX+77092/@29.8081429,-95.4459714,17z/data=!3m1!4b1!4m2!3m1!1s0x8640c6fa4d91297b:0x988e2dedf77ce147). We'll meet in the lobby between 6:30 and 7, and go to the meeting room from there. G. Wade -- Simplicity and elegance are unpopular because they require hard work and discipline to achieve and education to be appreciated. -- Edsger Dijkstra From gwadej at anomaly.org Sun Aug 28 18:54:11 2016 From: gwadej at anomaly.org (G. Wade Johnson) Date: Sun, 28 Aug 2016 20:54:11 -0500 Subject: [pm-h] October Houston.pm technical meeting: How Functional Programming Made Me Better at Perl Message-ID: <20160828205411.29921a62@cygnus> At our October Houston.pm meeting, Mark Allen will discuss ways that functional programming techniques has improved his Perl code. A more complete announcement will go out closer to the meeting. G. Wade -- If there's no problem, there's no solution. -- Rick Hoselton