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

IRC log for #mojo, 2016-10-21

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

All times shown according to UTC.

Time Nick Message
00:24 stryx` joined #mojo
00:47 khfeng joined #mojo
00:55 cstamas joined #mojo
01:12 aborazmeh joined #mojo
02:21 khfeng joined #mojo
02:56 noganex joined #mojo
03:56 Fuogo joined #mojo
03:57 Fuogo Hi guys... how do I call helper 'pg'  in lite app ... during initialization stage?
04:08 polettix joined #mojo
04:49 parv joined #mojo
04:53 janus joined #mojo
05:06 Fuogo joined #mojo
05:33 batman Fuogo: helpers are available from the $app object AS well, so just do $app->pg
05:34 batman $app = $self in startup() method
05:36 batman Oh. Not here :/
06:21 inokenty-w joined #mojo
06:24 itaipu joined #mojo
06:39 sri caddy is a weird server, it's basically just a little glue around core Go libraries
06:52 AndrewIsh joined #mojo
07:01 mbudde joined #mojo
07:05 janl joined #mojo
07:29 trone joined #mojo
07:30 cstamas joined #mojo
07:33 dod joined #mojo
07:33 osfabibisi joined #mojo
07:38 dod joined #mojo
07:46 che-quest joined #mojo
07:46 janl joined #mojo
08:51 rshadow joined #mojo
08:55 polettix joined #mojo
09:02 janl joined #mojo
09:04 dod joined #mojo
10:03 itaipu joined #mojo
10:12 xdg joined #mojo
10:54 dod joined #mojo
11:02 tchaves joined #mojo
11:12 go|dfish joined #mojo
11:36 kaare_ joined #mojo
11:41 polettix joined #mojo
11:56 rshadow joined #mojo
12:09 stryx` joined #mojo
12:14 esh joined #mojo
12:24 zivester joined #mojo
13:04 dustinm joined #mojo
13:14 ramortegui joined #mojo
13:24 gizmomathboy joined #mojo
13:32 aborazmeh joined #mojo
13:55 jabberwok joined #mojo
14:03 mcsnolte joined #mojo
14:12 esh joined #mojo
14:19 disputin joined #mojo
14:43 disputin joined #mojo
14:50 PryMar56 joined #mojo
15:16 itaipu joined #mojo
15:57 PopeFelix joined #mojo
16:18 marty joined #mojo
16:18 marty_ joined #mojo
16:37 esh joined #mojo
17:01 polettix_ joined #mojo
17:53 rshadow joined #mojo
18:08 kryp joined #mojo
18:18 rshadow joined #mojo
18:36 asarch joined #mojo
18:44 jacoby joined #mojo
18:49 jacoby joined #mojo
18:53 mra90 joined #mojo
19:05 * sri loves the dell bios
19:06 sri coolo: of course i screwed up the suse reinstall and landed at a very sad grub prompt ;p
19:08 sri lucky for me dell bios is smart enough to allow me to sidestep my mistake and start the windows loader
19:12 vicash sri: to recover your grub use SuperGrub disk (version 2.0) I think. it is fantastic. it can find and boot your Suse and you can then fix grub from within Suse
19:19 zivester joined #mojo
19:20 blonewolfs joined #mojo
19:21 stryx` joined #mojo
19:25 rshadow joined #mojo
19:36 orev joined #mojo
19:50 blonewolfs in the results section of a ua get, what does "finished => 2" mean?
19:50 jberger blonewolfs: where do you see that?
19:53 blonewolfs in res.  i'm not sure of the whole tree.
19:54 blonewolfs let me see if i can sanitize the code a bit to make it clearer.
19:55 blonewolfs my $host_results = $self->ua->get($url); $self->app->log->debug("host_results: ". Dumper($host_results->{'res'}));
19:55 jberger that's private data
19:56 blonewolfs what do you mean?
19:56 jberger why are you diving into object data?
19:58 blonewolfs when i orginally wrote that section of code, that is where i was finding my returned data particularly when there is to much returned and it got buffered to disk.
19:58 diegok blonewolfs: $host_results->res
19:59 blonewolfs in this case, i got an error "'message' => 'Inactivity timeout'" and wondered if the finished result related to see if there was an easy way to test for that.
19:59 jberger blonewolfs: in mojolicious (and in most of perl and even dynamic language code) you shouldn't access the internals of objects, they are deemed private
20:00 jberger but since it is a dynamic language, privacy can't be (usually) enforced
20:00 eseyman joined #mojo
20:00 jberger Inactivity timeout means that the server you were contacting didn't respond
20:00 blonewolfs i didn't know those were internals.  i was just trying to find the results.  what would the correct way be?
20:01 jberger what are "the results"?
20:01 Grinnz https://metacpan.org/pod/Mojo::UserAgent#SYNOPSIS
20:02 jberger you got an error so, $tx->error (http://mojolicious.org/perldoc/Mojo/Transaction#error) would contain that
20:02 blonewolfs in this case, the url that i'm accessing returns json.  but, it doesn't really matter what is returned from the get.
20:02 blonewolfs how is $tx defined?
20:02 Grinnz yes it does, you can use ->res->json to retrieve the data structure resulting from decoding the json
20:02 Grinnz $tx is returned by ->get
20:03 blonewolfs so, in my code example above, tx = $host_results?
20:03 Grinnz yes
20:04 sri argh... somehow i'm unable to restore grub :(
20:04 jberger blonewolfs: if you haven't already read the mojolicious guides, please take a moment to do that
20:05 jberger if you are only using the user agent, you can look here: http://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#USER-AGENT
20:05 sri i can actually boot from disk by using the bootloader from a usb stick... but all attempts to restore grub on the laptop fail
20:05 jberger if you are writing a application, reading the Guides in the order listed here will help a lot http://mojolicious.org/perldoc/
20:06 blonewolfs jberger: i've read them many times and am often confused by them since they are mostly written for lite which i'm not using.
20:07 jberger they are written using the Lite DSL because the examples become more self-contained, but Lite is really no different than Full
20:07 jberger Lite is just sugar for the router
20:08 blonewolfs the concepts are the same but, the semantics are very different in many cases.
20:09 jberger people say this sometimes and I've found that showing this sometimes helps ...
20:10 jberger https://github.com/kraih/mojo/blob/master/lib/Mojolicious/Lite.pm
20:10 jberger Lite.pm is 56 lines of code (including comments and blank lines)
20:10 blonewolfs jberger: even now, i'm getting confused because you said that "finished" is private data and yet Grinnz says that $tx->res is where my results are and finished is contained in $tx->res.
20:10 Grinnz Lite is literally just a wrapper that turns application methods into imported functions
20:11 Grinnz plus some grouping stuff which you don't have to do in a full app
20:11 jberger blonewolfs: ->{finished} is accessing the object data as a hashreference
20:11 jberger ->finished is a method
20:11 jberger methods (that don't start with an underscore) are the public api of the classes
20:11 Grinnz blonewolfs: I did not say $tx->res is where your results are
20:12 Grinnz blonewolfs: I pointed you to the synopsis, which contains examples like:
20:12 Grinnz say $ua->get('www.☃.net?hello=there' => {Accept => '*/*'})->res->body;
20:12 Grinnz or my $value = $ua->get('https://sri:s3cret@example.com/test.json')->res->json;
20:12 blonewolfs sorry, i misread ->res as being the same as ->{'res'}
20:13 Grinnz you should never be accessing a hash value of a Mojolicious object unless it's documented that you should do so
20:13 Grinnz this applies to most CPAN modules
20:14 Grinnz ->res gives you a result object, which you must call further methods on to get the type of results you want
20:15 Grinnz usually ->body, ->text (to decode the charset), or ->json (if it's a JSON response)
20:15 Grinnz or ->dom if it's an HTML response
20:16 Grinnz the guide section jberger linked discusses this stuff
20:16 blonewolfs are those other methods documented somewhere?
20:16 Grinnz yes, but you should read the guide foremost
20:16 Grinnz the reference documentation is https://metacpan.org/pod/Mojo::Message
20:18 blonewolfs okay.  that is starting to make sense.  i think i know how to cleanup this section of code.  thank you for your patience and explanations.
20:19 jberger no worries
20:19 Grinnz traversing the reference documentation can get tedious, which is why the guides are there to cut straight to common implementations
20:21 Grinnz the way you would do it here is: https://www.irccloud.com/pastebin/esc91it7/
20:23 blonewolfs even though i have been using this for about 6 months now, i find that i'm still very much a newbie.
20:36 sri oh, i figured it out ;p
20:37 sri the suse installer created a second efi partition on the hdd, instead of using the efi partition on the ssd
20:37 sri so, there was an old leftover grub link in the ssd efi partition that crashed
20:38 sri well, that was fun
20:38 jberger wow, that's odd
20:52 CandyAngel Just in case anyone asks, I'm not abusing Mojolicious again. Honest.
20:55 sri oh, it's you again... stop abusing mojolicious!
20:55 sri jberger: business as usual ;p
20:55 Grinnz i need irccloud to add unicode 9.0 so i can use the proper :thinking: emoji for a response
20:55 disputin joined #mojo
20:57 CandyAngel Uh oh!
20:57 * CandyAngel hides
20:57 CandyAngel sri si going to irs me
20:58 CandyAngel I'm actually doing something fairly useful with it (giving instructions on the command line while some data is processed from STDIN
20:58 CandyAngel Mojo::IOLoop->timer == very useful for this
20:59 bpmedley blonewolfs : Do you still desire a method for determining how Mojolicious was started?
21:10 sri coolo: success, blacklisted a few intel amt drivers and got it to boot in under 10 seconds \o/
21:27 kryp joined #mojo
21:35 stryx` joined #mojo
21:43 CandyAngel Am I correct in believing I can't write data to arbitary locations in Mojo::Asset::File..?
22:07 Grinnz sure you could
22:07 Grinnz assuming you have access to create the file
22:09 marty joined #mojo
22:09 Grinnz you'd either need to use ->move_to or set ->cleanup(0) to prevent it from getting deleted when the object goes out of scope
22:10 marty joined #mojo
22:27 CandyAngel Yeah, i have cleanup(0) sorted
22:27 CandyAngel But I don't know a value I need at byte 4 until well after it.. seems like seeking back to 4 doesn't work
22:27 CandyAngel using $file->seek(4, 0)
22:27 CandyAngel Err
22:28 CandyAngel $handle->seek(4,0);
22:28 Grinnz oh. yeah, writing into the middle of a file is not a good idea in general
22:28 Grinnz generally, read in the file, modify it, write out a new one, move it back into place
22:29 Grinnz but if you want to do that, you probably need to use sysseek
22:29 Grinnz that = overwrite the middle of the file
22:29 CandyAngel It's a PGM file, by the way, I'm trying to set the width and height parameters
22:30 CandyAngel I know the width once I have a line on STDIN for it, then I wanted to write out the height at the end
22:30 Grinnz could you just keep it in memory until it's complete?
22:32 CandyAngel Probably
22:32 CandyAngel This tool isn't coded the best. Not really used Mojolicious like this before :)
22:34 CandyAngel I'm using Mojo::IOLoop to process STDIN, and Mojo::IOLOOP->timer to give the user some instructions. Some instructions cause it to close the current PGM and open the next one, for the next set of instructions
22:35 CandyAngel I'm coding this and playing Factorio at the same time. Not sure which one is more messy ^_^
22:56 CandyAngel I made a bash script which populates it afterwards :)
22:58 polettix joined #mojo

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