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

IRC log for #mojo, 2015-07-26

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

All times shown according to UTC.

Time Nick Message
00:00 jontaylor joined #mojo
00:21 trone joined #mojo
01:55 bpmedley joined #mojo
02:30 jb360 joined #mojo
02:55 noganex_ joined #mojo
03:06 Onigiri joined #mojo
04:12 Craftsmanship joined #mojo
04:14 Craftsmanship Is there a way to have the Config plugin load stuff from the __DATA__ templates?
04:15 jberger Craftsmanship: see Mojo::Loader
04:16 Craftsmanship That's just plain fancy.
04:17 Craftsmanship joined #mojo
04:22 Craftsmanship should I try and trick ::Plugin::Config, or just define my own helper called config?
04:23 jberger Oh right, it expects a file name
04:23 jberger I see
04:24 jberger It's too late at night for me to think up a proper solution, but I wonder if I can do better later
04:24 jberger Ie tomorrow
04:24 jberger Meantime, you could read it, parse it and pass it as the config defaults
04:25 jberger You shouldn't need proper defaults if they are in the same file right?
04:26 Craftsmanship it looks for it in another file, which doesn't feel right for a ::Lite
04:26 Craftsmanship ::Config has ->parse, which i can pass stuff from data_section
04:28 Craftsmanship is there a way to get myself the plugin object?
04:28 jberger Not usually
04:29 jberger I sometimes write my plugins way, but not always and I don't think any core plugins do
04:29 Craftsmanship hm, so i guess i can just replace the helper and ignore the warning
04:37 jberger You mean the config method?
04:37 jberger That's not a helper as such
04:37 jberger http://mojolicio.us/perldoc/Mojo#config
04:38 jberger You override it from the parent class
04:38 Craftsmanship I don't understand exactly the difference in a ::Lite
04:41 jberger Tinker with it, it's too late at night for me to give sane advice
04:41 jberger I'll be back on in the morning with a fresh eye
04:42 thowe jberger, night night jberger
04:42 frudas joined #mojo
04:42 Craftsmanship hey, crazy advice is the best advice.
04:42 frudas Hello
04:42 thowe hm, I should give more advice..
04:42 Craftsmanship frudas: hi there!
04:42 thowe frudas, hello
04:43 frudas :)
04:43 frudas i have a little problem with mojo in windows
04:43 jberger nn all
04:43 frudas im stuck in mojo 5.00
04:43 * thowe spits beer out at the mention of WIndows...
04:44 frudas i cant upgrade with cpanm
04:44 Craftsmanship paste?
04:44 purl i think paste is http://paste.scsys.co.uk/
04:44 frudas because it show that :-> t/mojo/user_agent.t ........................ 138/? # Looks like you failed 4 tests of 157
04:44 * thowe last used Windows in 1997
04:44 frudas it fail this test
04:44 melo1 joined #mojo
04:44 frudas :(
04:45 shadowpaste Someone at 217.168.150.38 pasted "#! /usr/bin/perl use lib $ENV{" (53 lines) at http://paste.scsys.co.uk/495270
04:45 frudas im using strawberry perl
04:45 thowe I've heard that works pretty well
04:45 frudas perl 5.20.0
04:46 Craftsmanship You could just force it
04:46 Adura You could figure out what the problem is, too.
04:46 frudas mmm mojo will not crash if i force him?
04:46 Craftsmanship http://cpantesters.org/distro/M/Mojolicious.html
04:47 Craftsmanship are you running your mojo app locally at the moment?
04:47 Adura Do you have any of the 4 optional modules installed?
04:47 frudas yes
04:48 jberger Craftsmanship: once you've loaded it, just use the data to set app->config
04:48 frudas i have two of the foir
04:48 frudas 4
04:48 thowe so, is Strawberry Perl not tested?
04:48 thowe not a tested environment?
04:48 Adura Upgrade those first? Upgrade to the latest Strawberry 5.20 build?
04:48 frudas it work very the 5.0
04:48 frudas but is too old
04:48 frudas i need the last one
04:49 Adura I installed it just find on Strawberry 5.20.2
04:49 Adura *fine
04:49 jberger frudas: can you install a less recent mojo, ie Mojolicious@6.01
04:49 Craftsmanship jberger: I wasn't aware i could write to that
04:50 frudas i didnt try
04:50 jberger Generally, mojo passes on all platforms
04:50 frudas just cpanm -v mojo...
04:50 jberger I'm guessing an environment issue
04:50 frudas adura:  Strawberry 5.20.2 pass?
04:51 Adura Yep, with 3/4 optional modules, with the 1 being EV.
04:51 jberger or maybe NDN?
04:51 frudas well i will delete my strawberry 5.20.0
04:51 frudas and test the adura version
04:51 Adura IO::Socket::Socks 0.64+ (0.66), IO::Socket::SSL 1.94+ (2.005), Net::DNS::Native 0.15+ (0.15)
04:52 thowe I didn't see strawberry on that page
04:52 frudas is not there
04:52 jberger Strawberry reports itself as Win32
04:52 frudas need to be addes
04:52 frudas added
04:52 frudas :)
04:55 frudas the bad new is that i need to reinstall all the cpanm stuff again
04:55 frudas but if it works ... its ok
04:55 Adura Try the module versions I suggested first, then.
04:55 Adura Or, just uninstall the two you have.
04:55 frudas how to ? in windows ?
04:56 frudas cpanm -v module@version?
04:56 Adura cpanm has a means of uninstalling them.
04:57 dotandimet joined #mojo
05:00 Grinnz joined #mojo
05:06 kaare_ joined #mojo
06:09 dotandimet joined #mojo
06:37 dotandimet joined #mojo
07:17 Vandal joined #mojo
07:42 amon joined #mojo
07:45 Craftsmanship http://paste.scsys.co.uk/495291 # this looks a lot like an error from the error generation code
08:00 kaare_ joined #mojo
08:05 kaare_ joined #mojo
08:11 sh4 joined #mojo
08:53 bwf joined #mojo
09:36 buu ribasushi: !
09:54 Skylos_ joined #mojo
09:55 trone joined #mojo
10:17 KindOne_ joined #mojo
10:17 Lucas1_ joined #mojo
10:20 pink_mist joined #mojo
10:20 mikegrb joined #mojo
10:20 stryx` joined #mojo
10:20 mrEriksson joined #mojo
10:20 tyldis joined #mojo
10:20 omega joined #mojo
10:20 Trelane joined #mojo
10:24 oalders joined #mojo
10:28 Nemix joined #mojo
10:32 mtj joined #mojo
10:33 charsbar joined #mojo
10:34 jzawodn joined #mojo
10:42 Bender joined #mojo
11:35 CandyAngel Oh I see. Mojo::URL stores the Mojo::URL object you pass to to_abs or something
11:36 CandyAngel So as this crawls, the Mojo::URL just gets more and more $url->{base}->{base}->{base} etc.
11:36 CandyAngel Which gets cloned later on
11:43 stephen joined #mojo
13:22 gryphon joined #mojo
13:38 stuart_ joined #mojo
13:38 stuart_ hi all
13:39 stuart_ I have a question about setting up an API route for a web service, would anyone be willing to give me a pointers please.
13:48 bpmedley stuart_: Morning, what's the question, or do you need an example?
14:10 CandyAngel Bleh, do I really need to do "my $url = Mojo::URL->new($url->to_string)" to stop the increasing depth of $url->base->base->base->...?
14:14 stuart_ ok sorry, I have a web service html form, that allows a user to upload a file, then it does some number crunching and displays a SVG.
14:15 stuart_ How would I implement file upload, would it just be a case of getting a user to populate a parameter with the file contents?
14:16 stuart_ Also the SVG, would I return a data structure like {status=>200,SVGFILE=>filecontent}
14:17 stuart_ ... {status=>error,error=>reason}
14:17 bpmedley stuart_: I'm confused.  Is the web service html form interactive, or an api to be used by curl and friends?
14:22 stuart_ I have already set up the web html form, however I would also like to have an api that does the exact same workload, but just a different front end.
14:23 stuart_ I could code a spider to do this, and save me the effort of making an api, but i was to make a blessed way of doing it.
14:25 stuart_ candyangel would 'my $url = Mojo::URL->new("$url");' not save you?
14:26 CandyAngel stuart_: Yeah, that's a shorthand way of doing it
14:26 CandyAngel It just seems.. wrong?
14:26 CandyAngel I mean
14:26 stuart_ well not really, because of lexical context.
14:27 CandyAngel If you have an absolute URL.. why does it need a base url?
14:27 Skylos_ joined #mojo
14:27 CandyAngel It's base is itself
14:28 CandyAngel Basically, I have a crawler that takes the origin URL and each URL it finds on the page (which is relative), it makes it absolute with the url of the page it is scanning, then puts it in the queue
14:29 CandyAngel Then the next time, you have a Mojo::URL with the found link, with a $url->base of the page it was found in.. then any links it finds end up as a Mojo::URL of the found link, with a base which is Mojo::URL of the page it was found on which, itself, has a base of the page that was found on
14:29 CandyAngel And it just grows until Perl complains about deep recursion when you call 'clone' on it :|
14:31 Skylos_ joined #mojo
14:31 Craftsmanship joined #mojo
14:31 Craftsmanship perl -MMojo::URL -E 'say Mojo::URL->new( "http://cpan.org/" )->path("/+184920484") '     --> http://cpan.org/+184920484
14:32 Craftsmanship it seems like that + should be escaped
14:34 bpmedley stuart_: http://pastie.org/10312998 <-- How does something like this strike you?
14:39 stuart_ that seems like what i am after. Thank you bpmedley
14:40 Skylos___ joined #mojo
14:53 disputin joined #mojo
15:06 mattastrophe joined #mojo
15:14 ribasushi joined #mojo
15:14 jontaylor joined #mojo
15:14 michael joined #mojo
15:14 hahainternet joined #mojo
15:14 avenj joined #mojo
15:14 lestrrat joined #mojo
15:14 ashimema joined #mojo
15:14 throughnothing joined #mojo
15:14 jantore joined #mojo
15:14 mishantil joined #mojo
15:14 augensalat joined #mojo
15:14 tomboh_ joined #mojo
15:14 marty_ joined #mojo
15:14 trone joined #mojo
15:14 sh4 joined #mojo
15:14 Vandal joined #mojo
15:14 Onigiri joined #mojo
15:14 jb360 joined #mojo
15:14 Adura joined #mojo
15:14 y1mmm joined #mojo
15:14 bjakubski joined #mojo
15:14 chansen joined #mojo
15:14 jberger joined #mojo
15:14 plicease joined #mojo
15:14 dotan joined #mojo
15:14 Dave joined #mojo
15:14 Eke joined #mojo
15:14 bc547 joined #mojo
15:14 janus joined #mojo
15:14 Lee joined #mojo
15:14 Grinnz_ joined #mojo
15:14 teejay joined #mojo
15:14 lupi joined #mojo
15:14 salva joined #mojo
15:14 bowtie joined #mojo
15:14 zackiv31 joined #mojo
15:14 geheimnis` joined #mojo
15:14 cstamas joined #mojo
15:14 mst joined #mojo
15:14 tianon joined #mojo
15:23 thowe jberger, to your comment in that gist "can this be optimized by using $id rather than $account->customer_id?"
15:23 thowe jberger, The answer is yes.
15:23 mst heh, great, so now we have half a network in here
15:23 * mst keeps hunting for the other half
15:44 jberger mst: borken netsplit?
15:44 jberger thowe: cool, I suspected so but I wasn't sure
15:45 jberger meanwhile, I finally decide to buy a steam game right as all their shit goes down
15:45 jberger I keep getting server errors and I'm not the only one
15:45 jberger sigh
15:45 stuart_ ouch jberger
15:45 thowe well, if you can't, then you wouldn't get to that section of code because the id would have already been invalidated by not having produced an account record from the DB.
15:45 thowe or so I choose to tell myself.
15:46 jberger thowe: right, but I wasn't exactly sure about how find would work, its been a while since I've used DBIC
15:46 jberger I suspected it would work that way, but wasn't 100% certain
15:46 thowe and I just tested locally against my test db and all seems well.
15:47 thowe I'm having fun with bootstrap glyphs
15:47 jberger thowe: I waste time here sometimes: http://unicode-table.com/
15:47 stuart_ joined #mojo
15:48 thowe I'm adding these little indicators for various account attributes and finding that the Portland office has been doing something that has probably cost me money...
15:48 thowe new project already paid for itself by making me re-think our display.  YAPC::NA 2016 here I come.
15:49 mst ace
15:50 thowe jberger, Imma gonna bookmark that bad boy.
15:52 thowe The other thing someone clued me into at YAPC that I haven't had time to try is PostgreSQL partitions.
15:53 thowe and I still want to try rapid app against this DIBC
15:53 jberger I'm pushing my company towards microservices after seeing the talk at yapc
15:54 jberger to that point we are just starting to roll out consul
15:54 jberger for DNS managment
15:55 thowe I missed that one
15:55 jberger it wasn't about consul, but I needed a way to manage service discovery if I was going to try microservices and it is quite nice for that
15:56 thowe what was the talk?  is the video quality?
15:57 jberger https://www.youtube.com/watch?v=USXSnfilG4g
15:57 jberger can't speak to the video quality, I watched it in person
16:10 jberger Craftsmanship: what seemed like a reasonable request last night now seems unusal
16:10 jberger why not just use the defaults option?
16:21 ans joined #mojo
16:21 disputin1 joined #mojo
16:22 stuart_ how did I miss that talk, thats great
16:24 thowe ...man, I am gonna Mojo this CRM so goddam hard...
16:24 disputin joined #mojo
16:25 Craftsmanship thowe: post pics
16:25 Craftsmanship so, is there a non-horrid way to get a Mojo::URL with a modified path
16:26 Craftsmanship (my $thing = $url->clone)->path( '/things' )... ua->get( $thing )
16:27 mst $ua->get($url->clone->tap(sub { $_[0]->path('/things') }));
16:27 mst or if you use Object::Tap
16:27 mst $ua->get($url->clone->$_tap(path => '/things'));
16:27 mst wait, no, that'd work with plain tap, I misread
16:27 mst yeah, so
16:28 mst $ua->get($url->clone->tap(path => '/things'));
16:28 mst should do fine
16:28 mst Craftsmanship: not sure what's wrong with that?
16:28 thowe the fact that you must have typed that out that fast has me all like "wtf.."
16:28 mst with a short pause to check 'perldoc -m Mojo::Base' for the tap method :)
16:30 thowe huh...  that looks like it almost explains some things to me...  filing away for my future smarter self
16:33 jberger Craftsmanship: setters return the instance
16:33 jberger $url->clone->path('/things') should return the clone, right?
16:33 mst oh ... probably, yeah
16:33 mst sorry, i use tap on instinct for setters
16:34 mst I forget mojo has non-standard setter behaviour
16:34 jberger again, I'm not 100% sure
16:34 mst I'm 99% sure you're right and I was just being overly defensive
16:34 jberger but I'm pretty sure that using the pseudo-accessors for the path on the url work the same way
16:35 mst yes, they do
16:35 jberger (remember that the path is actually an object too, but IIRC the url objects have a nice setter so that they work in the same way)
16:35 jberger mst: cool
16:35 mst Mojo is internally totally consistent, I just forget that it doesn't do return-set-value whereas basically everything else does
16:35 Craftsmanship mst: sorry, ->path->merge('relative-things')
16:36 Craftsmanship not just replacing the path
16:36 Craftsmanship but in both cases, i get back a Mojo::Path, not a full url
16:36 * Craftsmanship looks up what exactly it means to "tap that"
16:36 mst Craftsmanship: doing ->path->merge will return the $path
16:36 mst for *that*, you want tap
16:36 mst ->tap(sub { $_[0]->path->merge(...) })
16:36 jberger Craftsmanship: http://mojolicio.us/perldoc/Mojo/URL#path
16:36 mst ->clone->tap(sub { $_[0]->path->merge(...) })
16:36 mst more specifically
16:37 jberger see that relatives paths are merged
16:37 mst oh wait fuck it already does ->merge
16:37 mst yeah
16:37 mst Craftsmanship: just do ->path, it already calls ->merge
16:37 mst all the complexity here is generated by you, not Mojo
16:37 mst $url->clone->path('relative-things')
16:37 mst will return a new URL object with that path merged
16:37 jberger mst isn't wrong though, using tap is a good general (read, outside mojo) practice if you want nice chaining
16:38 jberger just mojo is usually designed for chaining
16:41 Craftsmanship it's trailing slashes producing mis-leading results when i was playing with it
16:46 jberger ooooh ipynb now works in gists
16:47 jberger https://gist.github.com/jberger/b62332a506b364117e37
16:47 jberger ^^ no longer looks like a pile of JSON
16:47 jberger oh but convos embedding on those looks bad :(
16:48 jberger balls, I'm way off topic
17:09 zivester joined #mojo
17:09 kaare joined #mojo
17:09 inokenty joined #mojo
17:09 davido__ joined #mojo
17:09 stokachu joined #mojo
17:09 cosimo joined #mojo
17:09 Foxcool joined #mojo
17:09 DaTa joined #mojo
17:09 Rallias joined #mojo
17:09 sivoais joined #mojo
17:09 meredith_ joined #mojo
17:09 ashleyde1 joined #mojo
17:09 btyler_ joined #mojo
17:09 spicyjac1 joined #mojo
17:09 diegok joined #mojo
17:09 da5id joined #mojo
17:09 elik joined #mojo
17:09 absolut_todd joined #mojo
17:09 phillipadsmith joined #mojo
17:09 jnbek joined #mojo
17:09 rwp joined #mojo
17:09 yt7fms joined #mojo
17:09 oetiker joined #mojo
17:09 mtths joined #mojo
17:09 tempire joined #mojo
17:09 sri joined #mojo
17:09 D4RK-PH0ENiX joined #mojo
17:09 kmx joined #mojo
17:09 dustinm joined #mojo
17:09 saki joined #mojo
17:09 cfedde joined #mojo
17:09 Quai joined #mojo
17:09 abracadaniel joined #mojo
17:09 Kundun joined #mojo
17:09 al joined #mojo
17:09 bjoernfan joined #mojo
17:09 mgrimes joined #mojo
17:09 bayashi joined #mojo
17:09 stephan48 joined #mojo
17:09 Zx3 joined #mojo
17:09 salparadise joined #mojo
17:09 ssm joined #mojo
17:09 Phil21 joined #mojo
17:09 robinsmidsrod joined #mojo
17:09 upasana_ joined #mojo
17:09 allison joined #mojo
17:09 lb joined #mojo
17:09 preaction joined #mojo
17:09 bzero joined #mojo
17:09 tinita joined #mojo
17:09 skaji joined #mojo
17:09 caeles joined #mojo
17:10 mst and there's the other half
17:10 mst VICTORY
17:10 stuart_ w00t
17:14 BinGOs joined #mojo
17:16 stuart_ joined #mojo
17:59 joelb joined #mojo
18:06 joelb Any recommendations for rendering a .html.ep template as pdf?
18:07 joelb I'm currently reading about wkhtmltopdf; just wondering if people prefer something else
18:08 mst that's what I've used
18:09 joelb k
18:09 jberger joelb: same
18:10 joelb awesome, good to know, thanks
18:11 rakshasa joined #mojo
18:11 zivester joined #mojo
18:11 kaare joined #mojo
18:11 inokenty joined #mojo
18:11 davido__ joined #mojo
18:11 stokachu joined #mojo
18:11 cosimo joined #mojo
18:11 Foxcool joined #mojo
18:11 DaTa joined #mojo
18:11 Rallias joined #mojo
18:11 sivoais joined #mojo
18:11 meredith_ joined #mojo
18:11 ashleyde1 joined #mojo
18:11 btyler_ joined #mojo
18:11 spicyjack joined #mojo
18:11 diegok joined #mojo
18:11 da5id joined #mojo
18:11 elik joined #mojo
18:11 absolut_todd joined #mojo
18:11 phillipadsmith joined #mojo
18:11 jnbek joined #mojo
18:11 rwp joined #mojo
18:11 yt7fms joined #mojo
18:11 oetiker joined #mojo
18:11 mtths joined #mojo
18:11 tempire joined #mojo
18:11 sri joined #mojo
18:11 D4RK-PH0ENiX joined #mojo
18:11 kmx joined #mojo
18:11 dustinm joined #mojo
18:11 saki joined #mojo
18:11 cfedde joined #mojo
18:11 Quai joined #mojo
18:11 abracadaniel joined #mojo
18:11 Kundun joined #mojo
18:11 al joined #mojo
18:11 bjoernfan joined #mojo
18:11 mgrimes joined #mojo
18:11 bayashi joined #mojo
18:11 stephan48 joined #mojo
18:11 Zx3 joined #mojo
18:11 salparadise joined #mojo
18:11 ssm joined #mojo
18:11 Phil21 joined #mojo
18:11 robinsmidsrod joined #mojo
18:11 upasana_ joined #mojo
18:11 allison joined #mojo
18:11 lb joined #mojo
18:11 preaction joined #mojo
18:11 bzero joined #mojo
18:11 tinita joined #mojo
18:11 skaji joined #mojo
18:11 caeles joined #mojo
18:11 mishanti1 joined #mojo
18:27 omega joined #mojo
18:34 eduardow joined #mojo
18:37 garu joined #mojo
18:42 garu_ joined #mojo
19:03 stuart_ joined #mojo
19:12 stuart_ joined #mojo
19:17 PryMar56 joined #mojo
19:25 buu joined #mojo
19:43 stuart_ joined #mojo
19:43 punter joined #mojo
19:44 stuart_ joined #mojo
20:06 dotandimet joined #mojo
21:04 bpmedley I've only recently discovered how awesome url_for is in templates.  So much mojo, such a good time.. :)
21:07 berov joined #mojo
21:35 jberger bpmedley levels up
21:36 bpmedley Gaw, more constitution.. ;)
21:37 CandyAngel OKay, I still think the url base thing is weird but.. err
21:37 CandyAngel How come 'host' doesn't have a similar setup as path for manipulating domains?
21:41 Adura You want Mojo to do something with your DNS?
21:42 CandyAngel No, when I have an Mojo::URL that points to 'http://example.org/path/to/file'
21:42 CandyAngel I can use path->parts to mess about with /path/to/file
21:43 CandyAngel But have to manually mess about to change example.org to justan.example.org
21:43 CandyAngel Because it's just a string field
21:43 CandyAngel Just wondering if there was a reason for that not being a thing :)
21:45 bpmedley $url = $url->host("hello.com"); <-- Does that work for you?
21:45 CandyAngel Yeah
21:46 bpmedley I must be mis-understanding.  Do you have a small example script that shows what your thinking?
21:47 CandyAngel Just look at what $url->path(..arg..) lets your do
21:47 CandyAngel lets you do*
21:47 CandyAngel And how $url->host lacks that sort of manipulation
21:48 CandyAngel my $pathparts = $url->path->parts; # Available
21:48 CandyAngel my $hostparts = $url->host->parts; # not available
21:48 Adura You want subdomain manipulation?
21:48 CandyAngel Yeah
21:49 CandyAngel Well
21:49 Adura Trying to recreated ytmnd?
21:49 Adura *-ed
21:50 CandyAngel It's not a big deal because I can just split it on . and join it with .
21:51 CandyAngel But if I am scanning a site and getting links and I am only interested in the third subdomain (from the right), it's more awkward than if I was interested in the third subdirectory of the path
21:51 CandyAngel Or if your script takes a subdomain name, you have to do umm
21:52 CandyAngel $url->host(sprintf('%s.example.com', $subdomain));
21:52 CandyAngel Instead of
21:52 CandyAngel $url->host->parts([$subdomain, 'example', 'com'])
21:53 CandyAngel Sorry if I am not being clear or making it more confusing >.<
22:05 Skylos_ joined #mojo
22:56 mattastrophe joined #mojo

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