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

IRC log for #mojo, 2017-12-28

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

All times shown according to UTC.

Time Nick Message
00:33 dugword joined #mojo
01:48 purl joined #mojo
02:51 FROGGS__ joined #mojo
03:05 arcanez joined #mojo
03:25 jberger imo those are too different things
03:25 jberger s/too/two/
03:26 jberger If you want some other validation error then you still want the route to match
03:27 jberger Meaning you want the route to handle it, even if the validation is not satisfied
03:32 schelcj joined #mojo
03:35 mohawk for me the question is, what value is there in restrictive placeholders?
03:35 mohawk what is the use case?
03:42 mohawk (i opened a PR with a couple of gremlins i found in the morbo test so far)
04:17 namotco joined #mojo
05:04 dboehmer_ joined #mojo
06:20 Vandal joined #mojo
07:11 jamesaxl joined #mojo
07:33 inokenty-w joined #mojo
08:16 geospeck joined #mojo
08:34 trone joined #mojo
08:44 bianca joined #mojo
09:29 hkclark joined #mojo
09:30 bianca joined #mojo
09:52 geospeck joined #mojo
09:52 dod joined #mojo
09:57 dod joined #mojo
10:21 aborazmeh joined #mojo
10:34 bianca joined #mojo
10:41 batman does anyone lazy load images on their website? what do you think about this? https://github.com/jhthorsen/mojolicious-plugin-lazyimage
10:41 mohawk lazy loading is great
10:49 batman :)
10:49 batman want to add support for <picture>... https://github.com/jhthorsen/mojolicious-plugin-lazyimage/issues/1
10:50 batman but once i do that, i might as well just have done <%= lazy begin %> ... <% end %> i guess...
10:50 batman maybe i should rename it to Mojolicious::Plugin::Lazy ?
10:50 mohawk if it's more than images, why not?
10:50 tchaves joined #mojo
10:51 batman not sure what else to lazy load though
10:53 mohawk fonts?
10:54 batman why would you lazy load fonts, and how would you do it with a tag?
10:54 mohawk fonts can approach being quite large, and search me
10:55 batman "search me" ?
10:55 mohawk (means "i don't know" :-)
10:55 batman people have written a lot about how to preload fonts to prevent the site from "changing" after load... i think the problem is the other way around mostly
10:55 mohawk fair enough
10:57 stephanj batman++ # re lazyimage: i was about to rant that it won't work without javascript - but bothered to actually read the readme. gj for finding a suitable workaround
10:58 batman stephanj: hehe, yeah. i know the feeling ;)
11:12 kes joined #mojo
11:35 bianca joined #mojo
12:11 geospeck joined #mojo
12:14 geospeck joined #mojo
13:10 mariusz_w joined #mojo
13:57 ChmEarl joined #mojo
14:05 elderling joined #mojo
14:36 mib_nfhhep joined #mojo
15:25 anon joined #mojo
15:34 anon hi all! I need help: how can i process multiupload arguments? The 'files[]' parameter contains an array -- ["quasar.jpg","...","...",...], but how do i get it? my raw function http://dpaste.com/1NPKB9E, but as a result only one element from array is processed "DEBUG:: IMAGE: quasar.jpg"
15:36 geospeck_ joined #mojo
15:36 batman anon: that paste must be wrong... anyways, maybe this is what you want? http://mojolicious.org/perldoc/Mojo/Message#every_upload
15:38 batman my $uploads = $c->req->every_upload('files[]');
15:38 dod joined #mojo
15:39 batman $uploads will be an array ref with zero or more http://mojolicious.org/perldoc/Mojo/Upload objects
15:40 anon No, i uploading files via ajax, and send form with parameter files[] containing file names
15:41 anon after ajax upload
15:42 batman then you want every_param()
15:43 batman or is it just one param with a json encoded string..?
15:43 batman like $names = Mojo::JSON::decode_json($c->param('files[]'));
15:44 orev joined #mojo
15:47 * batman stops guessing
15:47 anon in my params: http://dpaste.com/3XDWZ0F, i think i need use every_param, thank
15:53 anon yeh, i write  foreach my $image (@{$self->every_param('files[]')}) { and so works, good, thank
15:57 maschine joined #mojo
15:59 sh14 joined #mojo
16:36 disputin joined #mojo
17:12 batman cool!
17:16 gblade joined #mojo
17:21 gblade Hello, is there a config setting to change the hypnotoad production.log location?
17:24 Grinnz gblade: you need to set the path for the log object. you can either use https://metacpan.org/pod/Mojo::Log::Role::Clearable to ensure the existing handle is cleared when doing this in startup, or you can provide your own default for the log attribute instead of the base one https://metacpan.org/source/SRI/Mojolicious-7.59/lib/Mojolicious.pm#L30-42
17:25 Grinnz or you can use https://metacpan.org/pod/Mojolicious::Plugin::Log::Any to make use of an entirely different logging system. lots of options
17:27 gblade Grinnz: Thank you for the suggestions
17:30 dod joined #mojo
17:34 hesco joined #mojo
17:36 disputin joined #mojo
17:37 hesco I just introduced Mojolicious to an existing code base in an effort to upgrade it.  Code which has cooperated with me until run inside a mojo app is now confused by where to get its dependencies.  I've outlined the issue here:  http://perlmonks.com/?node_id=1206342 and would appreciate any feedback folks might share on this issue.
17:39 hesco1 joined #mojo
17:42 Grinnz hesco: are there multiple perls installed on the system? what does `perl -Ilocal/lib/perl5 -MList::Util\ 999` say?
17:57 hesco1 Can't open perl script "999": No such file or directory
17:58 hesco1 @Grinnz:  Can't open perl script "999": No such file or directory
17:58 Grinnz sorry, add -e1 also, and the backslash is important
17:59 hesco1 @Grinnz:  ok, I see where you are going:
17:59 hesco1 List::Util version 999 required--this is only version 1.49.
18:01 Grinnz try removing 'use Data::Dumper' before your BEGIN block
18:01 Grinnz (or move it after)
18:02 hesco1 List::Util version 1.45 required--this is only version 1.38 at
18:03 Grinnz is there an /opt/local/vote/vagrant/cf_vote/lib directory?
18:03 hesco1 deleting the `use Data::Dumper;` and the call which depends on it yields exact same results.
18:05 batman i wonder if it would be accepted if i suggest adding Mojo::Whatever to many of the bulletpoints here: https://github.com/hachiojipm/awesome-perl :)
18:05 hesco1 yes, that is both the legacy libs, as well as the path the my new module which seeks to refactor the controller aspects of the scripts/ path.
18:05 Grinnz er, you are putting that first in @INC, so if your older List::Util is there it will be loaded
18:06 hesco1 it is not there.
18:06 Grinnz `perl -Ilib -MList::Util -E'say List::Util->VERSION; say $INC{'List/Util.pm'}'`
18:06 hesco1 @Grinnz: the only installation of the problematic 1.38 version is in the path removed from @INC by my grep processing in the BEGIN block.
18:07 Grinnz please try that?
18:07 Grinnz er, "List/Util.pm"
18:07 Grinnz so the quotes don't conflict...
18:09 hesco1 root@vote:/opt/local/vote/vagrant/cf_vote# perl -Ilib -MList::Util -E'say List::Util->VERSION; say $INC{"List/Util.pm"}'
18:09 hesco1 1.38
18:09 hesco1 /usr/lib/x86_64-linux-gnu/perl/5.20/List/Util.pmy
18:10 Grinnz can you paste the output of perl -V somewhere? like perl.bot
18:12 Grinnz you have a lot of weird lib dirs here and i'm curious where they each come from
18:14 Grinnz can you also paste the output of `perl -V:.*lib`
18:15 trone joined #mojo
18:15 disputin joined #mojo
18:17 hesco1 Grinnz: as requested:  https://gist.github.com/hesco/4cacbcbdd85978992b90d48d61b4206b
18:19 lucasmoraes joined #mojo
18:19 lucasmoraes Hi all
18:19 hesco1 I have updated the original gist to add the output of your second query.
18:22 lucasmoraes I'm not find problem in my app
18:22 lucasmoraes this error: Can't use an undefined value as an ARRAY reference at /var/www/api/script/../lib/API/Model/Errors.pm line 35.
18:23 lucasmoraes I'm using Mojolicious::Plugin::Model and Moo
18:24 Grinnz hesco1: sorry i missed some, can you also add `perl -V:.*arch`
18:25 Grinnz i think that explains most of the dirs, but is this a normal layout for debian
18:25 Grinnz ?
18:25 lucasmoraes I will add code in pastebin first
18:25 Grinnz core in /usr/share/perl/5.20 and vendor in /usr/share/perl5 seems awkward
18:26 geospeck joined #mojo
18:26 gblade left #mojo
18:28 hesco1 Grinnz: please reload my gist, see last file added.
18:28 lucasmoraes code
18:28 lucasmoraes https://pastebin.com/LR7ttSij
18:28 jnbek_ joined #mojo
18:29 bc547_ joined #mojo
18:29 pink_mis1 joined #mojo
18:29 coolo_ joined #mojo
18:29 Grinnz_ joined #mojo
18:29 lucasmoraes I tested code similar only with Moo and work
18:29 Eke_ joined #mojo
18:29 anon_ joined #mojo
18:29 trone_ joined #mojo
18:29 Grinnz_ well that was odd
18:30 da5id_ joined #mojo
18:30 karjala_ joined #mojo
18:30 mishantil joined #mojo
18:30 dotan_convos joined #mojo
18:30 kgoess joined #mojo
18:30 lucasmoraes https://pastebin.com/AVhF2NaN
18:30 Repaster Repasted text from lucasmoraes: https://perl.bot/p/liw7h2
18:30 jamesaxl joined #mojo
18:30 Grinnz hesco: thank you, that looks coherent, though weird, i assume its just how debian sets it up
18:31 Grinnz hesco: i think i figured out the issue, anyway. you are unshifting dirs directly into @INC, but that does not include the arch dirs which are required for XS modules like Scalar::Util. you need to use lib.pm instead to do it the correct way
18:31 Grinnz hesco: and please remove that @INC grep, it's a terrible idea :P
18:32 Grinnz hesco: so something like: use lib "$FindBin::Bin/../lib", "$FindBin::Bin/../local/lib/perl5", "$FindBin::Bin/../lib/perl5";
18:32 eseyman joined #mojo
18:32 lucasmoraes attribute not can be undefined because have deafult
18:33 brunoramos joined #mojo
18:33 Grinnz hesco: the 5.20.2 directories are your sitelib btw, so any modules installed by a CPAN client rather than a package manager will be there (it's not recommended to do this in general with system perl)
18:34 kivilahtio joined #mojo
18:34 robx joined #mojo
18:34 go|dfish joined #mojo
18:34 Grinnz but if you use lib.pm correctly then any modules in those libs will override it anyway
18:34 hesco1 As for standard debian practice, I cannot say.  My Vagrantfile used to create this vm, uses this base box:  debian/jessie64_ga.  Without digging back in to the project which created my local base vagrant box, I can tell you from memory, jogged by this name that this was built from the publicly accessible debian/jessie64 box, with the ga indicating the installation of VirtualBox guest additions, and some
18:34 hesco1 additional minor changes made to facilitate its use in my development (keys, host signatures, etc).
18:35 mishanti1 joined #mojo
18:36 Grinnz lucasmoraes: this is not really a mojo related question... but your attribute should be lazy
18:37 Grinnz not sure if that will fix your issue
18:37 lucasmoraes Grinnz: only using Moo work
18:37 lucasmoraes see this code: https://pastebin.com/AVhF2NaN
18:37 Repaster Repasted text from lucasmoraes: https://perl.bot/p/clt3v3
18:37 lucasmoraes only Moo
18:37 Grinnz ...yes, and?
18:38 lucasmoraes but in Mojo not work same code, I need know if have conflict?
18:38 Grinnz lucasmoraes: i really need to see the code that's actually have an issue to advise
18:39 lucasmoraes https://pastebin.com/LR7ttSij
18:39 Repaster Repasted text from lucasmoraes: https://perl.bot/p/6yktr5
18:39 Grinnz ah, you are using mojo and moo for one object
18:39 Grinnz so the constructor is provided by mojo, it won't initialize that default
18:40 Grinnz if you make it lazy like i mentioned, it might work
18:40 Grinnz that's the only problem with using both object systems together, only one of them can provide the constructor
18:41 Grinnz lazy means the default will be initialized when the attribute is accessed instead of in the constructor. it's a good idea to do it anyway
18:42 lucasmoraes Grinnz: thanks :)
18:42 lucasmoraes work
18:42 lucasmoraes I added lazy
18:43 Grinnz Settings.pm looks a little weird though. you are setting up multiple inheritence which could be confusing or cause problems later. have you tried roles?
18:43 Grinnz API::Model::Errors could be a role for example
18:44 lucasmoraes I'm using two inheritence
18:44 lucasmoraes file Errors and Successes
18:44 Grinnz MojoX::Model might also be a good role, depending what it is
18:44 Grinnz since it looks like it's common code shared by your classes
18:45 Grinnz oh nevermind, that is a cpan module
18:45 hesco1 Thanks Grinnz:  `use lib . . . ` changes up the error message, something new to look at.  thanks.
18:46 Grinnz hesco1: as a side note, I recommend against using FindBin, I prefer an approach using __FILE__ as detailed in https://metacpan.org/pod/lib::relative
18:46 lucasmoraes I use two files in all models
18:46 Grinnz hesco1: there's an example there for how to do it without actually having to install lib::relative, for just that sort of situation
18:47 Grinnz hesco1: didnt want to mention it while debugging the actual lib loading issue though
18:47 genio Grinnz: curiosity. why File::Basename::dirname(__FILE__) over $FindBin::Bin
18:47 Grinnz FindBin is complicated and has been broken at times, and depends on how you initialized the program (which can be a problem with things like mojo apps which are initialized many different ways)
18:48 genio bah. nevermind. I can read the description
18:48 Grinnz __FILE__ is simple and always refers to the current source file being parsed
18:48 bianca joined #mojo
18:48 maschine joined #mojo
18:50 Grinnz lucasmoraes: i'm saying it will probably be simpler if you make API::Model::Errors into a Moo::Role, not inheriting from MojoX::Model itself
18:51 Grinnz and then apply it with 'with'
18:51 Grinnz rather than adding a second inheritance to your class that's already inheriting from MojoX::Model
18:52 lucasmoraes Grinnz: understand, I'm doing changes
18:52 Grinnz lucasmoraes: read the Moo::Role and Role::Tiny docs and you can see what you think
18:53 lucasmoraes yes, I'm read Role::Tiny
18:53 lucasmoraes Grinnz: Thanks
18:56 geospeck joined #mojo
18:59 geospeck_ joined #mojo
19:07 bianca joined #mojo
19:37 karjala_ joined #mojo
19:46 lucasmoraes Grinnz: I added Role, simple changes
20:00 mishantil joined #mojo
20:05 mishanti1 joined #mojo
20:08 disputin joined #mojo
20:27 chansen joined #mojo
21:22 bianca joined #mojo
21:26 hkclark joined #mojo
21:32 maschine joined #mojo
21:37 [1]mohawk joined #mojo
21:40 bianca joined #mojo
21:47 a6502 joined #mojo
22:03 lucasmoraes left #mojo
22:19 mohawk nice support, Grinnz!
22:58 mohawk sri, i didn't realise that not documenting environment variables was policy. my thinking was based on that fact that in docker-land, the "correct" way to configure everything is through environment variables
23:00 Grinnz mohawk: i don't think it's so much policy, but that there are many undocumented environment variables used internally by mojolicious that shouldn't be used except by experienced users who read the source
23:00 Grinnz and whether that one should be documented should be a discussion separate from your PR
23:01 Grinnz especially in this project, PRs should do only one thing
23:04 mohawk it may be unstated policy, but on the face of it it seems to actually be policy ;-)
23:05 mohawk i'm happy to zap the doc bit of my PR entirely. clearly my assumption that documenting those things would be seen as good was wrong
23:05 Grinnz as i said, that's not even the question yet. it just shouldn't be done in that PR
23:06 Grinnz he would have had the same response if you fixed some typo in the pr
23:06 Grinnz unrelated typo*
23:06 mohawk sure, and the "only do exactly one exact thing" was a little unclear as well
23:07 Grinnz that's just general git etiquette. maybe more common in this project than most, but still
23:07 mohawk i've contributed a little bit to a couple of other open-source projects
23:08 mohawk i thought i had a good grasp of general git etiquette
23:10 mohawk if i remove the doc update, is it going to be ok to reopen the PR? for no very good reason, i like to not waste PRs
23:10 Grinnz if you do that, you should rebase/squash the branch and force push it so it has a clean commit history
23:11 Grinnz as for reopen vs open a new one dunno what sri prefers
23:11 mohawk i will, naturally. however i'm just asking because github doesn't let you reopen if you've force-pushed in the meantime
23:11 mohawk well i'll go ahead and reopen then force-push, and take the consequences ;-)
23:11 Grinnz it can always be re-closed :P
23:13 mohawk seems i'm unable to reopen it
23:55 mohawk commented further, turns out part of my change was not strictly necessary - although i argue still desirable
23:59 mohawk (and part is still necessary according to me)

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