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

IRC log for #mojo, 2015-12-29

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

All times shown according to UTC.

Time Nick Message
00:01 PryMar56 joined #mojo
00:03 hgichon joined #mojo
00:48 mspo joined #mojo
00:49 mspo is this correct for adding search paths in a lite app? unshift (@{app->static->paths}, "public/foo");
00:49 mspo it seems to be putting it in over and over and over again
00:52 asarch joined #mojo
01:00 bpmedley joined #mojo
01:00 mspo I guess the app object isn't reset so that makes sense
01:26 punter joined #mojo
03:13 noganex_ joined #mojo
03:19 damaya joined #mojo
04:04 kaare joined #mojo
04:28 inokenty-w joined #mojo
05:18 YingzhiLin joined #mojo
05:22 jberger mspo: are you putting that into a route handler?
05:28 melo joined #mojo
06:44 melo1 joined #mojo
06:44 melo2 joined #mojo
07:05 crux joined #mojo
07:35 melo joined #mojo
07:45 damaya joined #mojo
08:10 damaya joined #mojo
08:14 melo joined #mojo
08:22 Vandal joined #mojo
08:23 damaya joined #mojo
08:25 eseyman joined #mojo
08:37 damaya joined #mojo
09:05 dod joined #mojo
09:10 dod joined #mojo
09:18 dvinciguerra joined #mojo
09:55 sue joined #mojo
10:05 damaya joined #mojo
10:17 melo joined #mojo
10:25 martin joined #mojo
10:37 jontaylor joined #mojo
10:42 damaya joined #mojo
10:54 cpan_mojo Swagger2-0.66 by JHTHORSEN https://metacpan.org/release/JHTHORSEN/Swagger2-0.66
11:13 MartinR joined #mojo
11:25 ashimema joined #mojo
12:02 kaare joined #mojo
12:13 sue joined #mojo
13:01 trone joined #mojo
13:30 asarch joined #mojo
13:36 jontaylor_ joined #mojo
13:36 KindOne_ joined #mojo
13:38 marty_ joined #mojo
13:40 cstamas joined #mojo
13:48 damaya joined #mojo
13:52 talexb_ joined #mojo
13:52 Andreas joined #mojo
13:55 mikegrb joined #mojo
13:56 haarg joined #mojo
14:23 cpan_mojo Mercury-0.008 by PREACTION https://metacpan.org/release/PREACTION/Mercury-0.008
14:32 dvinciguerra joined #mojo
14:34 zivester joined #mojo
14:45 jb360 joined #mojo
14:51 neilhwatson joined #mojo
14:52 orev joined #mojo
14:54 sh4 joined #mojo
15:13 mspo jberger: I had it in a hook
15:13 mspo jberger: I am dynamically figuring out where to look for stuff
15:13 mspo I'll be doing similar stuff with templates too, as I keep coding
15:28 haarg joined #mojo
15:36 gryphon joined #mojo
15:39 jberger mspo: depending on the hook,  hooks are fired on each request
15:39 mspo yah I think that was the issue
15:40 mspo so I'm just resetting it each time
15:40 jberger mspo: have you read the guides in order?
15:40 jberger You shouldn't need to guess on most of this stuff
15:40 mspo jberger: tough to say; maybe ;)
15:41 jberger http://mojolicio.us/perldoc
15:41 mspo I don't think putting the static paths into a hook was covered in what I read
15:41 mspo just a thing to figure out
15:42 jberger Right, it wouldn't go in a hook because you wouldn't want to do that on each request
15:42 jberger That would do in the startup
15:42 jberger s/do/go/
15:42 MartinR Mojo:base attributes are always private ?
15:43 jberger MartinR: ?
15:44 jberger Perl has no way to make private methods, by convention if they start with an underscore they are understood to be private
15:44 mspo jberger: I'm dynamically setting the file search path per-request intentionally
15:46 jberger mspo: the search path is effectively a property of the app not of the request
15:46 MartinR jberger, yes so how to make class variable (or any data) private ?
15:47 jberger mspo: so doing that in a hook isn't necessarily going to do what you intend
15:48 MartinR ok never mind, I found it
15:48 jberger MartinR: name the attribute with an underscore
15:49 jberger Class data can sometimes be in a lexical, but that might be hard to keep track of, especially in a preforking environment
15:50 MartinR ok
15:51 MartinR btw, is there any resource/example whatever, which demonstrates design pattern with perl and Mojo:Base ?
15:51 jberger MartinR: have you read the guides?
15:52 mspo jberger: seems to work
15:52 MartinR well, I don't think this question is related to mojolicious guides ;)
15:52 jberger Mojo::Base is a very restricted class builder
15:52 MartinR but yes I have read it .. months ago
15:53 jberger It only does one thing, it makes lazy accessors with chainable setters
15:54 Grinnz_ and a constructor!
15:55 MartinR ok but you can exploid all popular OO features so what's the point ?
15:55 jberger Grinnz_: sorry yes, and a constructor for hash based objects
15:55 MartinR exploit*
15:56 Grinnz_ MartinR: point of what?
15:56 jberger MartinR: if you need more than that use Moo(se)?
15:56 jberger I haven't tried mojo with Dios yet but that should work too
15:57 MartinR sorry Dios ?
15:57 jberger Another  class builder thing, from damian
15:58 MartinR ok
16:02 MartinR Mojo object doesn't have to be deleted/destroyed as it is in c++, correct ?
16:03 MartinR and I think plain vanila perl OO system also requires object destruction
16:05 Grinnz_ objects are destroyed when they go out of scope like anything else
16:06 MartinR ok, thanks
16:09 bpmedley joined #mojo
16:32 trone joined #mojo
16:51 jberger Zoffix (via log): http://sdtimes.com/christmas-perl-arrives/
16:51 jberger which post to they link to as the release? Larry's
16:53 lluad joined #mojo
17:10 trone_ joined #mojo
17:21 kes joined #mojo
17:31 punter joined #mojo
18:05 csson joined #mojo
18:23 PryMar56 joined #mojo
18:32 MartinR where to paste ?
18:33 Grinnz_ i use fpaste.org, theres a shadowcat one i dont have handy
18:34 MartinR ok let it be there ;)
18:34 MartinR so I wanted to implement decorator pattern in Mojo:Base, very simple example
18:35 MartinR I would be very thankful for opinions -> http://ur1.ca/od4gs
18:35 MartinR ;)
18:36 Grinnz_ you might want Moo or similar so you get things like triggers, coercion...
18:36 Grinnz_ Mojo::Base is "just objects", if you want to do complicated things I wouldn't force them into it
18:36 Grinnz_ oh, and also roles.
18:37 Grinnz_ though you can apply Role::Tiny to a Mojo::Base object fine
18:37 Grinnz_ and a Moo::Role would *probably* work sometimes
18:37 Grinnz_ (you wouldn't get constructor effects like non-lazy attribute defaults and required attribute checks)
18:38 Grinnz_ but at that point you're basically already using Moo anyway
18:38 MartinR Grinnz_, ok, it's nice note but I think mojo base will be just enough for my website so, at least I would like to start only with it
18:40 Grinnz_ a couple notes on your example, "Undef" is not the same as undef
18:41 Grinnz_ and that can be written as just: has 'name';
18:41 Grinnz_ also, i feel like the names and costs would be better stored in an array than a string
18:41 Grinnz_ at least, the names
18:42 Grinnz_ but i'm not sure how relevant this example was supposed to be ;)
18:42 MartinR Grinnz, I just wanted to add some name to original object, speaking about attributes, well I could but it isn't that important, it's not what this whole example is about
18:42 Grinnz_ if you wanted to try roles, Laptop and Accessories would make good roles
18:43 MartinR ok
18:44 jberger MartinR: I don't know why you'd want to string concat those in place, how would you say remove an item?
18:44 jberger Your data can contain the added elements and then have a method which returns a textual representation
18:44 MartinR jberger, fair point
18:44 Grinnz_ yeah thats all i was getting at
18:45 jberger Less limiting
18:46 MartinR but the question is how and where do you expect to store that addiotional information ?
18:46 MartinR I mean these "decorated" details
18:46 Grinnz_ however you want... arrays, hashes
18:47 Grinnz_ the internal representation is your choice, the public API can map to it as needed
18:47 Grinnz_ note that both Mojo::Base and Moo attributes can default to an empty array or hash by passing a subroutine default (has foo => sub { [] };)
18:48 jberger Grinnz_++
18:49 MartinR hmm sounds interesting
18:56 MartinR but how do you want to keep track of these additional feature from main boject in the example Model 1 ?
18:57 Grinnz_ you're the one designing it! :P
18:57 jberger MartinR: Mojo::Base is incredibly minimal
18:57 MartinR on soultion would be to define array of new feture in Model 1 but then a lot of work to list what was added
18:57 jberger does the common things and gets out of your way
18:57 MartinR heh I see ;)
18:58 jberger as far as design patterns, you're on your own
18:58 Grinnz_ MartinR: not really a lot of work. there are functions and modules that make working with lists and arrays simple
18:59 Grinnz_ MartinR: you would generally define the method which lists the features in the abstract base class or role
18:59 Grinnz_ assuming it's common to all consumers
18:59 MartinR yes it is, ok
18:59 Grinnz_ in this instance, you could do a simple join of the array elements, or use a module to format them somehow
19:00 MartinR btw, what are the most important/worth studying design patterns which you use in perl design ?
19:01 Grinnz_ "whatever makes my code cleaner"
19:01 Grinnz_ personally the only ones that come to mind are things like roles, singleton, delegation
19:03 MartinR ok, thanks
19:09 ZoffixW joined #mojo
19:10 ZoffixW jberger, they are who? The post seems to be incredibly confused about what "official final release of Perl 6" is :S RE: http://sdtimes.com/christmas-perl-arrives/
19:12 ZoffixW Almost sounds like a crawler robot wrote it by scrounging various news websites.
19:13 MartinR going back to may decorator example, I also think that there is too much unnecessary inheritance i.n the whole Accessories class should probably be removed at all...
19:14 MartinR I relied on this UML diagram -> https://upload.wikimedia.org/wikipedia/commons/thumb/e/e9/Decorator_UML_class_diagram.svg/960px-Decorator_UML_class_diagram.svg.png
19:15 MartinR It should that inheritance but I think in Perl it doesn't make sense
19:15 MartinR s/should/shows
19:26 Grinnz MartinR, if you end up with attributes or methods common to accessories, it would be useful; in your example yes it is superfluous
19:41 trone joined #mojo
19:44 MartinR also, developing web apps with mojolicious limit the amount of design decisions because the framework do most of what you have to accomplish
19:45 jberger ZoffixW: ummm, yeah, reporters are basically crawler bots :-P
19:45 jberger if we were confused so too will be everyone else
19:49 jberger ZoffixW: did anyone actually send out a press release?
19:56 ZoffixW jberger, I meant the writing is so... all over the place, it makes me feel I could write a script to churn out articles like these... "The process has paralleled the development of the Rakudo virtual machine, an all-purpose engine for running interpreted languages, known as the Moar virtual machine." ???... "With the release of Rakudo, however, this is the first time developers can build with Perl 6, and then validate their code with t
19:56 ZoffixW he compiler." ????   Not to mention it IS the official release of Perl 6 as was stated 3 days prior to when this article was written on the same blog the person who wrote that linked to. Sorry, but if it's not a script that wrote that, then it's just incredibly sloppy journalism and I refuse to accept the "confused as everyone else"
19:56 ZoffixW jberger, I dunno about pres-releases. I was drinking and gaming the entire holidays. I wasn't following anything.
20:05 lluad I trust https://www.perl.org - and they say that the latest release is 5.22.1
20:05 lluad Anything you see labeled "perl 6" is a figment of your imagination.
20:06 jberger lluad: that's because perl5 and perl6 are different languages
20:06 * ZoffixW nods
20:06 lluad I know that.
20:06 ZoffixW -_-
20:06 lluad I'm not sure that it's neccesarily clear to people who haven't been following along for the past decade, though.
20:07 ZoffixW It isn't.
20:07 ChmEarl joined #mojo
20:08 lluad Though perl6.org doesn't mention any recent perl 6 related news either.
20:08 ZoffixW Yes. We don't care. It's holidays.
20:18 mspo how do I add a raw header?
20:18 mspo like if I get it in the format Foo: bar
20:19 ZoffixW mspo, add where?
20:20 ZoffixW https://metacpan.org/pod/Mojo::Headers#add  ?
20:20 jberger ZoffixW: "Yes. We don't care. It's holidays." ummmm, you released your .0 of your language
20:20 jberger someone should care
20:21 ZoffixW jberger, which is why I'm currently working on the commit to add a message on perl6.org :P
20:21 mspo ZoffixW: that accepts Header => value, not Header: value
20:22 ZoffixW mspo, ah, I get ya now
20:22 mspo ZoffixW: I'm just doin ($header,$val) = splut(':' $foo, 2); ...->append($header, $val)
20:22 ZoffixW mspo, I'd just split it on ':' :), but that's me. Maybe there's a ->parse method somewhere
20:22 mspo just felt a little nasty
20:22 mspo ZoffixW: parse doesnt' do what you think
20:23 mspo or what I think ;)
20:23 ZoffixW Oh, there *is* a parse method! :)
20:23 mspo it makes an object that also didn't split the header up
20:23 Grinnz_ ZoffixW++ # despite the issues, doing good work on perl6.org
20:24 mspo the parsed header:
20:24 mspo $VAR1 = bless( {
20:24 mspo 'max_line_size' => 8192,
20:24 mspo 'cache' => [],
20:24 mspo 'max_lines' => 100,
20:24 mspo 'state' => 'headers',
20:24 mspo 'buffer' => 'Location: http://www.google.com'
20:24 mspo }, 'Mojo::Headers' );
20:24 Grinnz_ don't paste lines into irc please
20:24 mspo sorry
20:24 mspo I was impressed by the mobile friendliness of docs.perl6.org
20:25 * ZoffixW hasn't done any work on that one
20:25 Grinnz_ mspo: i'd just look at the source of https://metacpan.org/source/SRI/Mojolicious-6.38/lib/Mojo/Headers.pm#L84, and use its regex to split up the header
20:26 mspo the above hack is good enough for now, thanks
20:26 Grinnz_ it probably didn't split yours up because you didn't end it in \r\n
20:30 sue joined #mojo
20:32 ZoffixW lluad, it does now :P  http://perl6.org/
20:32 lluad Yay!
20:34 mspo yay I'm now virtual hosting with dynamic static file paths and site-specific database blob files
20:34 mspo next to give template paths the same treatment and I think I'm in business
20:58 dvinciguerra joined #mojo
21:24 dvinciguerra joined #mojo
21:28 nnutter joined #mojo
21:57 MartinR hmm what couses this error "...Can't find application class "TestApp" in @INC...." ?
21:58 MartinR I use "morbo -v -m development C:\PATH\test_app" and it's full app
21:59 Grinnz_ I don't believe morbo supports win32
22:00 MartinR well I am backing to this code after few moths but it was working in the past...
22:00 MartinR *months
22:01 Grinnz_ can you paste the test_app contents?
22:03 MartinR sure, http://ur1.ca/od4ou
22:03 MartinR it's standard one
22:04 Grinnz_ use lib 'lib'; # this won't work unless you're in the dir, you should use FindBin instead
22:05 Grinnz_ there's an example in https://metacpan.org/pod/Mojolicious::Guides::Cookbook#Making-your-application-installable
22:07 MartinR yes, now it works ;)
22:07 MartinR thanks!
22:07 Grinnz_ personally i never see the use of using lib without FindBin, for that reason
22:08 Grinnz_ that's what perl -Ilib is for
22:08 MartinR I still wonder how I was able get it work without it ...
22:08 Grinnz_ (running quickly using the current directory's lib)
22:09 dvinciguerra joined #mojo
22:11 trone joined #mojo
22:18 jberger morbo does work on windows IIRC, but its reload detection is so slow as to be maddening
22:19 jberger Grinnz_++ # FindBin
22:20 nnutter joined #mojo
22:24 MartinR just curious is it possible to run this app without FundBin ?
22:24 MartinR FindBin*
22:24 jberger MartinR: if you can reliably determine the full path to your lib directory without it its easy enough to do
22:25 jberger FindBin is just a wrapper around common ways of doing that
22:25 Grinnz_ FindBin is core though so it shouldnt matter
22:25 MartinR ;)
22:25 Grinnz_ (and used internally by Mojo i believe)
22:25 MartinR right
22:25 jberger Grinnz_: it is
22:26 jberger or at least Mojo makes sure that FindBin is correctly going to find the app, even when started via other mechanisms (ie hypnotoad)
22:30 ZoffixWin joined #mojo
22:35 zivester joined #mojo
22:37 dvinciguerra joined #mojo
22:56 MartinR ehh, refreshing on windows is horrible ;(
22:56 ZoffixWin With mojo? Yeah, I gave up deving on it. I do it on Linux and when I'm done move it to Windows
22:57 MartinR Looks liek it doesn't refresh at all
22:57 MartinR ZoffixWin, yes after all this is mojo channel ;)
23:00 Kogurr joined #mojo
23:00 ZoffixWin MartinR, err, I meant "with morbo?"
23:01 Grinnz_ lol
23:12 MartinR The trick is to save script file, after this it will refresh itself immediately
23:13 PryMar56 joined #mojo
23:16 Lucas1 joined #mojo
23:21 SmokeMachine joined #mojo
23:24 dvinciguerra joined #mojo
23:58 dvinciguerra joined #mojo

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