The web in a box - a next generation web framework for the Perl programming language

IRC log for #mojo, 2017-02-19

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:28 disputin joined #mojo
00:35 sugar joined #mojo
00:44 asarch joined #mojo
01:03 aborazmeh joined #mojo
01:14 sugar joined #mojo
01:57 sugar joined #mojo
02:57 schelcj joined #mojo
03:07 stryx` joined #mojo
03:31 noganex_ joined #mojo
05:04 dboehmer_ joined #mojo
06:08 marty joined #mojo
06:17 itaipu joined #mojo
06:52 Vandal joined #mojo
08:25 stryx` joined #mojo
09:56 sh14 joined #mojo
10:58 irqq joined #mojo
11:57 irqq_ joined #mojo
12:12 * sri yawns
12:17 irqq_ joined #mojo
13:23 stryx` joined #mojo
15:00 polettix joined #mojo
15:33 irqq joined #mojo
15:55 stryx` joined #mojo
16:02 kes joined #mojo
16:16 litwol hmm.
16:16 litwol I'm using DateTime::Format::Pg->parse_datetime() to format date string output. very happy with it.
16:17 litwol I use '%B' to output full month name. and because my system is defaulting to en_US locale.. not surprisingly i get english month names.
16:18 pink_mist Time::F can help there
16:18 litwol in long term i'm planning to have full multilingual support for the site i'm building (still that hoby site..)
16:19 litwol but for today i need German language support, at least for date string formatting.
16:19 pink_mist https://metacpan.org/pod/Time::F#strftime <-- as you can see you can specify a locale for it's strftime
16:19 pink_mist *its
16:19 litwol What can i google for to find tutorials on switching locales *inline* right around the date string formatting?
16:19 litwol oh
16:19 * litwol looking
16:25 jberger I haven't needed to use an external string formatter for pg datetimes
16:25 jberger but maybe things like locale aware stuff isn't easy
16:27 Ryoga joined #mojo
16:31 litwol pink_mist: i've added 'use Time::F' in my app main package file. (the one with sub startup). Next i used strftime() inside a template file using "%= strftime(...);"
16:32 litwol and i got error 'Undefined subroutine'
16:33 pink_mist you may need to use it in the template? I'd expect they aren't in the same package as your main package
16:33 pink_mist or set up a helper for it
16:33 litwol i c.
16:33 litwol ty
16:33 * litwol tries a helper
16:36 pink_mist though, using Time::F directly isn't the usual way; it requires the first argument to be a Time::C object ... and if you have a Time::C object already, you can just call its strftime method
16:37 pink_mist (though the arguments are a little different in that case)
16:55 litwol using input string 2017-02-20 19:00:00
16:55 litwol my $t = Time::C->from_string($time, format => "%Y-%m-%d %H:%M:%S");
16:56 litwol return strftime($t, $format, locale => $locale);
16:56 litwol goal i'm working towards is loading 'date range' value from PSQL. i'm using 'lower()' to give me lower range of the datetime resulting in time string above.
16:57 litwol then i am trying to format datetime into something else.
16:57 litwol Running above lines i get this error: "Value for locale type months in locale locale is undefined"
16:57 litwol I'm converting to: '%d. %B, %H:%M', locale => "de_DE.UTF-8'"
17:02 litwol oh
17:02 litwol i've got it solved
17:02 litwol went back to using DateTime
17:02 litwol discovered it has the convenient $dt->set_locale();
17:07 pink_mist the .UTF-8 isn't part of the locale, that's just the charset ... but perl uses characters internally, so no charset needed
17:08 pink_mist but cool if datetime has that
17:10 litwol i've tried "de_DE" first.
17:10 litwol to same effect.
17:19 pink_mist $ perl -E 'use Time::C; use Time::F; my $t = Time::C->now; say strftime($t, "%d. %B, %H:%M", locale => "de_DE")'
17:19 pink_mist 19. Februar, 18:19
17:19 pink_mist works for me
17:21 asarch joined #mojo
17:22 litwol it's missing Time::C->from_string call
17:23 pink_mist $ perl -E 'use Time::C; use Time::F; my $t = Time::C->from_string("2017-02-20 19:00:00", format => "%Y-%m-%d %H:%M:%S"); say strftime($t, "%d. %B, %H:%M", locale => "de_DE")'
17:23 pink_mist 20. Februar, 19:00
17:23 pink_mist works fine
17:24 litwol :'(
17:24 pink_mist the error message you said you got
17:25 pink_mist implies you set to locale to "locale"
17:25 pink_mist for some reason
17:25 purl for some reason is, like, not generated
17:28 litwol i c
17:32 litwol hmm
17:32 litwol What is the recommended way to daemonise minion workers?
17:36 litwol http://mojolicious.org/perldoc/Minion
17:36 litwol Documentation says "Background worker processes are usually started..."
17:37 litwol Which is interesting because in my env i'm running ./app minion -m production worker
17:37 litwol and command stays in foreground.
17:37 litwol also, i launched original app using hypnotoad
18:08 PryMar56 joined #mojo
18:11 rshadow joined #mojo
18:17 xorcon joined #mojo
18:18 xorcon Does it make sense to ask for a list of all named routes? I'm planning on using them for deciding when a link gets a class="active" ...
18:18 marty_ joined #mojo
18:18 rshadow joined #mojo
18:19 xorcon Mojolicious::Command::routes seems to be my friend here, but i'm not sure how good an idea it is to do that on a per-request basis
18:21 krebbit joined #mojo
19:01 rshadow joined #mojo
19:38 zach Question, what do you guys think of this idea?
19:39 zach Instead of a mojo app going and rendering templates, the front being js that is basically a REST client that makes calls to the mojo app and passes in JSON and gets JSON back and the mojo app parses the JSON and so does the JS and it does stuff based on that?
19:40 zach So, the front is mostly static in public/ and the front does its own stuff
19:43 Grinnz yes, our app is largely that (except requests are still forms, not json, but that's easy to do too)
19:44 Grinnz you will want to set up a before_render hook to customize your exception and not found pages, so they don't return HTML https://metacpan.org/pod/Mojolicious::Guides::Rendering#Rendering-exception-and-not_found-pages
19:44 Grinnz third example there
19:45 zach Grinnz: my thought is that if I do that, then when I want to build clients in other languages, say mobile, ultimately it can still use the same API backend and nothing really needs to change
19:46 Grinnz yes, our frontend does stuff with screen size and mobile clients, i dont have to worry about any of that :)
19:47 Grinnz providing an API for javascript to formulate is very powerful, just make sure that your userbase is going to be one that uses javascript
19:47 zach Grinnz: Well, I also meant like, when I have an android and iphone app it's hitting the same thing
19:47 Grinnz you could do that too
19:48 Grinnz we are mostly sticking with web dev, as that can provide a mobile experience as well
19:48 Grinnz writing apps is a whole other skillset
19:49 zach Well, yeah, but I just meant every front end, be it in a browser or phone app is just a REST client written mostly the same
19:49 Grinnz yep
19:50 zach :)
20:14 rshadow joined #mojo
20:22 rshadow joined #mojo
20:40 rshadow joined #mojo
21:11 lluad joined #mojo
21:17 disputin joined #mojo
22:14 mishanti1 joined #mojo
22:21 Ryoga joined #mojo
22:45 virgilgrimes joined #mojo
22:58 kirby joined #mojo
23:37 disputin joined #mojo

| Channels | #mojo index | Today | | Search | Google Search | Plain-Text | summary