Camelia, the Perl 6 bug

IRC log for #mojo, 2012-10-24

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

All times shown according to UTC.

Time Nick Message
00:07 Averna joined #mojo
00:09 bluescreen joined #mojo
00:56 laouji joined #mojo
01:51 d4rkie joined #mojo
01:58 xaka joined #mojo
02:23 asarch joined #mojo
02:37 noganex joined #mojo
03:21 arpadszasz joined #mojo
03:23 sri tempire: because of context ambiguity
03:24 sri we've had multiple bugs like foo('whatever', $req->content->charset, 'bar') where ->charset returned the charset or an empty list
03:25 sri because it used return instead of return undef
03:33 sri so from now on i think i'm going to use return undef explicitly whenever a method/function doesn't support list context
03:39 sri this is one of the cases where PBP is wrong imo
03:49 Foxcool joined #mojo
03:53 crab yay!
04:03 good_news_everyone joined #mojo
04:03 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/jHVymA
04:03 good_news_everyone [mojo/master] test tweaks - Sebastian Riedel
04:03 good_news_everyone left #mojo
04:03 * sri wonders what crab is cheering at
04:32 tempire I think crab loves undef
04:33 tempire explicitely
04:33 sri \o/
04:33 tempire *explicitly
04:33 tempire so
04:33 tempire who's buying me a new imac?
04:34 * sri pushes tempire to the side
04:34 sri sooo... who's buying me a new imac?
04:34 * tempire shoots sri
04:34 tempire http://nerdapproved.com/wp-content/up​loads/2008/02/glitter-gun.jpg?cb5e28
04:35 * sri glitters
04:50 GabrielVieira joined #mojo
04:53 * sri actually doesn't believe he could work with a normal desktop again
04:56 sri is it just me or did apple events stop being magical?
04:57 sri cook bragging about numbers at the start was just awkward
05:18 tempire I didn't watch the keynote
05:18 tempire but steve always bragged about numbers
05:19 sri steve did it better somehow
05:25 tempire for sherbs
05:37 sri hmmm
05:38 * sri wonsers if explicit undef is good or bad for examples like http://mojolicio.us/perldoc/Mojolicious/Lite#Under
05:38 sri s/s/d/
05:44 asarch joined #mojo
06:03 ovnimancer joined #mojo
06:11 laouji joined #mojo
06:14 dvinciguerra joined #mojo
06:20 AmeliePoulain joined #mojo
06:29 spleenjack joined #mojo
06:34 dpetrov_ joined #mojo
06:40 Britzel sri: explicit undef is good, it helps the unwashed like me. No ambiguities.
06:48 yakudza joined #mojo
07:13 * sri kinda wishes we could just say return true and return false
07:14 buu joined #mojo
07:20 Mike-PerlRecruiter_ joined #mojo
07:20 _xaka_ joined #mojo
07:26 batman joined #mojo
07:30 Adurah 1/0 not good enough for ya?
07:30 Vandal joined #mojo
07:32 ovnimancer joined #mojo
07:33 sri 1/0 are not booleans
07:34 sri !!1/!!0 are booleans, but ugly
07:35 memowe O HAI
07:35 sri o/
07:35 memowe o/1
07:38 Adurah Create an object that stands for bool, use overload...!
07:39 Adurah Though, seems the boolean module already does that.
07:39 ladnaV joined #mojo
07:39 sri captain obvious
07:39 Adurah It is Perl we're talking about.
07:40 sri those modules are bullshit, perl already has built-in booleans... we just can't test for them yet
07:42 memowe isTrue!? I don't think camel language likes camel case.
07:42 sri we need Scalar::Util::is_bool
07:43 sri my $foo = !!1; say "True!" if $foo && is_bool $foo;
07:44 memowe s/foo/fue/
07:48 sri 0 is a really shitty false value
07:50 sri compared to undef and ''
07:51 rhaen good morning.
07:51 sri \o
07:51 memowe o\
07:51 memowe s/\\/\//
07:52 Adurah If only '1 but false' worked, you could use those strings for the booleans.
07:53 rhaen <de>schoenen guten morgen</de>
07:53 rhaen <en>Good morning everyone</en>
07:53 sri Adurah: that makes no sense whatsoever
07:54 Adurah Just poking fun at '0 but true'.
07:57 sri new 13" retina macbook looks neat, but i think i still want a macbook air :o
07:57 Adurah Someone has money.
07:58 sri no quad-core and intel graphics in both is a little disappointing though
08:05 pau4o joined #mojo
08:06 buu sri: The samsung version is pretty excellent
08:13 * sri needs os x
08:25 yakudza_ joined #mojo
08:27 buu =[
08:27 buu Be free!
08:30 d4rkie joined #mojo
08:37 laouji joined #mojo
08:37 bjoernfan buu: Samsung version of what?
08:38 bjoernfan "13-inch Series 9 ultrabook", got it
08:38 bjoernfan :)
08:40 buu bjoernfan: Yeah, they came out with the series9 ultrabooks in 13 and 15in ranges, they're lighter and skinnier than the macs and really well put together.
08:40 buu (Except when a kitten attacks the keyboard
08:41 sri linux desktops are still terrible imo
08:41 sri font rendering alone makes it unbearable for me
08:42 bjoernfan buu: Oh, it's already out?
08:46 nic Anyone have any interesting ways to swap two chars in a string?
08:47 nic $a =~ s/-/#/; $a =~ s/_/-/; $a =~ s/#/_/;
08:47 nic does what I want, but I'm in a mood to play
08:48 nic (and that would only work on strings that don't contain '#')
08:48 Kwa tr/a/b/
08:48 nic Kwa: does that swap?  I thought it just replaced
08:49 Kwa nic: Oh? What's the difference between swap and replace? :/
08:49 nic look at my example
08:50 Kwa nic: You only want to swap/replace the first occurence of something?
08:50 nic but I forgot the 'g' modifier at the end of each s///
08:50 * sri would have a very hard time getting used to an ugly editor too after TM2 http://twitpic.com/b6xf0f/full
08:54 Vandal joined #mojo
08:58 buu You don't use vim?!
09:02 sri every now and then, but not as my primary editor
09:02 sri i depend too much on find in project for vim
09:04 bjoernfan Something like ctags?
09:05 cosmincx joined #mojo
09:09 sri like http://twitpic.com/b6xjq7/full
09:09 sri and don't you dare say that's like ackvim ;p
09:10 sri it is soooo much better
09:11 laouji joined #mojo
09:13 bjoernfan Just curious of what I'm missing. :)
09:16 pierrick joined #mojo
09:22 sri hmm, should hypnotoad care about this? https://github.com/kraih/mojo/issues/402
09:22 D4RK-PH0ENiX joined #mojo
09:22 cosimo joined #mojo
09:23 D4RK-PH0ENiX joined #mojo
09:23 ladnaV joined #mojo
09:39 sri augensalat: hand waving is not very helpful
09:39 sri do you have any real problems?
09:44 Vandal joined #mojo
09:44 Britzel_ joined #mojo
09:44 augensalat A collegue of mine has this kind of problem. Didn't see his code so far, but I was able to verify my assumption, that the actual problem is in hypnotoad.
09:45 sri how is that a hypnotoad problem?
09:48 sri also ""rand()" is not cryptographically secure.  You should not relyon it in security-sensitive situations."
09:48 sri that pretty much invalidates your whole argumentation
09:56 kitt_vl joined #mojo
09:58 lukep joined #mojo
10:07 Lucas1 joined #mojo
10:15 sri i'll leave the issue open for a bit in case someone else wants to chime in
10:16 marcus I also use textmate 2
10:18 sri an after_fork hook for hypnotoad is something i'm more interested in
10:19 sri that also needs a real discussion without all the hand waving though
10:20 marcus yeah.
10:20 marcus shouldn't it be a generic hook for any server tho?
10:20 marcus psgi also forks?
10:21 sri has to be server specific imo
10:21 sri for hypnotoad it would be something like app->config->{hypnotoad}{after_fork} = sub {...};
10:21 marcus seems like it should be part of the protocol the daemon has to implement.
10:22 marcus if you don't fork, it should be called anyways...
10:22 * marcus & # lunch
10:22 sri that thought gives me a headache
10:22 sri considering Mojo::Server::Daemon is so reusable and meant to be embedded in all kinds of environments
10:23 Adurah Sure is hard to test for sv_yes/sv_no...
10:24 sri general purpose hook will require *a lot* more discussion
10:38 sri not an important discussion though, since a timer already gets the job done
10:40 marcus sri: maybe the general purpose hook could be a wrapper around the timer?
10:40 sri oh wait, the timer is not *really* portable
10:41 sri it doesn't work for CGI and PSGI
10:41 marcus right, must have a ioloop then.
10:41 marcus cgi doesn't fork anyways, but it's important that you can expect the action to be run anyways, imo.
10:42 sri PSGI is very complicated though
10:42 sri different api for every server
10:43 arpadszasz joined #mojo
11:02 augensalat Besides this academic discussion - what is the problem with srand() after a fork()? Is it to costful?
11:07 Adurah I've made is_bool...!
11:10 Adurah http://ideone.com/Pgm4on Though, I'm probably overlooking something...!
11:15 Adurah Wait, typo there.
11:16 Adurah http://ideone.com/SUp0CD There, is_bool, probably circumstances where it can be fooled, though.
11:17 sri Adurah: good idea, but doesn't work on 5.10
11:17 Adurah Well... shit.
11:18 Adurah Guess it'll have to wait for Mojol 4.
11:18 sri hopefully subroutine signatures will speed up adoption of new perl versions a bit after 5.18
11:22 netfeed subroutine signatures?
11:22 sri http://www.xray.mpe.mpg.de/mailing-lis​ts/perl5-porters/2012-10/msg01002.html
11:23 sri there's a good chance it will be in 5.18 as an experimental feature
11:24 netfeed what's bad about the current way? it's really flexible
11:24 sri it's verbose
11:25 judofyr joined #mojo
11:25 sri the old way will still work, this just makes the most common cases easier
11:25 sri *+s
11:25 netfeed maybe
11:25 Adurah Ease in the PHP users.
11:25 sri *-s
11:25 sri or the C users
11:25 judofyr sri: when using Hypnotoad, where does warns go?
11:26 sri or the Ruby users
11:26 sri or the Python users
11:26 judofyr Ruby \o/
11:26 sri or the JavaScript users
11:26 sri EASE IN ALL THE USERS!
11:26 sri judofyr: dev/null i suppose
11:27 judofyr sri: damn. what should I do for logging to production.log when I don't have access to the app instance? use $ENV{MOJO_APP}?
11:27 sri judofyr: use $SIG{__WARN__} to catch them
11:28 sri $ENV{MOJO_APP} is useless now
11:28 judofyr ah
11:28 sri we got rid of application singletons mostly
11:29 netfeed catch them all!
11:29 judofyr that's nice
11:30 sri well... we basically got rid of all singletons :)
11:30 sri just Mojo::IOLoop left, for obvious reasons
11:31 * judofyr hates Rails' singletons
11:31 * sri too
11:31 * judofyr hates most of Rails actually
11:31 * Ulti has never used Rails...
11:32 judofyr Ulti: no point when you have Mojo \o/
11:32 Ulti aye
11:32 Ulti the last time I did anything frameworky was building ontop of Drupal in PHP
11:32 Ulti which is so far removed from the experience of using Mojolicious it makes me want to cry
11:32 Netfeed i hate all the magic in rails
11:33 Netfeed change this boolean here and that box over there starts floating around on the screen
11:33 Adurah I was looking into Kohana PHP to migrate some crap PHP on the site I work on.
11:33 Adurah But, I like Perl more.
11:33 Ulti migrate PHP to a different language
11:33 Adurah What I'm doing, hah.
11:33 Ulti yeah
11:34 Ulti :) gd gd
11:34 judofyr sri: would there be any problems with $SIG{__WARN__} = sub { $app->log->warn($_[0]) }? recursive loop?
11:35 sri judofyr: should be fine
11:35 judofyr sri: good. although I had to add a chomp() in there to get rid of trailing \n
11:38 sri augensalat: the problem is that we don't add new code unless there is a good reason to do so
11:39 sri and in the issue so far, i only see reasons not to do it https://github.com/kraih/mojo/issues/402
11:40 sri you wave the security flag, when in fact the documentation of rand() tells you that it is always insecure no matter what
11:41 * sri waits for judofyr to tell us that ruby calls srand() automatically after fork
11:41 sri (since 1.9.something afair)
11:42 judofyr Ruby calls srand automatically after fork
11:42 sri \o/
11:42 judofyr since 1.9.something
11:44 nic In what circumstances do you need/want is_bool?
11:45 judofyr sri: btw, is there a nice way than this: $foo ? Mojo::JSON->true : Mojo::JSON->false
11:45 sri nic: JSON modules for example
11:45 judofyr err, I should probably stop tab-ing sri for general questions
11:45 sri what judofyr said
11:46 nic ah, I see
11:46 sri it's pretty sad when we have stuff like JSON::PP::true and JSON::PP::false shipping in the perl core
11:47 nic yeah, it's hard to argue about perl being elegant when you see that
11:47 sri is_bool would solve that and allow us to just use the native booleans !!1 and !!0
11:48 nic from what I saw it seemed to be the only thing blocking the 'json is nice & simple' argument too
11:48 sri yea
11:51 sri just doing !!$foo instead of $foo ? Mojo::JSON->true : Mojo::JSON->false would be really nice
11:51 judofyr sri: in the meantime, Mojo::JSON->bool($foo) would be nicer than the current :)
11:52 judofyr sri: how hard is it to write a is_bool for 5.10?
11:53 sri no idea, extremely simple or extremely hard i suppose
11:53 judofyr would you accept it if it only works in 5.12+ and always returns !!0 in 5.10?
11:54 judofyr also, where are FLAGS documented?
11:54 sri supporting future versions might be the bigger problem
11:55 sri judofyr: we have to support 5.10
11:55 sri or rather 5.10.1
11:56 * sri would be surprised if FLAGS was actually documented
11:57 sri B pokes into internal data structures
12:01 sri hmm
12:02 sri B::sv_yes and B::sv_no might be usable for making the whole thing portable
12:04 Lucas11 joined #mojo
12:08 judofyr is there a after-fork-hook for hypno?
12:21 batman judofyr: $ioloop->timer(0 => sub { }); ?
12:22 batman inside startup()... not tested, but i don't think the ioloop starts until the child i started...
12:22 batman https://metacpan.org/source/SRI/Mojolicio​us-3.51/lib/Mojo/Server/Hypnotoad.pm#L327
12:23 augensalat Gee, I really want to use Mojolicious - I don't want to rape it.
12:23 judofyr batman: I guess it can also just be done inside startup()
12:23 augensalat sri: As soon as I have external dependencies in an app, chances are, that I use rand() without knowing.
12:24 batman judofyr: iirc startup() is run in the parent process
12:24 judofyr oh
12:24 augensalat Starman has a srand() too, btw: https://metacpan.org/source/MIYAGAWA/St​arman-0.3003/lib/Starman/Server.pm#L141
12:25 batman judofyr: $daemon->start is run before fork, and start() does App->new, which again runs startup()
12:25 batman judofyr: i'm 99.99% sure that is right :)
12:25 batman judofyr: try this: sub startup { $_[0]->timer(0, sub { warn $$ }); warn $$ }
12:25 sri augensalat: what i want is cold hard facts that show adding an srand() call solves real problems most of our users will have
12:25 judofyr joined #mojo
12:26 batman judofyr: check out the backlog. not sure if you catched the last bit...
12:26 judofyr 14:24 augensalat: Starman has a srand() too, btw
12:26 augensalat sri: You don't tell me, that you do a fix only, if *most* users have a problem?
12:26 sri "they do it too" and "i'm sure there are CPAN modules out there that may misbehave" are not good argument
12:26 batman judofyr: check the backlog
12:28 sri augensalat: that's why i say "hand waving", nothing you said so far is definitive, just vague statements that something may go wrong
12:31 sri augensalat: perhaps give up on trying to convince me for now and convince marcus, tempire or crab first
12:31 batman judofyr: please let me know how it works out for you, if you run that piece of code
12:31 batman judofyr: http://irclog.perlgeek.de/mojo/today <-- got it?
12:31 sri i'm generally the most conservative when it comes to changes
12:31 judofyr batman: I was just wondering; I don't need it :)
12:32 batman judofyr: kids these days.... ;)
12:32 batman now i'm wondering!!
12:32 batman hehe
12:32 sri batman: it does work
12:33 batman then i'm adding 0.01% to my certainty :)
12:33 sri you use the singleton though
12:33 batman yeah. just didn't bother to spell it out :P
12:34 judofyr batman: too bad you used floats 99.9 + 0.01 == 100.0 # => 0
12:34 crab augensalat: why don't you call srand yourself?
12:34 batman judofyr: oh. i thought i was writing 99.99...
12:34 judofyr err
12:34 judofyr doh
12:34 batman :D
12:35 crab i am also extremely opposed to doing anything to make it easier to pretend that rand() is a good source of secure randomness
12:35 batman i think we're messing up sri's conversation again...
12:35 judofyr I tried to joke about float, unfortunately I wasn't precise enough :(
12:36 augensalat crab: I would, but there doesn't seem to be a solid and coherent  way to to that
12:37 sri batman vs judofyr http://i591.photobucket.com/albums/s​s360/brk2ifurinmilwke/nerdfight.gif
12:37 batman judofyr: proper burn! hehehe
12:37 augensalat s/to/do/
12:37 judofyr augensalat: hm? isn't that what we're discussing right now?
12:37 batman sri: that is one awesome movie :)
12:37 judofyr augensalat: Mojo::IOLoop->timer(0 => sub { srand() })
12:37 judofyr sri: right? ^
12:38 sri i can confirm this
12:38 crab i can confirm other things
12:38 judofyr i can confirm $self
12:39 crab the weight of our collective confirmation has made augensalat speechless
12:39 sri i can also confirm that animated gifs are very distracting on irc
12:40 crab my irc client doesn't show animated gifs, thank &deity
12:40 judofyr let's bump the image up
12:40 judofyr
12:40 judofyr
12:40 judofyr
12:40 judofyr
12:40 sri IT NEVER STOPS!
12:40 judofyr
12:40 judofyr
12:40 crab oh you mean when people paste them and you have to click on the link?
12:40 judofyr god
12:40 judofyr
12:40 judofyr
12:40 judofyr
12:40 crab judofyr: stop it
12:40 judofyr
12:40 judofyr
12:40 judofyr oh, I can just do /clear
12:40 judofyr sorry!
12:42 sri and back on my quest of finding out how B::SPECIAL works
12:42 mauriez i cant do /clear :(
12:43 batman what about CTRL+L ?
12:43 batman sri: B::SPECIAL ?
12:45 judofyr Cmd-L gives me a nice line
12:45 sri batman: trying to make is_bool portable
12:45 batman sri: forget i asked. not going down the B:: road today :/
12:45 batman ah.
12:46 * judofyr wonders how many have animated-gif-showing IRC clients
12:46 judofyr http://25.media.tumblr.com/tumb​lr_mcdamd8URX1r3gb3zo1_400.gif
12:51 sri NOOOOOOOO!
12:51 mauriez heh
12:52 * sri learned he can do /clear too
12:52 sri no wait, i can't
12:52 sri now i see absolutely nothing
12:58 sri btw. FLAGS for booleans in 5.10 is 292615
13:00 judofyr sri: so, will be get Mojo::Util::is_bool? \o/
13:00 judofyr we*
13:00 sri judofyr: i'd rather like something more reliable
13:01 sri flag values that change from release to release make me nervous
13:01 crab what is this is_bool thing for anyway?
13:01 crab i mean, in the context of mojo
13:01 judofyr sri: I can only come up with sub foo { shift ? Mojo::JSON->true : Mojo::JSON->false }
13:01 sri crab: easy booleans for Mojo::JSON
13:01 judofyr so it's render_json => { foo => bool($bar) }
13:01 sri not exactly
13:02 sri render_json({foo => !!$bar})
13:02 sri you can convert everything into a boolean, that's the beauty of it
13:02 judofyr no, I meant that "sub bool" is a less hacky solution to the same problem
13:02 sri oh
13:02 judofyr s/sub foo/sub bool/
13:03 sri i would call it more hacky :)
13:03 crab ah, mojo::json.
13:03 judofyr it's more hacky than is_bool as a concept; less hacky implementation ;)
13:03 judofyr and still better than doing it inline
13:03 sri if we get it right i wouldn't be surprised if it inspired others
13:04 sri imo it's nice to having to use any hacks to generate json from perl structures
13:04 sri *+not
13:04 judofyr I too would prefer a is_bool-solution, but I don't know enough about Perl internals to know if it's safe :)
13:05 sri we already use another B hack
13:05 judofyr hm. for what?
13:06 sri https://github.com/kraih/mojo/bl​ob/master/lib/Mojo/JSON.pm#L291
13:06 sri to differentiate $foo = 23 and $foo = "23"
13:06 judofyr ah, right
13:09 sri ok, i'm an idiot
13:09 judofyr is that good or bad for is_bool?
13:10 sri *if* the flag values are really unique to booleans we can just use this http://pastie.org/5108875
13:11 judofyr that is smart
13:15 sri Adurah: do you know if the flags are really unique?
13:17 jnap joined #mojo
13:19 crab what flag is this, exactly?
13:19 sri all flags :)
13:20 crab i don't understand
13:20 sri i actually have no idea what i'm doing, all i know is that ->FLAGS looks like a bitfield
13:20 crab boolean values in perl are not specially flagged
13:21 batman sri: that's the best way to do stuff.
13:21 sri nope, they are special values
13:21 batman i nearly never know what i'm doing.
13:21 sri sv_yes and sv_no
13:21 crab you mean PL_sv_yes and PL_sv_no?
13:21 crab ah
13:22 crab so you're trying to identify if something is PL_sv_yes by seeing what flags it has?
13:22 sri i also don't have much confidence in the ->FLAGS thing
13:22 sri yea
13:22 sri or find another way to identify them with B
13:23 sri i'm sure you have a lot more experience with this than me :)
13:24 crab that won't work, in the core PL_sv_yes isn't specially flagged, what matters is its address
13:24 crab mro.c:  if(HeVAL(entry) == &PL_sv_yes || HeVAL(entry) == &PL_sv_no)
13:24 crab so they're identified like this ^^
13:25 sri :/
13:25 crab i think there may be a module like Scalar::Util with a function that takes a scalar and compares its address with PL_sv_yes
13:26 bluescreen joined #mojo
13:26 sri that function should be in Scalar::Util :)
13:26 crab but i may also just misremember
13:26 sri i don't think it exists yet
13:27 crab it's also been a long time since i looked into the code, but i don't think it's true that you'll get PL_sv_yes if you do !!$x
13:28 sri pretty sure you do
13:29 sri wait a minute
13:29 sri REFCNT = 2147483644
13:29 sri wut?
13:31 sri perl -MDevel::Peek -E 'Dump !!1'
13:33 sri i suppose that refcount hints at a boolean
13:33 judofyr sri: I get the same flags for !!0 and !!1
13:34 * sri just noticed the READONLY flag
13:35 sri that's something you don't get without hacks
13:35 sri crab: flags might be unique enough
13:35 sri even if it's not perfect
13:37 judofyr sri: the biggest problem is false positives. false negatives are special cases. are there cases where is_bool would return true on other types?
13:37 sri judofyr: hard to say
13:38 sri i bet you can build something with the same flags in XS, pure perl not so sure
13:39 sri FLAGS = (IOK,NOK,POK,READONLY,pIOK,pNOK,pPOK) is a lot
13:43 jnap joined #mojo
13:46 Adura joined #mojo
13:47 crab ok, it's true, you do get PL_sv_yes for !!$x. sorry.
13:48 amirite joined #mojo
13:48 amirite is there a way from the template/view to know which layout is rendering?
13:49 crab btw, it is normal for PL_sv_yes/no/undef to have REFCNTs like that
13:49 crab they are set to that at startup, at the same time their flags are set
13:49 sri crab: we could use that too for detection
13:50 sri combination of flags, refcnt and value should be pretty conclusive :)
13:57 gryphon joined #mojo
14:01 sh4 joined #mojo
14:01 judofyr sri: does this mean that Mojo::Util::is_bool is a fact?
14:01 sri afraid not
14:01 judofyr oh
14:01 judofyr why not?
14:02 sri looks like we still only have the flags
14:03 judofyr why?
14:03 judofyr or, why not refcnt?
14:03 sri i can't find a way from the B::PVNV to the underlying B::SPECIAL
14:14 sri http://blogs.perl.org/users/josh_ben_j​ore/2010/08/ponies-are-the-truth.html # :)
14:16 judofyr sri: I still feel like I don't know about Perl's memory/object/variable/reference model.
14:17 judofyr sri: wtf is the ${…} thing?
14:18 sri perl -E 'my ${foo} = 23; say $foo'
14:22 d4rkie joined #mojo
14:24 sri or scalar deref of course
14:24 mauriez hi guys.. would you know any Mojolicious apps running on Heroku of which source code is available on Github? #needexamples
14:25 rem_lex| joined #mojo
14:27 * sri realizes he sucks at explaining perl
14:28 judofyr sri: I'm not sure if I want to know :)
14:31 batman judofyr: ${ ... } will deref whatever is inside, but since "foo" is not a variable, it will just "refer" to that variable name instead.
14:31 sri perl -E 'my $foo = 23; my $bar = {foo => \$foo}; say ${$bar->{foo}}'
14:32 batman judofyr: $bar = 123 and $foo = \ $bar then both $$foo and ${$foo} will refer to 123
14:32 batman or to any value that $bar holds :P
14:32 batman but ${foo} is really just the same as $foo
14:32 sri say "${foo}barbaz"
14:33 judofyr well, that makes sense
14:33 batman judofyr: seen this: print "hello @{[$foo]}"; ?
14:34 batman uhm... wait a sec. bad example :S
14:34 judofyr but this: `${\1} = 2` (after the read-only is changed)
14:34 judofyr or, I mean: `${\!!1} = 2`
14:34 sri judofyr: normal perl programmers don't touch that stuff :)
14:34 knshaum joined #mojo
14:35 batman judofyr: you can't do that
14:35 sri in that case it's a scalar deref btw
14:35 sri you can
14:35 judofyr batman: http://blogs.perl.org/users/josh_ben_j​ore/2010/08/ponies-are-the-truth.html
14:35 sri you get the constant !!1 and deref it for modification
14:36 sri very very evil
14:36 batman oh. but that's poking around. not regular perl :)
14:38 batman not sure if there's anything that can't be done i perl these days..?
14:39 batman i guess there's always something...
14:39 * sri was about to say "we can't get into the browser", but then i remembered Perlito
14:39 batman :)
14:40 judofyr you don't run on Java :)
14:40 sri actually
14:40 judofyr oh?
14:41 sri i guess you have to compile the perl to ruby first :)
14:41 judofyr :D
14:41 batman perl6's next step is to run on the jvm iirc
14:41 sri yes it is
14:41 sri https://github.com/fglock/Perlito # btw
14:42 judofyr every time I think about creating a programming language I get stuck on something. this time: parsing. so many crappy parser tools out there.
14:42 sri make sure to take a look at perl6
14:43 sri the parser tools are awesome...grammers! *drool*
14:43 sri s/e/a/
14:43 judofyr any good resources? I've heard about it.
14:43 crab parsar tools?
14:43 * crab hides
14:44 sri the perl6 grammar https://github.com/rakudo/rakud​o/blob/nom/src/Perl6/Grammar.pm
14:45 judofyr sri: where's HLL::Grammar?
14:45 sri if in doubt nqp
14:46 sri https://github.com/perl6/nqp # a mini perl everything else is built around
14:46 judofyr ah
14:46 judofyr nice
14:46 sri "not quite perl"
14:46 judofyr for bootstrapping?
14:46 sri nqp is the part that gets ported to different vm's
14:47 sri https://github.com/perl6/nqp/b​lob/master/src/HLL/Grammar.pm
14:48 sri all the PIR stuff is Parrot assembler
14:50 * sri learned grammars from this tiny JSON implementation :) https://github.com/moritz/json/blo​b/master/lib/JSON/Tiny/Grammar.pm
14:51 judofyr sri: do you know what type of parser it is? LL(k)?
14:51 sri afraid not
14:52 judofyr well, it's context-sensitive at least
14:53 inokenty joined #mojo
15:05 sri hmmmmm
15:05 sri perl -MScalar::Util=dualvar -MDevel::Peek -E 'my $foo = dualvar 1, "1"; Internals::SvREADONLY($foo, 1); Dump $foo'
15:05 sri this is as close as i can get to boolean flags
15:06 sri not sure how to get NOK and pNOK
15:07 sri and without PADMY
15:07 sri perl -MScalar::Util=dualvar -MDevel::Peek -E 'our $foo = dualvar 1, "1"; Internals::SvREADONLY($foo, 1); Dump $foo'
15:15 sri i suppose it's not unique enough for is_bool
15:19 nic fraid I can't help you get pNOK -- been trying for years -- still no pNOK
15:23 nic it's nice that https://github.com/kraih/mojolici​ou.us/blob/master/mojolicious.pl is available as yet another interesting example
15:25 nic (had to use 'off' so tempire doesn't get upset)
15:26 * sri upsets tempire
15:28 * sri assigns a github issue to tempire and wonders what will happen
15:29 judofyr have I missed a tempire meme?
15:29 sri almost certainly
15:39 crab nic: no pNOK? just dualvar 0.1, "foo" will give you NOK and pNOK (but not IOK or pIOK, iirc)
15:40 crab what is this [off]?
15:40 judofyr your talking funny
15:41 judofyr crab: pNOK, NOK, IOK, pIOK
15:42 crab this conversation is too complicated for me.
15:43 judofyr crab: hehe. I was just noting that in your sentence I didn't understood "pNOK, dualvar, NOK, IOK or pIOK"
15:43 judofyr understand*
15:44 crab NOK is a flag on a scalar that says that its nv (numeric) slot contains a value. IOK is ditto integer (iv). POK is ditto string (pv).
15:45 crab pNOK is a private flag that says something about the nv slot. kinda sorta. maybe. (in truth, the private flags pNOK/pIOK/pPOK are sometimes abused for evil purposes.)
15:45 judofyr ah. I got it. magic.
15:45 crab dualvar is a var with more than one set of IOK/NOK/POK set.
15:45 crab the private flags are used for magical purposes, yes.
15:47 judofyr anyway. I'm off.
15:47 crab ok.
15:49 xaka joined #mojo
16:39 * dross yawns
17:02 dpetrov_ joined #mojo
17:02 dpetrov_ joined #mojo
17:20 judofyr joined #mojo
17:24 pierrick joined #mojo
17:29 labrown joined #mojo
17:31 Chesti joined #mojo
17:31 Chesti hi
17:32 GabrielVieira2 joined #mojo
17:33 Chesti i`m looking for someone expperienced who can help me with assess if mojo is good for my app
17:37 nic Can I sanity check a ua get please
17:38 nic I need to GET https://abc.com?foo=bar
17:38 nic I have built up my params inside a Mojo::Parameters
17:38 nic then done $self->ua->get($self->api_url .'?'. $req->params)
17:39 nic is that sensible or flying into the wind?
17:40 nic (it looks ok in debug and I'm guessing the url_escape'ing is still appropriate even tho this looks a little like abuse)
17:42 Chesti nic: i`m first time here but channel looks like a dead town...
17:42 sri 134 ghosts :o
17:43 Chesti quite a lot :)
17:43 * xaka hides in cabinet
17:43 Chesti so who`s in coffin?
17:43 * sri rattles some chains
17:44 xaka Chesti: you better to start asking your question :)
17:44 Chesti ok ;)
17:46 Chesti i have to write an app that will collect data from other app and write it to DB (1 part) that what will be in daabase i will have to be able to present on website (second part) and i have to be able to make e-mail reports (third part)
17:47 Chesti i`m wondering if good idea to look for MVC framework to this task
17:47 Chesti or sould i rather werite something standalone
17:48 xaka mojo has everything you need except database access, but there are a lot of ready to use plugins on CPAN
17:51 Chesti what i should look for to get to know how to collect data (that`s a non website part of code)
17:52 Chesti i see that is lot of info about writing websites
17:52 xaka that "other app", does it have http api? how are you going to (or able to) collect the data?
17:52 Chesti bt thats more like backend collector script
17:53 xaka right, it should be separate and independent service
17:53 Chesti i have to invoke shell command to get data
17:53 Chesti from other app
17:53 xaka local or remote shell command?
17:53 Chesti local
17:54 Chesti ok so there are services in mojo?
17:54 xaka for part 1 you just need simple perl scripts that runs shell command, parses it and puts the data into the database
17:55 Chesti ok so that should be separae
17:55 xaka definitly
17:56 Chesti ok great
17:56 xaka if you need super fast solution that just works (fast or slow, doesn't matter) you can put it all into the mojo app and use timers to do part 1 every N seconds/minutes/...
17:58 Chesti in a matter of fact i have this part ready and i`m looking for website part but i was wondering if that is something that r some reasons should be moved inside mojo - i didn`t want to sugges anything at first
17:58 Chesti so i hae the data in DB
17:59 Chesti i think that website part will be easy
17:59 Chesti i know perl so only thing i need to get to know mojo
18:00 Chesti it looks solid and light
18:00 xaka mojo is really good for fast-start and further growing
18:01 Chesti what i`m affraid of that this will be in production environment that has no web access
18:01 xaka Mojolicious: learn nothing, do everything!
18:01 Chesti and `m affraid of maintaining dependences
18:02 Chesti of perl modules
18:02 xaka mojo has 0 dependences so there is nothing to maintian
18:03 xaka sri takes care of maintaining, you take care of your application :)
18:03 Chesti more you say, more happy i am
18:05 Chesti you know if you can`t use cpan to download modules there is a problem to handle it manualy
18:07 gizzlon joined #mojo
18:09 Chesti xaka: i saw once litle bit of django and ther you give access to db to django and it create db structure but asfar i understand mojo is not like django and it`s not force you to use its db structure design?
18:12 xaka mojo has nothing to do with database so it's up to you what to use
18:13 Chesti ok
18:17 Chesti after what you told me i think that mojo is what i`m looking for
18:17 Chesti thanks ;)
18:18 xaka the problem with django is that you already have the database schema so you ca'nt just define the models, you have to customize them carefuly
18:19 xaka i.e. customize naming convention, etc.
18:21 xaka Chesti: so... are you ready to sign up for mojo army and give us your soul and become os those 134 ghosts?
18:22 xaka os -> of
18:22 Chesti i think so :)
18:24 Chesti i have weekend free for experimenting with mojo
18:25 Chesti i`m sure i`ll like it like i like perl
18:27 * dross is a django user too
18:27 dross mojo doesn't have any ORM, you'll have to choose an ORM if you wish to use one
18:27 dross or don't, it's your choice
18:27 good_news_everyone joined #mojo
18:27 good_news_everyone [mojo] kraih pushed 1 new commit to master: http://git.io/4X-AfA
18:27 good_news_everyone [mojo/master] added example for running code after a new Hypnotoad worker has been forked - Sebastian Riedel
18:27 good_news_everyone left #mojo
18:28 Chesti i`m not a django user i jst did some research long ago
18:28 dross Chesti: ah okay
18:28 dross Chesti: think of Mojo to be like WebPy
18:28 dross it's a lightweight framework which is very flexible
18:30 Chesti i`m a sysadmin but form time to time i have to do something and i find that learn some framework will be save of my time
18:30 sri marcus: i guess that example was overdue
18:30 * dross is a devop, I lean towards system engineering with many of my jobs
18:31 dross Chesti: if you don't like programming, you can always go to sharepoint :)
18:31 dross easy, you can set up workflows, where data goes, integrate with other systems
18:31 dross *control where data goes
18:31 Chesti dross : sharepoint... kill me first
18:32 dross with that attitude, you're not going to go places
18:32 Adura <sri> Adurah: do you know if the flags are really unique?: Maybe unique enough, only 100% sure way was using a reference to !!X instead of it proper.
18:32 dross There's a reason I can get jobs paying 45+USD/hr in places like Pittsburgh which are cheap places to lvie
18:33 dross learn to integrate with other systems, or be a loser admin who only makes 65k a year
18:33 Chesti i live in Poland in central europe and here job market looks different
18:34 Adura My attempts to reference what $yes/$no copied failed.
18:34 xaka dross: world != USA :-P
18:34 dross the US controls the world economy
18:34 dross deal with it
18:34 Adura I thought China owned the US...
18:34 dross when the US economy went down, so did everyone else
18:35 Chesti heh so i work in US company
18:35 Chesti anyway
18:35 sri Adura: we've established by now that the flags are not unique enough
18:35 dross greek goes down, the citizens of the US laugh
18:35 Adura Enough, eh.
18:35 dross *Greece
18:36 Adura You'll have to use references to them, then.
18:36 Chesti best jobs offers are for SAP specialist
18:36 Adura I'm surprised you could get all those flags on 1 or 0, though.
18:37 Chesti 2 to 5 times more money than sysadmin or java developer
18:38 Chesti ok got to go, but i`ll be back...
18:39 Chesti thanks
18:45 sri Adura: i may have a solution
18:45 Adura Lockin'
18:45 sri http://pastie.org/5110679 # this one might do the trick
18:46 sri equal flags and value should make false positives extremely unlikely
18:47 Adura I shall poke at it.
18:47 sri crab: thoughts?
18:47 sri if it looks like a "1" or "" and has all the flags it is a boolean imo
18:48 Adura Yeah, was thinking of testing for those two.
18:53 sri don't think there is much more that could be done with pure perl
18:54 Adura You'd really have to screw around with a return value to make it match those flags.
18:54 sri well, my dualvar oneliner above is close
18:54 sri it's trivial to do in XS
18:54 Adura So...
18:55 Adura pp_is_bool
18:55 Adura sane_is_bool
18:56 sri oh, we could also compare SvTYPE i guess
18:57 abra joined #mojo
19:03 sri http://pastie.org/5110753 # with SvTYPE
19:07 Adura For some reason, 'whatever' carries over into 23 using Data::Peek.
19:12 Adura Guess it's the magic of $_.
19:13 sri maybe it should be called looks_like_bool :)
19:14 yakudza joined #mojo
19:14 Adura Sure does.
19:20 Mike-PerlRecruiter_ joined #mojo
19:30 duncanthrax joined #mojo
19:36 sri marcus, crab, tempire: review and comment! https://gist.github.com/3948157
19:37 sri and everyone else too
19:50 Adura http://ideone.com/2FSn0O To avoid $_ being annoying.
19:54 Adura Wait, it still does that...
19:54 Adura Confusing...
19:56 rafl joined #mojo
20:02 perlite joined #mojo
20:07 xaka joined #mojo
20:17 fibo joined #mojo
20:36 lukep joined #mojo
21:17 Averna joined #mojo
21:31 batman joined #mojo
22:00 duncanthrax2 joined #mojo
22:01 duncanthrax joined #mojo
22:03 duncanthrax2 joined #mojo
22:10 duncanthrax joined #mojo
22:13 duncanthrax2 joined #mojo
22:14 zpmorgan joined #mojo
22:34 jzawodn joined #mojo
23:09 marcus_ joined #mojo

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