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

IRC log for #mojo, 2017-01-28

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

All times shown according to UTC.

Time Nick Message
00:04 disputin joined #mojo
00:06 disputin joined #mojo
00:15 PryMar56 joined #mojo
00:47 aborazmeh joined #mojo
00:54 sugar joined #mojo
02:16 howitdo joined #mojo
03:43 noganex joined #mojo
05:04 dboehmer_ joined #mojo
07:12 dod joined #mojo
07:18 dod joined #mojo
08:05 kes joined #mojo
09:07 Vandal joined #mojo
10:35 sugar joined #mojo
10:43 flow joined #mojo
10:43 flow hello everyone
10:45 flow Thanks for this FAQ explanation: http://mojolicious.org/perldoc/Mojolicious/Guides/FAQ#What-does-Nothing-has-been-rendered-expecting-delayed-response-mean
10:46 flow unfortunately it does not help me right up to a solution of my problem
10:47 flow alright, so I will have to figure things out myself
10:52 flow wait ... the is no denying mojo log will rightly talk of "routing to a callback" if this callback is a ...callback instead of a controller action notation.
11:15 flow but all my callbacks render something, or reply->not_found, or return undef. The latter sort are, without exception, callbacks passed to under(), thus having Mojolicious continue trying routes.
11:31 tchaves joined #mojo
11:37 sugar joined #mojo
12:09 polettix joined #mojo
12:12 sugar joined #mojo
12:32 sugar joined #mojo
12:36 dod joined #mojo
13:45 dod joined #mojo
13:48 sri i guess Mojo::UserAgent should have a max_message_size setting, with a bigger default than 10mb
13:49 sri s/10/16/
13:50 sri $ua->on(start => sub { pop->res->max_message_size(...) }) is a bit verbose for something so commonly changed
15:40 sh14 joined #mojo
15:42 tchaves joined #mojo
15:43 tchaves1 joined #mojo
15:50 Petru joined #mojo
17:09 kiwiroy joined #mojo
17:25 Petru joined #mojo
17:48 disputin joined #mojo
17:59 dikim joined #mojo
18:11 PryMar56 joined #mojo
18:17 litwol joined #mojo
18:17 litwol Hello :)
18:34 bpmedley litwol : Morning
18:42 litwol I am very new to Mojolicious (and perl in general.. used rexify first as excuse to learn perl.. now i'm tackling mojo :-D) and find myself in situations where i can't figure out the right resource for documentation.
18:42 litwol for example, i'm looking to write a super simple *but non-blocking* form submission into database.
18:42 litwol This tutorial mentioned Mango http://blogs.perl.org/users/joel_berger/2013/11/writing-non-blocking-applications-with-mojolicious-part-2.html
18:43 pink_mist you can use Mojo::Pg in a nonblocking way
18:46 litwol Where can i find list of supported db drivers?
18:47 litwol https://github.com/kraih/mojo/wiki
18:47 litwol This mentions mongodb
18:47 litwol amongo thers
18:48 litwol thing i'm struggling with is due to my perl inexperience i am unable to judge whether some integration driver is good or not :-\
18:48 pink_mist Mojolicious doesn't support any db, because it doesn't need to
18:49 pink_mist perl has excellent db support, and there are many modules on CPAN that will add support for any of them to Mojolicious
18:49 litwol right.
18:49 pink_mist Mojo::Pg is good
18:49 pink_mist I'd suggest using that
18:50 bpmedley litwol : Another popular one is Mojo::SQLite
18:50 litwol where can i find this magical list of Mojo::[list of drivers] ?
18:50 pink_mist bpmedley: that one doesn't have any async support, does it?
18:50 bpmedley I assumed it did.  Let me look..
18:50 pink_mist litwol: start by deciding which db you want to use. then look for that.
18:50 pink_mist litwol: you're starting at the wrong end.
18:51 litwol ah :). this is for a hobby project. i'm using this as excuse to learn perl
18:51 pink_mist litwol: as I said, I would recommend you use Mojo::Pg (which is for a postgresql database)
18:51 litwol i rather start by seeing what exists, and play with it. get experience. then make decisions.
18:51 pink_mist litwol: as I said, I would recommend you use Mojo::Pg (which is for a postgresql database)
18:51 pink_mist litwol: as I said, I would recommend you use Mojo::Pg (which is for a postgresql database)
18:51 litwol :)
18:51 pink_mist jesus
18:51 litwol i would like  to know what /other/ things exist besides pg
18:52 litwol i do appreciate the suggestion though
18:52 litwol i'll try it
18:52 bpmedley pink_mist : My apologies.  Thanks for the correction..
18:52 pink_mist DBI has support for *ANY SQL DATABASE YOU CAN IMAGINE* and will work just fine with Mojolicious
18:53 pink_mist litwol: you can use LITERALLY ANY DATABASE YOU WANT TO ... I just suggest Mojo::Pg because it is *specifically* designed to work well with Mojolicious, *and* it's good
18:53 bpmedley litwol : I see async support in Mojo::mysql; however, I have not used that recently..
18:54 pink_mist yes, I think that one also supports it, but it's mysql
18:54 pink_mist so I wouldn't recommend it anyway :P
18:56 litwol i'm definitely looking in a wrong place... grepped my mojo install for 'Mojo::Pg' and didn't find anything except ./Mojolicious/Guides.pod:=item L<Mojo::Pg>
18:56 pink_mist you need to install it
18:56 bpmedley litwol : Do you have Mojolicious already installed?  Are you using cpan minus?
18:56 pink_mist just like you installed Mojolicious in the first place
18:56 pink_mist bpmedley: huh?
18:56 litwol i used gentoo's emerge mojolicious
18:56 litwol about an hour ago installed perlbrew
18:58 pink_mist if you installed perlbrew, you can use that to compile a new perl for your own usage
18:58 pink_mist and use perlbrew's cpanm to install modules from CPAN
18:59 pink_mist the stuff you install via emerge should not be used from that perl version though
18:59 bpmedley litwol : This is another way that can be used for installed perl: $ curl https://raw.githubusercontent.com/tokuhirom/Perl-Build/master/perl-build | perl - 5.24.1 /opt/perl-5.24.1
18:59 bpmedley *installed --> installing a user
19:00 litwol the thing i'd liketo avoid today is focusing on learning PgSQL. i really want to focus on perl/mojo as much as i can and rely on "what i know" for everything else... that would be the simplisity of using NoSQL database (althgouh i use mysql in other projects also)
19:00 litwol which is why i haven't jumped on the perfectly good Pg suggestion yet.
19:00 pink_mist bpmedley: he *aldready* has perlbrew ... don't make him muck things up with perl-build too. perl-build is a subset of perlbrew anyway, but since he already has perlbrew, why would he use perl-build?
19:01 pink_mist *already
19:01 bpmedley pink_mist : I hear what you're saying; however, I believe my option is valid..
19:02 litwol by the way, there does exist regular perl mongodb driver.. maybe it didn't exist back in the day when Mango came to be...
19:02 litwol what was the motivation behing creating Mango that was not fulfilled by regular perl/mongodb driver?
19:03 * litwol curious about historical/technical reasons
19:04 pink_mist most things not designed to non-blocking won't be ... and without being made for an async framework, it's unlikely to be designed to be non-blocking
19:05 pink_mist if you design things for Mojolicious, you get an async framework too, so you can design things to be non-blocking
19:05 pink_mist Mango is non-blocking
19:05 pink_mist s/designed to non-blocking/designed to be non-blocking/
19:06 bpmedley pink_mist : An answer for your question of why use perl-build is that I believe it's a simpler option..
19:06 pink_mist bpmedley: not if he already installed perlbrew
19:09 bpmedley litwol : So, you have options.  Seems the main contenders are Mojo::Pg, Mango, and Mojo::mysql.  Do you think you will consider one of those?
19:11 sri any objections to adding Mojo::UserAgent::max_response_size and defaulting to something like 2gb?
19:12 sri it would set $tx->res->max_message_size for every new transaction
19:12 pink_mist no objection from me
19:12 sri and perhaps a -S option for the get command
19:13 sri for setting that attribute
19:13 bpmedley sri : The only thing I can think of is that for an API service starting out they may get a surprise when/if users upload lots of really large files.  Although, one might think the api service would think of that scenario..
19:13 sri mojo get -S 0 mojolcious.org/foo.tar.gz would have no limit then
19:14 sri bpmedley: what?
19:14 sri it's for user agent responses
19:14 pink_mist bpmedley: that's the server's max_message_size ... sri is talking about the useragent
19:14 bpmedley Sorry
19:14 sri the server limit stays at 16mb, that's a recurity requirement imo
19:15 pink_mist ... also, afaik the max size of POSTs was never limited in the useragent...?
19:15 sri one more advantage is that for combined user agent/daemon tests it gets easier to set different values
19:16 sri pink_mist: correct
19:16 sri (i think for a time there was a bug that limited the POST body size ;p)
19:16 sri but never intentionally
19:16 pink_mist :P
19:16 howitdo joined #mojo
19:17 sri MOJO_RESPONSE_SIZE=... MOJO_MAX_MESSAGE_SIZE=...
19:17 sri MOJO_RESPONSE_SIZE would have precedence for the user agent
19:17 sri or MOJO_MAX_RESPONSE_SIZE
19:17 pink_mist with MAX sounds better to me
19:18 sri it's consistent with all the others
19:18 sri i think the feature costs us 3 lines
19:18 litwol bpmedley: yes. i'm ruling out mysql because there's nothing for me to learn by using it :). i was hoping to refresh my experience with mongodb via Mango... but got scared off it due to conversation online about Mango not being maintained (thus my arrival here to clarify things)
19:19 litwol but push come to shove, i will end up using Pg because it is 100% new to me and is a good opportunity to learn.
19:19 litwol just realling hoping (and still pulling at straws) that i somehow still manage to end up using mongodb.. even if just to confirm it works
19:19 litwol will try
19:19 tyldis litwol: I come from Oracle and MySQL world for many years and is now migratng it all to Postgres
19:21 tyldis It can also be a JSON object sotre if you want, with all the benefits of a relational database and an excellent track record for stability
19:25 litwol tyldis: how do indexes work on the JSON object?
19:26 litwol Can i do an indexed lookup based on data inside the JSON
19:26 litwol ?
19:27 bpmedley litwol : https://www.postgresql.org/docs/9.4/static/datatype-json.html <-- second paragraph, last sentence
19:27 litwol thank you!
19:29 bpmedley litwol : Have you seen https://metacpan.org/pod/Mojo::Pg::Results and https://metacpan.org/pod/Mojo::Collection?
19:30 litwol no. it's all new to me. looking at them as ya'll post those links :-D
19:30 litwol coffee have not worn off yet, so i can keep up still.
19:31 bpmedley litwol : sri wrote an amazing set manipulation library that integrates well with the Mojo database drivers, or on its own.  Really sweet.
19:33 litwol yeah i think it's best i stop trying to swim upstream while trying to learn and turn this opportunity into reason to finally acquaint with PgSQL
19:34 sri if you already know SQL it's very very easy
19:34 bpmedley litwol : https://metacpan.org/source/SRI/Mojo-Pg-2.35/examples/blog/lib/Blog/Model/Posts.pm#L12 <-- See how sweet that looks..
19:35 sri Postgres is one of the most standards compliant databases out there
19:36 litwol ty for that example link! makes things 10000% times easier for me now.
19:36 sri jberger, marcus, batman, tempire, anyone else: thoughts on what the best default for response size would be for the user agent? 2GB?
19:41 disputin joined #mojo
19:43 bpmedley Googling shows that 10 minutes of 1080p video is around 4GB.  For 720p that's under 2GB.  The other thing that would affected significantly would be Linux DVD downloads.  I wonder if a full DVD should be allowed with a -S 0.
19:53 good_news_everyon joined #mojo
19:53 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vDUvY
19:53 good_news_everyon mojo/master fa35d3b Sebastian Riedel: add max_response_size attribute to Mojo::UserAgent
19:53 good_news_everyon left #mojo
19:55 good_news_everyon joined #mojo
19:55 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vDUvC
19:55 good_news_everyon mojo/master cebedc8 Sebastian Riedel: mention the -S option too
19:55 good_news_everyon left #mojo
19:58 sri ended up costing 0 lines ;p
19:59 sri slightly more complex docs are a cost too though
20:08 bpmedley sri++
20:12 jberger woah
20:12 * jberger reads backlog
20:16 jberger litwol, yeah, sorry, those posts are starting to show their age
20:16 jberger I should probably do another series
20:20 jberger sri: +1
20:20 purl 1
20:23 stryx` joined #mojo
20:23 * jberger bops purl on the nose
20:23 * purl takes out jberger at the kneecaps
20:24 jberger :o
20:45 genio she's mean.  watch out
20:51 sri that escalated quickly :o
20:54 litwol jberger: ++
20:55 litwol That post still reads very fresh despite mention of Mango
20:55 litwol Once i'm done going through https://wiki.gentoo.org/wiki/PostgreSQL/QuickStart i'll take a swing at Mojo::Pg
21:00 sri learning postres is a timeless skill, like perl, it will help you for the rest of your career
21:00 sri *postgres
21:01 sri same for sqlite
21:07 dod joined #mojo
21:08 jberger I've been very glad I did
21:27 litwol What is psql's equivalent of my.cnf ? i want to keep connection passworded (md5) but don't want to type it all the time.
21:28 litwol pgpass
21:29 Grinnz pg_hba and pg_ident?
21:30 Grinnz you can have logins work locally without password, based on username
21:30 Grinnz and such
21:30 litwol coming from mysql experience my mind goes directly to ~/.pgpass
21:30 litwol yeah, but i want it passworded so i can use that password in an app.
21:30 litwol while using local cli for testing
21:31 litwol https://wiki.postgresql.org/wiki/Pgpass
21:36 litwol k. .pgpass works when proviging password for given connection string.
21:36 litwol BUT
21:37 litwol it still requires me to use '-U' flag to pass username.
21:37 litwol off to google how to specify default username
21:37 sri and now i wonder if Mojolicious::max_request_size should exist too
21:39 disputin joined #mojo
21:43 litwol export PGUSER did the trick.
21:46 good_news_everyon joined #mojo
21:46 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vDUke
21:46 good_news_everyon mojo/master d064ea2 Sebastian Riedel: recommend max_response_size instead of max_message_size
21:46 good_news_everyon left #mojo
21:52 good_news_everyon joined #mojo
21:52 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vDUkO
21:52 good_news_everyon mojo/master d224a0b Sebastian Riedel: there is no need to mention the limit everywhere
21:52 good_news_everyon left #mojo
21:58 good_news_everyon joined #mojo
21:58 good_news_everyon [mojo] kraih pushed 1 new commit to master: https://git.io/vDUk6
21:58 good_news_everyon mojo/master 644e4df Sebastian Riedel: remove a few more mentions of the 16MB limit
21:58 good_news_everyon left #mojo
22:09 litwol huge props to psql tutorial for having hands-on examples that when executed produce results as documented. absolutely loving the "you should see X" in every example.
22:11 disputin joined #mojo
22:11 jberger litwol also there are two example applications in the Mojo::Pg dis
22:11 jberger *dist
22:11 jberger https://github.com/kraih/mojo-pg/tree/master/examples
22:11 jberger for even more hands-on
22:11 litwol kk. i'm heading there after this "learn psql nao!" detour
22:13 jberger hehe
22:15 litwol all i wanted some months back is to learn some automation via Rexify. picked up perl from that. fast forward to now i'm stuck learning all this new stuff.
22:15 litwol you! sneaky educators you!
22:15 * litwol shakes head
22:17 stephan48 vgcccccccccccccccgcp
22:18 stephan48 aeh sorry. that was a cat.
22:18 jberger litwol: ha! we caught you!
22:18 jberger stephan48: hahahahaha
22:18 purl LOLCON 5 reached.
22:18 stephan48 she even managed to detach my tmux.
22:18 stephan48 ;)
22:35 batman joined #mojo
23:01 litwol Following examples in various pages (i'm now starting to glue mojo+pgsql)
23:01 litwol http://mojolicious.org/perldoc/Mojolicious/Guides/Growing#Model
23:02 litwol i meant to post this: http://mojolicious.org/perldoc/Mojo/Pg
23:02 litwol Example is showing: helper pg => sub { state $pg = Mojo::Pg->new('postgresql://postgres@/test') }
23:02 litwol However when i paste this (including ; )  and save my file, i get warning
23:02 litwol syntax error near "helper pg"
23:03 litwol i'm using this inside an app controller.
23:03 * litwol hmms
23:03 pink_mist are you making a Mojolicious::Lite application?
23:03 litwol no
23:04 pink_mist then you can't use that syntax
23:04 litwol use Mojo::Base 'Mojolicious';
23:04 litwol i c
23:04 pink_mist you need to translate the Mojolicious::Lite syntax into the full app syntax
23:04 pink_mist see the Growing guide
23:04 litwol i am looking to produce a "singleton" db connection? actually not sure what's the right thing to use here. i may be even applying wrong expectations..
23:04 pink_mist http://mojolicious.org/perldoc/Mojolicious/Guides/Growing
23:04 litwol i want to declare db connection in 1 place an reuse it
23:05 pink_mist the code you had was correct ... you just need to translate it from Mojolicious::Lite syntax to full app syntax
23:05 Grinnz also, you generally define helpers in app startup, not in controllers
23:06 litwol oh. $self->helper
23:09 litwol silly question.. but what is the full syntax of a connection string? my $pg = Mojo::Pg->new('postgresql://postgres@/test');
23:10 litwol i'm assuming first part is protocol, then username.. password is omited, and test is db?
23:12 bpmedley litwol : https://metacpan.org/pod/Mojo::Pg#from_string  <-- I believe new() uses from_string for parsing..
23:12 litwol oh! ty
23:13 mishanti1 joined #mojo
23:14 bc547 joined #mojo
23:16 howitdo joined #mojo
23:23 litwol something happened and generated app stopped reloading files after they are modified :(
23:24 litwol templates now render once and don't change
23:24 litwol strange
23:29 bpmedley litwol : Anything in the logs?  Are you using -v option of morbo?
23:29 litwol I'm using ./myapp.pl daemon -m development.
23:30 litwol i think that may be my mistake
23:30 litwol yep
23:30 litwol works now
23:30 litwol bpmedley: ty for reminding of morbo
23:31 bpmedley litwol : There's a lot of new stuff when 1st starting out.  Thanks for sticking around..
23:32 litwol my $version = $controller->pg->db->query('select version() as version')->hash->{version};
23:33 litwol $controller->stash('version', $version); + $controller->stash('title', $version);
23:33 litwol in my template i have <%= title %> , and it works! (yey!).
23:33 litwol but if i try <%= version %>, i get explosive errors.
23:35 bpmedley litwol : Do you have $ on title and version in your code?
23:35 litwol no $ on title, i tried also not including $ on version. title works without $
23:35 litwol ah! adding $ on version now works too
23:36 litwol ohhhh. maybe 'title' is mojo's internal helper or something
23:36 bpmedley litwol : http://mojolicious.org/perldoc/Mojolicious/Plugin/DefaultHelpers#title <-- could be a function call
23:36 sri title is a helper
23:36 litwol ah. makes sense
23:42 batman joined #mojo
23:42 sugar joined #mojo
23:59 saki joined #mojo

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