From jay at jays.net Tue Mar 18 17:57:31 2014 From: jay at jays.net (Jay Hannah) Date: Tue, 18 Mar 2014 19:57:31 -0500 Subject: [Omaha.pm] Meeting! Tue, Mar 25 2014 7pm Message-ID: <14DA5F04-8410-4997-8A20-917D4988165B@jays.net> http://omacode.org Tue, Mar 25 2014 7pm Lightning Talks! Elixir, Light Table, AngularJS 101 (Open Nebraska), Clojure... And whatever you want to talk about! Reply to let me know what you're willing to present. :) http://omacode.org See you there! :) j From jay at jays.net Thu Mar 20 08:37:39 2014 From: jay at jays.net (Jay Hannah) Date: Thu, 20 Mar 2014 10:37:39 -0500 Subject: [Omaha.pm] Simplifying Time? In-Reply-To: References: Message-ID: On Mar 20, 2014, at 10:19 AM, Robert L. Harris wrote: > I'm running a script that is adding up the duration of events. By the end of it I have something like this: > > $Days=5 > $Hours=131 > $Mins=618 > $Secs=151 > > Anyone know a simple modules to simplify this to standard ranges? Even if I have to do a multi-step? I've looked into a few options but none are 'clean.' The defacto thing everyone and their mom uses is DateTime: https://metacpan.org/pod/DateTime I find it pretty meh for some things, so I used to use Class::Date a ton at a previous job: https://metacpan.org/pod/distribution/Class-Date/Date.pod # creating relative date object # (normally you don't need to create this object explicitly) my $reldate = new Class::Date::Rel "3Y 1M 3D 6h 2m 4s"; It's been a while since I hacked on this stuff hard. :) j Omaha.pm From jay at jays.net Thu Mar 20 09:23:47 2014 From: jay at jays.net (Jay Hannah) Date: Thu, 20 Mar 2014 11:23:47 -0500 Subject: [Omaha.pm] Simplifying Time? In-Reply-To: References: Message-ID: On Mar 20, 2014, at 11:06 AM, Robert L. Harris wrote: > It looks like the reldate is what I want, not figure out how to use it. No clear examples on "convert 561 seconds to 9 minutes, 21 seconds" :) Does this help? https://github.com/jhannah/sandbox/blob/master/robertlharris/go.pl $ cat go.pl use Class::Date; use 5.10.0; my $reldate = new Class::Date::Rel "561s"; say "In minutes: " . $reldate->min; say "In seconds: " . $reldate->sec; my $seconds_only = $reldate - (int($reldate->min) * 60 . 'm'); # subtract minutes away say "Seconds only: $seconds_only"; printf("%d minutes %d seconds\n", int($reldate / 60), $seconds_only); $ perl go.pl In minutes: 9.35 In seconds: 561 Seconds only: 21 9 minutes 21 seconds j From sterling at hanenkamp.com Thu Mar 20 10:52:57 2014 From: sterling at hanenkamp.com (Sterling Hanenkamp) Date: Thu, 20 Mar 2014 12:52:57 -0500 Subject: [Omaha.pm] Simplifying Time? In-Reply-To: References: Message-ID: If you use DateTime instead of Class::Date, there's the DateTime::Duration class which will let you add durations: my $duration = DateTime::Duration->new( seconds => 15 ); $duration->add( seconds => 73 ); $duration->add( weeks => 12 ); There are some modules to help with formatting durations too. I think the nicest of which is this one: https://metacpan.org/pod/DateTime::Format::Human::Duration It's a pretty nice module. On Thu, Mar 20, 2014 at 11:23 AM, Jay Hannah wrote: > On Mar 20, 2014, at 11:06 AM, Robert L. Harris > wrote: > > It looks like the reldate is what I want, not figure out how to use it. > No clear examples on "convert 561 seconds to 9 minutes, 21 seconds" :) > > Does this help? > > https://github.com/jhannah/sandbox/blob/master/robertlharris/go.pl > > > $ cat go.pl > use Class::Date; > use 5.10.0; > > my $reldate = new Class::Date::Rel "561s"; > say "In minutes: " . $reldate->min; > say "In seconds: " . $reldate->sec; > > my $seconds_only = $reldate - (int($reldate->min) * 60 . 'm'); # subtract > minutes away > say "Seconds only: $seconds_only"; > printf("%d minutes %d seconds\n", int($reldate / 60), $seconds_only); > > > $ perl go.pl > In minutes: 9.35 > In seconds: 561 > Seconds only: 21 > 9 minutes 21 seconds > > > j > > > _______________________________________________ > Omaha-pm mailing list > Omaha-pm at pm.org > http://mail.pm.org/mailman/listinfo/omaha-pm > -- Andrew Sterling Hanenkamp sterling at hanenkamp.com 785.370.4454 -------------- next part -------------- An HTML attachment was scrubbed... URL: From jay at jays.net Fri Mar 21 10:15:22 2014 From: jay at jays.net (Jay Hannah) Date: Fri, 21 Mar 2014 12:15:22 -0500 Subject: [Omaha.pm] Sample HTTP interaction script. In-Reply-To: References: Message-ID: On Mar 21, 2014, at 12:11 PM, Robert L. Harris wrote: > I need to throw something simple together real quick. A one-timer that SHOULDN"T be re-used... > > I need to connect to a site, http://foo.bar:/8052/Login.html > > I am then prompted for a login/password. Once I log in I am given a new page : http://foo.bar:8052/App.html > > On this page is a search box, amongst other things, I want to put in a value (user filled variable) and post the search. Then scrape the resulting page for a result. > > > I have done basic auth using apache auth but this is the app requiring a login using a backend database. Also I've never filled in a search page like this. > > Does anyone have a script that might do something similar I can take apart and use as an example? I need it semi-quick but I can't justify spending more than a day on it. Should be easy with WWW::Mechanize: https://metacpan.org/pod/WWW::Mechanize#SYNOPSIS HTH, j (P.S. Why is the Denver mailing list set to reply to author? Isn't reply to list better?) From jay at jays.net Tue Mar 25 07:30:49 2014 From: jay at jays.net (Jay Hannah) Date: Tue, 25 Mar 2014 09:30:49 -0500 Subject: [Omaha.pm] Meeting tonight! Message-ID: <1BCBF6C4-1F00-4828-AA66-375B621C7E9A@jays.net> http://omacode.org OMG!Code tonight! Lightning Talks! Elixir, Light Table, AngularJS 101 (Open Nebraska), Clojure... Join us! http://omacode.org j From Payne at MattPayne.org Tue Mar 25 08:30:42 2014 From: Payne at MattPayne.org (Matt Payne) Date: Tue, 25 Mar 2014 10:30:42 -0500 Subject: [Omaha.pm] [OMG!Code] Meeting tonight! In-Reply-To: <1BCBF6C4-1F00-4828-AA66-375B621C7E9A@jays.net> References: <1BCBF6C4-1F00-4828-AA66-375B621C7E9A@jays.net> Message-ID: Very cool! I'm planning on being there shortly before the 7pm start time. Thanks very much! --Matt Payne On Tue, Mar 25, 2014 at 9:30 AM, Jay Hannah wrote: > http://omacode.org > > OMG!Code tonight! Lightning Talks! Elixir, Light Table, AngularJS 101 > (Open Nebraska), Clojure... Join us! > > http://omacode.org > > j > > > > > -- > OMG!Code http://code.omahamakergroup.org > --- > You received this message because you are subscribed to the Google Groups > "OMG!Code" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to omg-code+unsubscribe at googlegroups.com. > Visit this group at http://groups.google.com/group/omg-code. > For more options, visit https://groups.google.com/d/optout. > -- --Matt Payne -------------- next part -------------- An HTML attachment was scrubbed... URL: