Camelia, the Perl 6 bug

IRC log for #crimsonfu, 2013-02-19

crimsonfu - sysadmins who code

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

All times shown according to UTC.

Time Nick Message
00:37 jimi_c joined #crimsonfu
00:40 Ox6abe joined #crimsonfu
00:57 teancom joined #crimsonfu
01:15 teancom joined #crimsonfu
01:29 teancom joined #crimsonfu
02:05 teancom joined #crimsonfu
04:09 larsks|phone joined #crimsonfu
05:04 teancom joined #crimsonfu
05:38 jgtimmer joined #crimsonfu
05:44 larsks|phone joined #crimsonfu
05:59 larsks|phone joined #crimsonfu
07:06 agoddard joined #crimsonfu
08:13 Itkovian joined #crimsonfu
12:30 Itkovian joined #crimsonfu
12:36 boegel joined #crimsonfu
12:41 sjoeboo joined #crimsonfu
12:43 Itkovian_ joined #crimsonfu
13:05 jimi_c joined #crimsonfu
13:13 larsks|phone joined #crimsonfu
13:24 larsks|phone joined #crimsonfu
13:31 chasmo joined #crimsonfu
13:59 Itkovian joined #crimsonfu
14:08 larsks joined #crimsonfu
14:37 semiosis awfully quiet in here this week
14:42 magoo joined #crimsonfu
14:46 larsks joined #crimsonfu
15:00 SEJeff_work joined #crimsonfu
15:00 SEJeff_work Perl question for the many perl-istas here...
15:01 SEJeff_work I've inherited a largeish amount of perl and have been maintaining it amongst other things. Much of it wasn't written by a very disciplined developer, so I'm cleaning it up to pass "use strict; use warnings;", which is a bit painful
15:02 SEJeff_work So there is a patter I'm seeing frequently that is like: eval { $Data = $JSONObject->decode($ReturnData); };
15:03 SEJeff_work $Data is a reference to a hash containing the json data in all K=>V form. If I try to initialize $Data before the eval it is ignored, and if I change $Data to my $Data, I need to re-declare it AND re-run the decode below to populate the data
15:04 SEJeff_work What is the proper way to initialize a hash ref above the eval and then set it in the eval (if that is possible?). It works perfectly fine without strict mode, but strict mode has cause several blatant bugs in this 1700 line script that I'm slowly fixing
15:08 larsks SEJeff_work: What do you mean by "initialize" $Data?  Since you're assigning to it in the eval it doesn't make sense to initialize it to anything else.  You can declare it outside the eval as "my $Data" (or "our $Data", if it's global).
15:09 larsks Got links to actual code that demonstrates the problem?
15:12 SEJeff_work larsks, Sadly I do not have links to the code. What is the perl word for my $foo = "bar"; Coming from python or c, I'd call it initializing or a prototype
15:12 SEJeff_work larsks, So I'm defining a variable that is meant to be a hash ref. Then I've got to (gross I know) decode the json in an eval to make sure it is actually valid json, then use it later on in the script. Does that require making it a global?
15:13 SEJeff_work Forgive me, I'm a recovering pythonista who is becoming a polyglot developer
15:14 larsks Coming from C, I would call "my $foo = bar" assignment, and "my $foo;" a declaration.
15:14 larsks SEJeff_work: I think just declaring it as "my $Data" prior to the eval should be fine.
15:14 SEJeff_work touche
15:17 larsks SEJeff_work: E.g: https://gist.github.com/larsks/4986776
15:22 SEJeff_work Just commented on  your gist. I've got the code like that, but it is blowing up somewhere else. There are ~300 lines of complaints about variables not being defined properly. Just trying to beat through them and then write some unit tests. Thanks for your help sir.
15:34 jimi_c joined #crimsonfu
16:14 Ox6abe joined #crimsonfu
17:37 boegel joined #crimsonfu
18:33 pdurbin_m joined #crimsonfu
18:33 pdurbin_m semiosis: yeah, in Denver
18:34 spilth joined #crimsonfu
18:35 pdurbin_m se_Jeff: you're back! eval is evil. convert properly with from_json or similar from "use JSON"
19:47 boegel joined #crimsonfu
20:23 magoo quit
20:24 magoo joined #crimsonfu
20:49 larsks eval isn't evil!  eval {} is exception handling.
20:50 larsks e.g.: https://www.socialtext.net​/perl5/exception_handling
21:21 comptona joined #crimsonfu
22:00 jimi_c joined #crimsonfu
22:08 Itkovian joined #crimsonfu
22:23 sjoeboo joined #crimsonfu
22:59 comptona1 joined #crimsonfu
23:03 comptona joined #crimsonfu
23:35 sjoeboo joined #crimsonfu

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

crimsonfu - sysadmins who code