From turne349 at purdue.edu Thu Oct 15 05:52:42 2020 From: turne349 at purdue.edu (Turner, Howard Robert) Date: Thu, 15 Oct 2020 12:52:42 +0000 Subject: [Purdue-pm] List activity Message-ID: Greetings everyone, Recently found out Purdue had a Perl mailing list. I haven't seen any activity thus far so thought I'd send out a message to see if the list is even active anymore? Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at ecn.purdue.edu Thu Oct 15 06:55:49 2020 From: mark at ecn.purdue.edu (Mark Senn) Date: Thu, 15 Oct 2020 09:55:49 -0400 Subject: [Purdue-pm] List activity In-Reply-To: References: Message-ID: <34184.1602770149@pier.ecn.purdue.edu> Rob Turner wrote on 12:52+00: | Greetings everyone, | | Recently found out Purdue had a Perl mailing list. I haven't seen any | activity thus far so thought I'd send out a message to see if the list | is even active anymore? | | Rob Hi Rob, Yep, we're active---just not a lot of traffic. I use Perl 5 and Raku (previously known as Perl 6) every day at my job at the Engineering Computer Network. Use Raku more than any other language for general programming---use Mathematica for technical programming when the math, graphics, or interfacing with curated data is easier in Mathematica than Raku. -mark From turne349 at purdue.edu Thu Oct 15 14:15:14 2020 From: turne349 at purdue.edu (Turner, Howard Robert) Date: Thu, 15 Oct 2020 21:15:14 +0000 Subject: [Purdue-pm] List activity In-Reply-To: <34184.1602770149@pier.ecn.purdue.edu> References: , <34184.1602770149@pier.ecn.purdue.edu> Message-ID: Mark, Ah great to hear! Can't find many local folks who use Perl these days and online info isn't always the greatest either. I've only ever used Perl 5 and mainly one-liners on *nix systems. Recently decided to start putting more effort into programming in general and wanted to use Perl as a nice mix between Bash and C. Seemed to be what a lot of folks were comparing Perl to (again online inform so forgive me if that's a bad analogy). Any suggestions on practice problems or challenges worth working on? I like the "solve problems relevant to you" mentality but sometimes have trouble coming up with my own challenges. Rob ________________________________ From: Mark Senn Sent: Thursday, October 15, 2020 9:55:49 AM To: Turner, Howard Robert Cc: purdue-pm at pm.org Subject: Re: [Purdue-pm] List activity Rob Turner wrote on 12:52+00: | Greetings everyone, | | Recently found out Purdue had a Perl mailing list. I haven't seen any | activity thus far so thought I'd send out a message to see if the list | is even active anymore? | | Rob Hi Rob, Yep, we're active---just not a lot of traffic. I use Perl 5 and Raku (previously known as Perl 6) every day at my job at the Engineering Computer Network. Use Raku more than any other language for general programming---use Mathematica for technical programming when the math, graphics, or interfacing with curated data is easier in Mathematica than Raku. -mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From gizmomathboy at gmail.com Thu Oct 15 15:23:13 2020 From: gizmomathboy at gmail.com (gizmomathboy) Date: Thu, 15 Oct 2020 18:23:13 -0400 Subject: [Purdue-pm] List activity In-Reply-To: References: <34184.1602770149@pier.ecn.purdue.edu> Message-ID: <9a3fb7b4-1df8-d6db-3d6a-a016cda7216a@gmail.com> Rob, there is the weekly perl challenge: https://perlweeklychallenge.org/ However, they will take answers in any language. There is also Rosetta Code for just an assort of problems to solve and compare to what others have done. http://rosettacode.org/wiki/Rosetta_Code gizmo From mark at purdue.edu Thu Oct 15 15:25:37 2020 From: mark at purdue.edu (Mark Senn) Date: Thu, 15 Oct 2020 18:25:37 -0400 Subject: [Purdue-pm] List activity In-Reply-To: References: , <34184.1602770149@pier.ecn.purdue.edu> Message-ID: <1695.1602800737@pier.ecn.purdue.edu> | Mark, | | Ah great to hear! Can't find many local folks who use Perl these days | and online info isn't always the greatest either. | | I've only ever used Perl 5 and mainly one-liners on *nix | systems. Recently decided to start putting more effort into programming | in general and wanted to use Perl as a nice mix between Bash and | C. Seemed to be what a lot of folks were comparing Perl to (again online | inform so forgive me if that's a bad analogy). | | Any suggestions on practice problems or challenges worth working on? I | like the "solve problems relevant to you" mentality but sometimes have | trouble coming up with my own challenges. | | Rob I agree that Perl is a nice mix of Bash and C. I only write bash functions for simple shell things. For programming in general, and not just shell things, I recommend using Perl (or better yet, Raku, formerly known as Perl 6). For problems I recommend https://perlweeklychallenge.org/ Think about things you can automate in your workflow and implement them if you have time. Write a program to sum the numbers 1 to n in an efficient way. Clue, for n = 100: 1+100 = 101, 2+99 = 101, ... . Write a program to evaluate a perl expression and print the answer. Clue: eval statement. Build a macro processor that can be extended arbitrarily with Perl. -mark From turne349 at purdue.edu Fri Oct 16 04:34:31 2020 From: turne349 at purdue.edu (Turner, Howard Robert) Date: Fri, 16 Oct 2020 11:34:31 +0000 Subject: [Purdue-pm] List activity In-Reply-To: <1695.1602800737@pier.ecn.purdue.edu> References: , <34184.1602770149@pier.ecn.purdue.edu> , <1695.1602800737@pier.ecn.purdue.edu> Message-ID: Mark/gizmo, Perl weekly challenge looks great! Thanks for sharing. Plenty to keep busy with now. Rob ________________________________ From: Mark Senn Sent: Thursday, October 15, 2020 6:25:37 PM To: Turner, Howard Robert Cc: purdue-pm at pm.org Subject: Re: [Purdue-pm] List activity | Mark, | | Ah great to hear! Can't find many local folks who use Perl these days | and online info isn't always the greatest either. | | I've only ever used Perl 5 and mainly one-liners on *nix | systems. Recently decided to start putting more effort into programming | in general and wanted to use Perl as a nice mix between Bash and | C. Seemed to be what a lot of folks were comparing Perl to (again online | inform so forgive me if that's a bad analogy). | | Any suggestions on practice problems or challenges worth working on? I | like the "solve problems relevant to you" mentality but sometimes have | trouble coming up with my own challenges. | | Rob I agree that Perl is a nice mix of Bash and C. I only write bash functions for simple shell things. For programming in general, and not just shell things, I recommend using Perl (or better yet, Raku, formerly known as Perl 6). For problems I recommend https://perlweeklychallenge.org/ Think about things you can automate in your workflow and implement them if you have time. Write a program to sum the numbers 1 to n in an efficient way. Clue, for n = 100: 1+100 = 101, 2+99 = 101, ... . Write a program to evaluate a perl expression and print the answer. Clue: eval statement. Build a macro processor that can be extended arbitrarily with Perl. -mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From turne349 at purdue.edu Wed Oct 21 18:10:40 2020 From: turne349 at purdue.edu (Turner, Howard Robert) Date: Thu, 22 Oct 2020 01:10:40 +0000 Subject: [Purdue-pm] Threads and forks Message-ID: Greetings again everyone. Looking for some advice. I'm writing a small program that talks to a webserver and ends waiting for a connection back from the webserver. Problem is I can only figure out to have the call back handled or my Perl program continue processing but not both. Started reading the Perl threads tutorial but it suggests not using threads and then started reading about fork instead. So a little overwhelmed in figuring out which one is "the right way". Anyone have suggestions and/or tutorials they'd suggest reviewing beyond the ones on perldoc? Respectfully, Rob -------------- next part -------------- An HTML attachment was scrubbed... URL: From gizmo at purdue.edu Thu Oct 22 05:18:15 2020 From: gizmo at purdue.edu (Joe) Date: Thu, 22 Oct 2020 08:18:15 -0400 Subject: [Purdue-pm] Threads and forks In-Reply-To: References: Message-ID: <2740dd60-256d-f042-9a96-e4b073854107@purdue.edu> On 10/21/20 9:10 PM, Turner, Howard Robert wrote: > Greetings again everyone. > > Looking for some advice. I'm writing a small program that talks to a > webserver and ends waiting for a connection back from the webserver. > Problem is I can only figure out to have the call back handled or my > Perl program continue processing but not both.? > > Started reading the Perl threads tutorial but it suggests not using > threads and then started reading about fork instead. So a little > overwhelmed in figuring out which one is "the right way".? > > Anyone have suggestions and/or tutorials they'd suggest reviewing beyond > the ones on perldoc? Rob, In the past for async stuff I've used: https://metacpan.org/pod/Parallel::ForkManager https://metacpan.org/pod/IO::Async Lots of stuff in the IO::Async distro, like Promises and such. As for web stuff... Mojo is really good for that. https://metacpan.org/pod/Mojo::UserAgent https://metacpan.org/pod/Mojo::DOM https://metacpan.org/pod/Mojo::Promise As with all things Perl, There's More Than One Way To Do It. Although..we try to push the Modern Way and Best Practices ;-) joe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: OpenPGP digital signature URL: From jacoby.david at gmail.com Thu Oct 22 06:55:28 2020 From: jacoby.david at gmail.com (Dave Jacoby) Date: Thu, 22 Oct 2020 09:55:28 -0400 Subject: [Purdue-pm] Threads and forks In-Reply-To: <2740dd60-256d-f042-9a96-e4b073854107@purdue.edu> References: <2740dd60-256d-f042-9a96-e4b073854107@purdue.edu> Message-ID: I recently saw someone talk about MCE, or Multi Core Engine. https://metacpan.org/pod/MCE I need to spend more time with it some day On Thu, Oct 22, 2020, 8:40 AM Joe wrote: > On 10/21/20 9:10 PM, Turner, Howard Robert wrote: > > Greetings again everyone. > > > > Looking for some advice. I'm writing a small program that talks to a > > webserver and ends waiting for a connection back from the webserver. > > Problem is I can only figure out to have the call back handled or my > > Perl program continue processing but not both. > > > > Started reading the Perl threads tutorial but it suggests not using > > threads and then started reading about fork instead. So a little > > overwhelmed in figuring out which one is "the right way". > > > > Anyone have suggestions and/or tutorials they'd suggest reviewing beyond > > the ones on perldoc? > > Rob, > > In the past for async stuff I've used: > > https://metacpan.org/pod/Parallel::ForkManager > > https://metacpan.org/pod/IO::Async > > Lots of stuff in the IO::Async distro, like Promises and such. > > > > As for web stuff... > > Mojo is really good for that. > > https://metacpan.org/pod/Mojo::UserAgent > > https://metacpan.org/pod/Mojo::DOM > > https://metacpan.org/pod/Mojo::Promise > > > As with all things Perl, There's More Than One Way To Do It. > > Although..we try to push the Modern Way and Best Practices ;-) > > joe > > _______________________________________________ > Purdue-pm mailing list > Purdue-pm at pm.org > https://mail.pm.org/mailman/listinfo/purdue-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From jacoby.david at gmail.com Thu Oct 22 06:58:47 2020 From: jacoby.david at gmail.com (Dave Jacoby) Date: Thu, 22 Oct 2020 09:58:47 -0400 Subject: [Purdue-pm] Threads and forks In-Reply-To: References: Message-ID: My first question is, what is the webserver doing? Because, notwithstanding lag, I'd expect it to receive and handle your web stuff. Are you using LWP? Mojo::UserAgent? WWW:: Mechanize? Shell out to curl? On Wed, Oct 21, 2020, 9:10 PM Turner, Howard Robert wrote: > Greetings again everyone. > > Looking for some advice. I'm writing a small program that talks to a > webserver and ends waiting for a connection back from the webserver. > Problem is I can only figure out to have the call back handled or my Perl > program continue processing but not both. > > Started reading the Perl threads tutorial but it suggests not using > threads and then started reading about fork instead. So a little > overwhelmed in figuring out which one is "the right way". > > Anyone have suggestions and/or tutorials they'd suggest reviewing beyond > the ones on perldoc? > > Respectfully, > Rob > _______________________________________________ > Purdue-pm mailing list > Purdue-pm at pm.org > https://mail.pm.org/mailman/listinfo/purdue-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at purdue.edu Thu Oct 22 08:07:38 2020 From: mark at purdue.edu (Mark Senn) Date: Thu, 22 Oct 2020 11:07:38 -0400 Subject: [Purdue-pm] Threads and forks In-Reply-To: References: Message-ID: <22970.1603379258@pier.ecn.purdue.edu> Rob Turner wrote on 2020-10-22 at 01:10+00: | Greetings again everyone. | | Looking for some advice. I'm writing a small program that talks to a | webserver and ends waiting for a connection back from the | webserver. Problem is I can only figure out to have the call back | handled or my Perl program continue processing but not both. | | Started reading the Perl threads tutorial but it suggests not using | threads and then started reading about fork instead. So a little | overwhelmed in figuring out which one is "the right way". | | Anyone have suggestions and/or tutorials they'd suggest reviewing beyond | the ones on perldoc? | | Respectfully, | Rob Rob, I like Raku (formerly known as Perl 6) better than Perl 5. Raku is harder to learn than Perl 5 because it is much more powerful. Fewer people know Raku than Perl 5. Raku is not installed on as many computers. My return on investment learning Raku has been excellent. If you'd like to make the jump to Raku this quote Raku is designed to support parallelism, asynchronicity and concurrency. is from https://docs.raku.org/language/concurrency I'm guessing you want to go async because you're sending requests to multiple webservers and/or sending a message to a single web server that will require lots of computation. Is that correct? See https://zostay.com/posts/2019/12/01/introducing-async-concurrency-in-raku/ for around 20 other async/concurrency articles. See https://cro.services for information on Cro. From the web page: Cro is a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all Raku (formerly Perl 6) has to offer. The high level APIs make the easy things easy, and the asynchronous pipeline concept at Cro's heart makes the hard things possible. https://raku.guide/ is a good intro to Raku. Raku is Object-Oriented, OO stuff is built in on Raku, bolted on in Perl 5. From the web page my @final-array = reverse(sort(unique(@array))); is easier to read in my opinion in Raku my @final-array = @array.unique.sort.reverse; Raku has more functions, more operations, more flexibility. Await may do what you want see https://docs.raku.org/routine/await but using Cro may be cleaner. Raku does not have modules that help write PDF files as far as I know. Perl 5 has way more modules. If you need a module that Perl 5 does not have but Raku does and you don't want to write it you'll want to use Perl 5. But, I can do most my work with Raku and love it. Raku is written in Raku using a Raku "grammar". Raku regexes are more powerful than Perl 5 regular expressions. Raku has "infinite" precision arithmetic built in for integers and rational numbers. -mark From turne349 at purdue.edu Thu Oct 22 16:15:44 2020 From: turne349 at purdue.edu (Turner, Howard Robert) Date: Thu, 22 Oct 2020 23:15:44 +0000 Subject: [Purdue-pm] Threads and forks In-Reply-To: <22970.1603379258@pier.ecn.purdue.edu> References: , <22970.1603379258@pier.ecn.purdue.edu> Message-ID: Dave, Thanks for the suggestion on MCE. I'll read about it this weekend. To answer your other question. Essentially my Perl program is logging into a web application and running a utility that calls back to the system that the Perl script is running from. I was hoping to have the Perl program 'catch' call back or perhaps launch a thread or something that can listen for the call back. My terminology may be off so apologies in advance still learning! I hope this gets the idea/concept across though? Mark, Thanks for the Raku articles too. I'll take a look at them for my edification. At the moment, I'm really trying to focus on getting better at Perl 5 as work currently relies on it fairly heavily. Really need to look into Raku though just to be more versed on the differences between the two languages. Rob ________________________________ From: Mark Senn Sent: Thursday, October 22, 2020 11:07:38 AM To: Turner, Howard Robert Cc: perl at ecn.purdue.edu ; Purdue Perl Mongers Subject: Re: [Purdue-pm] Threads and forks Rob Turner wrote on 2020-10-22 at 01:10+00: | Greetings again everyone. | | Looking for some advice. I'm writing a small program that talks to a | webserver and ends waiting for a connection back from the | webserver. Problem is I can only figure out to have the call back | handled or my Perl program continue processing but not both. | | Started reading the Perl threads tutorial but it suggests not using | threads and then started reading about fork instead. So a little | overwhelmed in figuring out which one is "the right way". | | Anyone have suggestions and/or tutorials they'd suggest reviewing beyond | the ones on perldoc? | | Respectfully, | Rob Rob, I like Raku (formerly known as Perl 6) better than Perl 5. Raku is harder to learn than Perl 5 because it is much more powerful. Fewer people know Raku than Perl 5. Raku is not installed on as many computers. My return on investment learning Raku has been excellent. If you'd like to make the jump to Raku this quote Raku is designed to support parallelism, asynchronicity and concurrency. is from https://docs.raku.org/language/concurrency I'm guessing you want to go async because you're sending requests to multiple webservers and/or sending a message to a single web server that will require lots of computation. Is that correct? See https://zostay.com/posts/2019/12/01/introducing-async-concurrency-in-raku/ for around 20 other async/concurrency articles. See https://cro.services for information on Cro. From the web page: Cro is a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all Raku (formerly Perl 6) has to offer. The high level APIs make the easy things easy, and the asynchronous pipeline concept at Cro's heart makes the hard things possible. https://raku.guide/ is a good intro to Raku. Raku is Object-Oriented, OO stuff is built in on Raku, bolted on in Perl 5. From the web page my @final-array = reverse(sort(unique(@array))); is easier to read in my opinion in Raku my @final-array = @array.unique.sort.reverse; Raku has more functions, more operations, more flexibility. Await may do what you want see https://docs.raku.org/routine/await but using Cro may be cleaner. Raku does not have modules that help write PDF files as far as I know. Perl 5 has way more modules. If you need a module that Perl 5 does not have but Raku does and you don't want to write it you'll want to use Perl 5. But, I can do most my work with Raku and love it. Raku is written in Raku using a Raku "grammar". Raku regexes are more powerful than Perl 5 regular expressions. Raku has "infinite" precision arithmetic built in for integers and rational numbers. -mark -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at purdue.edu Fri Oct 23 16:43:26 2020 From: mark at purdue.edu (Mark Senn) Date: Fri, 23 Oct 2020 19:43:26 -0400 Subject: [Purdue-pm] FYI: PDF::Haru vs. PDF::Create Message-ID: <37814.1603496606@pier.ecn.purdue.edu> Purdue Perl Mongers, If you are looking for a way to create PDF files in Perl 5 I suggest using PDF::Haru instead of PDF::Create. I started out with Create, wanted to change line thinkness but Create apparently doesn't have a way to change that. Haru does. PDF::Create only requires Perl, PDF::Haru requires you install the libharu C library but it includes lots of stuff that Create doesn't and isn't harder to use. -mark