Source

blogs.perl.org Entries / blogs.perl.org-entries / blogs.perl.org-journal.xhtml

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
<?xml version="1.0" encoding="utf-8"?>
<!-- vim: set indentexpr=:   -->
<!DOCTYPE
    html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
<head>
<title>blogs.perl.org Blog</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
div.entry
{
    border: darkgreen solid medium;
    padding: 0.5em;
    margin: 0.5em;
}
</style>
</head>
<body>

<div class="entry" id="text-table-1">

<ul class="info">
<li><b>Date:</b> 21-04-2011</li>
</ul>

<h1>Introduction to blogs.perl.org + Text::Table</h1>

<p>
Hello, Perl bloggers! I decided to start
blogging about a most of my exclusively Perl-related stuff here on
blogs.perl.org, in hope of getting more comments
from active Perlers. (Until now, I've blogged about it
<a href="http://shlomif-tech.livejournal.com/">on
my technical LiveJournal blog</a> and previously on
<a href="http://use.perl.org/~Shlomi+Fish/journal/">use.perl.org Journal</a>.).
You can learn more about me on <a href="http://www.shlomifish.org/">my home
site - www.shlomifish.org</a> .
</p>

<p>
OK, having put that aside - let's move on to the main topic of this post.
</p>

<hr />

<p>
Many months ago I wanted to use the
<a href="http://search.cpan.org/dist/Text-Table/">Text::Table CPAN module</a>
to present a table related to the meta-scan heuristics construction
scheme of <a href="http://fc-solve.berlios.de/">Freecell Solver</a>. Now,
I wanted to present nicely formatted borders, using the
<a href="http://en.wikipedia.org/wiki/Box-drawing_characters">Unicode
box-drawing characters</a> (which some people would recall from DOS).
However, I found it difficult to specify the separators in the
rulers properly based on their indices - they were assumed to be the
same globally. As a result, I've written
<a href="https://rt.cpan.org/Public/Bug/Display.html?id=61610">a patch</a>,
and placed the modifications in
<a href="http://github.com/shlomif/Text-Table">a github repository</a>.
</p>

<p>
The author of Text-Table (ANNO) told me he was working on a new version
of Text-Table, which will contain many improvements. However, I was still
interested in an enhanced version of the old Text-Table codebase with my
patch, and after talking on <a href="irc://irc.freenode.net/#perl">#perl</a>,
ANNO said I could have co-maint
on Text-Table-1.x and continue to improve it. The new Text-Table will be
released under a separate namespace - <tt>Text::Table2</tt> or so.
</p>

<p>
Many thanks go to ANNO for agreeing that I further develop Text::Table.
</p>

<p>
Using my git repository, I did many cleanups, like add
pod.t and pod-coverage.t, tweak the author information, add more strict and
warnings to the file, etc. ANNO 's original licence is
<a href="http://perlbuzz.com/2009/07/help-end-licensing-under-same-terms-as-perl-itself.html">"Same
terms as Perl"</a>, but since it is an iffy licensing, I decided that all
further changes will be under the terms of the Public-Domain/X11L/etc.. People
who send me pull requests on github may wish to add their names to the credits
(in the changes or even in the core module) but must not claim copyrights to
their changes.
</p>

<p>
OK, now for some output of the Unicode table:
</p>

<pre>
┌───────╥─────┬──────┬─────┬────┬──────┐
│ Place ║ 1   │ 2    │ 3   │ 4  │ 5    │
├───────╫─────┼──────┼─────┼────┼──────┤
│ 1     ║ 68  │ 317  │ 15  │ 3  │ 381  │
├───────╫─────┼──────┼─────┼────┼──────┤
│ 2     ║ 171 │ 482  │ 31  │ 14 │ 594  │
├───────╫─────┼──────┼─────┼────┼──────┤
│ 3     ║ 275 │ 867  │ 42  │ 22 │ 1007 │
├───────╫─────┼──────┼─────┼────┼──────┤
│ 4     ║ 458 │ 1442 │ 125 │ 30 │ 1630 │
├───────╫─────┼──────┼─────┼────┼──────┤
│ 5     ║ 640 │ 1715 │ 137 │ 47 │ 1730 │
└───────╨─────┴──────┴─────┴────┴──────┘
</pre>

<p>
Future plans are:
</p>

<ol>

<li>
Convert the remaining test scripts to Test::More.
</li>

<li>
Go over the code and clean it up
</li>

<li>
Add CPAN keywords to the <tt>META.yml</tt>. (Perhaps this will require
defining a Module-Build-based Build.PL file).
</li>

<li>
Add URLs to the <tt>META.ym</tt>l - to the module's homepage, to the github repository,
etc..
</li>

<li>
Possibly implement some future features.
</li>

<li>
Add some more tests.
</li>

</ol>

<p>
Contributions are naturally welcome, just fork the github repository and send
me a pull request. (Or patches are also OK.)
</p>

</div>

<div class="entry" id="entry-to-yapc-europe-2011">

<ul class="info">
<li><b>Date:</b> 20-06-2011</li>
<li class="tags">YAPC</li>
</ul>

<h1>Transferring a Ticket to YAPC::Europe::2011</h1>

<p>
I originally planned to attend
<a href="http://yapceurope.lv/ye2011/">YAPC::Europe::2011</a> in Riga, Latvia
(on 15-17 August, 2011), and so bought an early bird ticket, but will no
longer be able to attend due to personal reasons. As a result, I'm now seaking
to transfer the ticket to someone else, for the right price (which will be
cheaper than what I bought it.).
</p>

<p>
If you are interested, please
<a href="http://www.shlomifish.org/me/contact-me/">contact me</a> and we will
negotiate a price. I hope everybody enjoys the YAPCs.
</p>

</div>

<div class="entry" id="resuming-maintenance-of-xml-libxml">

<ul class="info">
<li><b>Date:</b> 20-06-2011</li>
<li class="tags">XML, libxml, CPAN</li>
</ul>

<h1>Resuming Maintenance of XML-LibXML</h1>

<p>
For a long while, work on the
<a href="http://beta.metacpan.org/release/XML-LibXML">XML-LibXML
CPAN module</a> halted as the existing maintainer was busy.
After <a href="http://code.activestate.com/lists/perl-xml/8885/">a
discussion</a> on the Perl-in-XML mailing list, some people and I were
given co-maintainer status and we resumed its maintenance inside
<a href="https://bitbucket.org/shlomif/perl-xml-libxml">a Bitbucket.org
Mercurial repository</a>.
</p>

<p>
So far what I did, was fix some low-hanging fruit
bugs, apply some patches, as well as start the long process of converting
the test suite, which still uses Test.pm to
<a href="http://beta.metacpan.org/module/Test::More">Test::More</a> . There are
still many bugs lurking there, and some of them are XS bugs that are still
beyond my reach, and I could use some assistance there. But it's a start.
</p>

<p>
If you're interested in helping, the clone the repository, write a patch and
send me a pull request.
</p>

<p>
<b>Text::Table Update:</b> I've written about
<a href="http://blogs.perl.org/users/shlomi_fish/2011/04/introduction-to-blogsperlorg-texttable.html">resuming
the maintenance of Text::Table</a> in April, and it progressed nicely:
the tests were converted to Test::More, a lot of the code was cleaned up,
the build system was converted to Module::Build, and keywords and resource
URLs were defined, and some bugs were solved (along with tests). I'm still
looking into ways to clean up the code, and if anyone has an idea for a cool
feature, then they should drop me a line (or provide a patch).
</p>

</div>

<div class="entry" id="convert-away-from-Test.pm">

<ul class="info">
<li><b>Date:</b> 23-06-2011</li>
<li class="tags">QA, PPI, Perl</li>
</ul>

<h1>PPI-Based Script to Convert Test.pm-based Test Programs to Test::More</h1>

<p>
Some CPAN modules I inherited used the old
<a href="http://search.cpan.org/perldoc?Test">Test.pm</a> for some of their
<tt>t/*.t</tt> scripts instead of the more modern
<a href="http://en.wikipedia.org/wiki/Test::More">Test::More</a>. This
annoys me to no end because Test.pm is very limited. When I worked on
<a href="http://beta.metacpan.org/release/Config-IniFiles">Config-IniFiles</a>,
I did the conversion manually, which was a lot of work. More recently, I
<a href="http://blogs.perl.org/users/shlomi_fish/2011/06/resuming-maintenance-of-xml-libxml.html">started
working on XML-LibXML</a> which has over 40 of those pesky Test.pm scripts, and
I did not have the nerve to do all the manual and menial work.
</p>

<p>
As a result, I ended up spending a few hours studying
<a href="http://beta.metacpan.org/release/PPI">PPI</a> (the Perl Parsing
Interface), and writing
<a href="http://www.shlomifish.org/open-source/projects/Test.pm-Converter/">a
script</a> to automatically convert Test.pm-based scripts to Test::More. The
main issue at hand was that in Test.pm, a single argument <tt>ok()</tt>
tests for the scalar's truth, while a double argument <tt>ok()</tt> tests for
simple equivalence (similarly to Test::More's <tt>is()</tt>). Eventually, I got
the script working, with some limitations (see <a
href="http://www.shlomifish.org/open-source/projects/Test.pm-Converter/">the page</a>).
</p>

<p>
So what was my impression of PPI? It naturally seems more robust than using
regular expressions and hacks to process Perl code, but there were a few quirks.
For example, a PPI
<a href="http://beta.metacpan.org/module/PPI::Structure::List">list</a> contains
an array of its contents, and the commas are part of them, as are the
various other tokens in the sub-expressions. Therefore, divining the count of
the  arguments is pretty hard. I would have expected to get a more <a href="http://en.wikipedia.org/wiki/Abstract_syntax_tree">abstract
syntax tree</a> of the arguments, and since I didn't I had to work around
it with an ugly kludge.
</p>

<p>
Furthermore, after stringifying the document object, the contents of the
<a href="http://en.wikipedia.org/wiki/Here_document">here-documents</a> were
not included in the output from some reason. However, I may have done something
wrong. I also wish the PPI PODs contained more meaningful examples.
</p>

<p>
Nevertheless, my script is mostly working now and I can utilise it to
"test-lift" legacy test programs. You might find it useful too, so it's there
in case you need it, and patches to fix its limitations would be welcome.
</p>

</div>

<div class="entry" id="Inline-C">

<ul class="info">
<li><b>Date:</b> 09-11-2011</li>
<li class="tags">Perl, QA, XS, Inline, C, ctypes, gcc</li>
</ul>

<h1>My Experience with Inline::C</h1>

<p>
I know I didn’t write here for a long time, and I apologise for it, but I have
this entry and another one in mind and I hope they can compensate for it.
</p>

<p>
For my work on <a href="http://fc-solve.shlomifish.org/">Freecell Solver</a>,
I’ve written some code for encoding and decoding game positions into a
compact format, by encoding them as a delta from the position of origin. I
first wrote it in Perl, in order to prototype it, and later
translated it to C (which is the language that Freecell Solver is written in).
I have written some rudimentary unit tests for it, but also wanted to test the
code against a large number of positions, by runnign it over the solutions of
many Freecell deals.
</p>

<p>
The encoding rearranges the order of the card columns and the freecells, so
testing that the output test is correct requires calculating that arrangement.
This was also done by the Perl code. I decided to write a small wrapper for
an encoding+decoding round-trip in C, and use it from a Perl program I was
writing. So far so good.
</p>

<p>
I first looked at <a href="https://gitorious.org/perl-ctypes">the
Perl version of Ctypes</a>, but it failed a large number of its assertions
on my system, so I could not really trust it. Then I looked at
<a href="http://search.cpan.org/perldoc?Inline::C">Inline::C</a>. I could
not understand from its main page, how to return an <tt>SV *</tt> containing
a string from it, but this was covered in the extensive
<a href="http://search.cpan.org/perldoc?Inline::C-Cookbook">Inline::C
cookbook</a> and I wrote this Inline::C function:
</p>

<pre>
extern char * fc_solve_user_INTERNAL_delta_states_enc_and_dec(
    const char * init_state_str_proto,
    const char * derived_state_str_proto
    );

SV* enc_and_dec(char * init_state_s, char * derived_state_s) {
    SV * ret;
    char * s;
    s = fc_solve_user_INTERNAL_delta_states_enc_and_dec(init_state_s, derived_state_s);

    ret = newSVpv(s, 0);
    free(s);
    return ret;
}
</pre>

<p>
I don't need to use “sv_2mortal” there because Inline::C does that for us.
Then I tried to test it. It failed with this error:
</p>

<pre>
perl: symbol lookup error: /home/shlomif/progs/freecell/trunk/fc-solve/source/_Inline/lib/auto/Mega_Test_for_C_delta_states_pl_9385/Mega_Test_for_C_delta_states_pl_9385.so: undefined symbol: fc_solve_user_INTERNAL_delta_states_enc_and_dec
</pre>

<p>
I was familiar with errors like that, but it took me over an hour of playing
with the various Inline::C configuration options, and trying to figure out
why it didn’t link against the relevant Freecell Solver library to realise
what the problem was. It was that the library in question did not export the
symbol, and gcc realised it didn't give the XS extension anything and omitted
it.
</p>

<p>
After fixing this line in my C source:
</p>

<pre>
char * DLLEXPORT fc_solve_user_INTERNAL_delta_states_enc_and_dec(
</pre>

<p>
To this line:
</p>

<pre>
DLLEXPORT char * fc_solve_user_INTERNAL_delta_states_enc_and_dec(
</pre>

<p>
Everything worked properly, and I was able to run the so-called “mega-test”.
</p>

<p>
If you’re having similar problems with Inline::C, you should try to add
<tt>CLEAN_AFTER_BUILD =&gt; 0</tt> to its configuration. It ended up clarifying
a lot for me.
</p>

<p>
Cheers!
</p>

</div>

<div class="entry" id="exec-portability">

<ul class="info">
<li><b>Date:</b> 09-11-2011</li>
<li class="tags">exec, perl, portability, whitespace, windows, unix</li>
</ul>

<h1>exec's portability</h1>

<p>
Pop quiz! What does this perl 5 program prints when executed with no
arguments?
</p>

<pre>
#!/usr/bin/perl

use strict;
use warnings;

if (! @ARGV)
{
    exec($^X, $0, "hello world");
}
else
{
    my $arg = shift(@ARGV);
    print "Got &lt;$arg&gt;\n";
    if (@ARGV)
    {
        print "Other args are &lt;@ARGV&gt;\n";
    }
}
</pre>

<p>
The answer is “it depends.”. On my Linux system it prints
“Got &lt;hello world&gt;”, while on Windows, using Strawberry Perl, it
prints “Got &lt;hello&gt;” and later on that the other args are “world”.
</p>

<p>
I would expect the Linux behaviour were every argument passed to the list
<a href="http://perldoc.perl.org/functions/exec.html">exec</a> arrives as
one argument to <tt>@ARGV</tt> regardless of whitespace as the correct. It
also the behaviour exhibited on both operating systems using
<a href="http://perldoc.perl.org/functions/system.html">system</a>. Is this
a bug?
</p>

<p>
<a href="http://perldoc.perl.org/perlport.html">perlport</a> only has this
to say about whitespace: <q>Whitespace in filenames is tolerated on most
systems, but not all, and even on systems where it might be tolerated, some
utilities might become confused by such whitespace.</q>.
</p>

<p>
I discovered this strange mis-behaviour when working on a commission for
a client who is Windows-based.
</p>

</div>

<div class="entry" id="telaviv_pm_2011_Nov_report">

<ul class="info">
<li><b>Date:</b> 03-12-2011</li>
<li class="tags">Perl, Mongers, Tel Aviv, Israel, meeting, DBI, DBIx-Class, local-lib, perlbrew, cpanminus, CPAN, Firebird, SQL</li>
</ul>

<h1>Report on the Latest Tel Aviv Perl Mongers Meeting</h1>

<p>
I attended the latest
<a href="http://telaviv.pm.org/">Tel Aviv Perl Mongers (TelAviv.pm)</a>
meeting the other
day, and am writing this report in order to encourage more people
to come. We didn't have meetings in September or October due to the Jewish
holidays and some renovations on the site, so it was good to finally have
a meeting.
</p>

<p>
Before the meeting, I had helped publicise it on various online news channels,
and thankfully quite a few people (about 20-30) came. I had a previous
appointment that day at 12:00, and so returned home where I ate, worked on
the computer, and rested before the TelAviv.pm meeting.
</p>

<p>
After I rode the bus, I arrived there a few minutes earlier. I met a fellow
Perl monger on the way. We found the room with some difficulty, as there were
very few signs outside the doors of the various rooms in the building. Several
people
including  <a href="http://szabgab.com/">Gabor</a> were already sitting
in the room.
They were discussing the upcoming Israeli Perl Workshop in February. In any
case, I decided to walk to the nearby
grocery store to buy some refreshments for the meeting, and when I returned
there were more people in the room.
</p>

<p>
Quite a few people arrived relatively late, but the talks started mostly on
schedule. The first talk (by Erez Schatz) was short, and it discussed some
recent tools that
facilitate the Perl programmer’s life: <a href="http://search.cpan.org/dist/local-lib/">local-lib</a>, <a href="http://www.perlbrew.pl/">perlbrew</a>, cpanm
and pm-uninstall. The talk was very fun, and he ended up covering some other
tools in brief in the last slide. I’m still not convinced that I should use
CPAN-Minus instead of my CPANPLUS (especially given
<a href="http://search.cpan.org/dist/CPANPLUS-Dist-Mageia/">CPANPLUS-Dist-Mageia</a>
and friends), but I still like perlbrew and local::lib and pm-uninstall seems
useful.
</p>

<p>
Erez mentioned that on Perl forums there were several very common and hated
questions like “How do I uninstall a perl module?” or “How can I use
CPAN without root?” and that these technologies address these needs precisely.
</p>

<p>
After this talk, Erez gave a longer talk about DBIx-Class, which is an
Object-Relational Mapper (ORM) for Perl. For the demo, he used a company
whose employees are dogs, and the slides featured many pictures of dogs in
suits (some of them pretty scary). There were a few glitches in the
demonstration, but they
were promptly overcome, and the <tt>DBIC_TRACE=1</tt> flag was a big help.
One bug in the code was that instead of updating the employee's department
(by looking it up by name), the department's name was updated (globally). I
any case, it was an enjoyable talk, but the person who sat next to me said
that she didn’t like it because she used to be a DBA, and she was worried about
performance.
</p>

<p>
Erez mentioned that DBIx-Class was the “Elephant in the Room” of Perl ORMs,
which I had concluded was the case as well.
</p>

<p>
After that talk, there was a break, where people got to eat more of the
cookies I bought and to chat. Afterwards, Ido Kanner presented about
<a href="http://www.firebirdsql.org/">Firebird SQL</a>. It was a good talk,
and Ido drew some comparisons between Firebird and SQLite, MySQL and
PostgreSQL. Firebird looks interesting and it also has embedded (like
SQLite) and read-only modes.
</p>

<p>
One problem during the talk was that the projector kept shutting down,
and it took us some trouble to restart it. We hoped this problem would be
resolved in upcoming meetings.
</p>

<p>
After the meeting, some of us (about 10) went to Spaghettim (a pasta/etc.
place) and had dinner. We chatted about Atheism, Cable company tech-support,
GNOME 3 and KDE 4, and lots of other stuff. This time I had a pizza, which
although not too bad, made me realise I will be ordering pasta there from now
on.
</p>

<p>
To sum up, it was a very enjoyable meeting, and I’m looking forward for
more future ones. One thing notable about it is that this time Sawyer did not
deliver a talk, which made him happy because other people volunteered to do
so instead.
</p>

</div>

<div class="entry" id="breaking_the_perl_debugger_for_fun_and_profit">

<ul class="info">
<li><b>Date:</b> 26-12-2011</li>
<li class="tags">perl,debugger,debugging,refactoring,features,sopa,telaviv,mongers</li>
</ul>

<h1>Breaking the Perl Debugger for Fun and Profit</h1>

<p>
Before I cover the main topic of this entry, here are some short news and
action items:
</p>

<ol>
<li>
<p>
If you have not acted against
<a href="https://www.eff.org/deeplinks/2011/12/fight-blacklist-toolkit-anti-sopa-activists">SOPA
- the proposed online blacklist/censorship bill</a>, you should. Follow the
link for information on how to act against it.
</p>
</li>
<li>
<p>
I have announced the
<a href="http://shlomif-tech.livejournal.com/60825.html">next Tel Aviv
Perl Mongers meeting</a> on my technical journal on LiveJournal.com. It will
take place this Wednesday, on 28 December, 2011. More information in the link.
</p>
</li>

<li>
<p>
<a href="http://golf.shinh.org/">Anarchy Golf</a> is a new server for Code Golf,
which are online programming competitions for implementing code as shortly as
possible. It supports Perl 5, Perl 6 and many other languages. There is
<a href="http://golf.shinh.org/p.rb?Starburst">an active challenge</a>, where
the only Perl 5 submission so far is mine, so I could use some competition.
</p>
</li>
</ol>

<p>
Now for the main topic of the post. Recently, three patches were integrated
into the perl-5 core implementing new features in the perl debugger:
</p>

<ol>
<li>
<a href="http://www.nntp.perl.org/group/perl.perl5.porters/2011/04/msg171038.html">Add "b &lt;filename&gt;:&lt;line&gt; &lt;cond&gt;" to perl -d</a> by me.
</li>
<li>
<a href="http://www.nntp.perl.org/group/perl.perl5.porters/2011/08/msg176454.html">Add enable/disable commands for breakpoints in perl -d</a> also by me.
</li>
<li>
<a href="https://rt.perl.org/rt3/Public/Bug/Display.html?id=104168">"Trace to max depth"</a> by Peter Scott.
</li>
</ol>

<p>
When Father Chrysostomos tried to apply the first patch, he noticed its tests
started failing. Apparently, the breakpoint functionality (irrespective of
the patch's added functionality) became broken in bleadperl, due to a change
in the internals, and it wasn't caught by the debugger's existing tests. I
ended up submitting another patch to add a test for some of the existing
breakpoint functionality.
</p>

<p>
The other two patches passed all of their own tests and the existing ones, but
that wasn't the end of the story. A short time afterwards
<a href="https://rt.perl.org/rt3/Public/Bug/Display.html?id=104820">a
regression was reported in the debugger</a>, which was caused by one of the
patches that I introduced. While, I fixed it with a test, it was soon followed
by other reports and fixes. None of these bugs were caught by the test suite
of the perl debugger, which is incredibly incomplete.
</p>

<p>
Another E-mail that caused an active discussion was
<a href="http://www.nntp.perl.org/group/perl.perl5.porters/2011/11/msg179847.html">my
proposal to add strict and warnings to lib/perl5db.pl</a>, in which someone
kept arguing against it, and eventually said he confused it (it being the
defualt command-line debugger front-end) with the debugger's guts, and ended
up also supporting adding "use strict;".
</p>

<p>
I ended up working on adding "strict" to the debugger on a git branch, and
was eventually successful (though I temporarily broken no-strict code on the
debugger evaluated lines, to which I added a test.). RJBS (the current
pumpking) said he'd like to integrate this patch only after perl-5.16.x
is released.
</p>

<p>
The morals of this story is that the perl debugger needs more tests, and
that trying to enhance it can easily break it. I started
<a href="https://github.com/shlomif/perl/tree/perl-d-add-tests-3">a branch
on GitHub</a> where I've been committing more tests to the perl debugger
to enhance its coverage.
</p>

<p>
There's also a Google Code-In task for devising a strategy to do that, and
I've volunteered to mentor it. All this will hopefully result in less breakage
in the future.
</p>

<p>
Happy Holidays, and a Happy New Year.
</p>

</div>

<div class="entry" id="report_on_israeli_perl_workshop_2012">

<ul class="info">
<li><b>Date:</b> 27-03-2012</li>
<li class="tags">perl, workshop, israel, events, 2012</li>
</ul>

<h1>Report on the Israeli Perl Workshop 2012</h1>

<p>
Well, I've got a lot of stuff I’d like to blog about in the various blogs of
mine, and so I’m starting with this report on the
<a href="http://act.perl.org.il/ilpw2012/">Israeli Perl Workshop of 2012</a>,
which had taken place in 28 February, 2012. Moreover, April Fools' Day is
approaching, and I had an idea for a Perl-related April Fools' gag, but after
telling it to RJBS (the current Perl pumpking), he and I agreed that it would
hit too many nerves. (PerlJam on IRC said he liked it, though). Maybe I’ll
publish it on 2 April with a big disclaimer on top, just for kicks.
</p>

<p>
Anyway, here is the report. I had originally posted it to the Perl in Israel
mailing list for review, but did not get any reviews, so it may not be too
letter-perfect, but I guess that’s life.
</p>

<p>This is my report about the
<a href="http://act.perl.org.il/ilpw2012/">Israeli Perl Workshop of 2012</a> . It was
a fun and educational event, and I'm glad I was able to attend it. For better
or for worse, all the talks I attended were in Room 1, but I was still able
to hear the ends of a few talks in Room 2 (because the corresponding talks
in Room 1 ended before them).</p>
<p>I set up an alarm the night before in order to wake up early in time for the
event, and ended up waking up some time before it (and even the alarm time was
much earlier than what I was used to). Then I made some preparations, ate
breakfast, and caught the appropriate bus. After I walked from the bus station
to Shenkar, it took me some time to find the place, because it wasn't the
same entrance as our normal rooms, and the signs were confusing. What I needed
to do was to take the stairs down to the yard, and then go to the organisation
room, but it was hard to find.</p>
<p>There I got my name sticker, the schedule, and some swag from booking.com. I’d
like to thank <a href="http://www.booking.com/">Booking.com</a> for sponsoring the Israeli
Perl Workshop 2012 (as well as having a presence there and giving some swag
and chocolates), and they are looking for software developers with Perl
experience to relocate to Amsterdam, so please consider working for them.</p>
<p>In the yard, I met a few people including
<a href="http://search.cpan.org/~flora/">Florian Ragwitz</a> (a.k.a &quot;FLORA&quot; on CPAN or
&quot;rafl&quot; on IRC - he has many cool modules there, including quite a few XS ones),
who was one of the workshop’s visitors from Germany. Despite being German, his
English accent sounded English to us. Later on we discussed accents in English
and he noted that the accents of some Israelis he met sounded like French to
him (while ours seemed less so). This is strange, because Israelis can
distinguish between a French accent in English and an Israeli Hebrew accent in
English. </p>
<p>Anyway, Florian told me that he is planning on reviewing and pulling my
Test::Aggregate GitHub pull request Real Soon Now™, a fact which has brought
me some relief, because I've tried to contact him on IRC and ask him if he
remembers.</p>
<p>For better or for worse, all the talks that I preferred to hear took place in
room #1 (while sometimes visiting Room #2) to hear the ends of talks. I still
would be happy to hear many of the talks that took place in Room #2 in the
normal Tel Aviv Perl Mongers meetings, or alternatively, those talks in room #1
which lacked enough time to be conveyed satisfactorily.</p>
<p>The first talk in the day was
<a href="http://search.cpan.org/~eilara/">Ran Eilam</a>’s talk about &quot;Syntactic Sugar
causes Cancer of the Semicolon”, which had to be trimmed towards the end,
because
the introduction may have taken too long. The talk was interesting starting
from an example of <code>ptr-&gt;val</code> being sugar in the C programming language
for <code>(*ptr).val</code> and continuing to further examples. Ran raised the issue
of whether syntactic sugar was important or not, which turns out to not be
a straightforward question. He then demonstrated some modules for syntactic
sugar on CPAN.</p>
<p>I hope Ran can give a rerun of it on one of the mongers' meetings with more
time allocated for that.</p>
<p>After that I attended the talk of Stefan Hornburg (“racke”, known as
<a href="http://search.cpan.org/~hornburg/">HORNBURG on CPAN</a>) who was another
visitor from Germany, about
<a href="http://act.perl.org.il/ilpw2012/talk/3955">Template::Flute</a> which is a
designer’s friendly template system. In this template, one uses an HTML file
with standard HTML attributes for designating the fields that needs to be
replaced, and then an XML specification file that specifies how to process
the HTML (and in addition one uses Perl to give it data). As a result the
designers can manipulate the HTML with their own tools, while still
allowing the programmers to populate it with data.</p>
<p>This seems like an interesting and potentially useful tool, but it’s
less expressive than template systems such as Template Toolkit. After the talk,
another attendee whom we talked in private questioned the need for both the
HTML file and the XML specification, but I didn't find a way to avoid it
given the constraints that the HTML will be valid HTML 4/XHTML 1.</p>
<p>The next talk about Time Management in Software Projects was cancelled because
the presenter did not come (due to lack of time management as we joked then).
I was able to catch a glimpse of the end of
<a href="http://corky.net/dotan/">Dotan Dimet</a>’s “Perl and JavaScript:
bioinformatics in a browser window” talk, but I don’t remember a lot of
it except for a small amount of demonstration.</p>
<p>The talk about Zero to CPAN was eventually given by
<a href="http://blogs.perl.org/users/sawyer_x/">Sawyer</a> instead of by
<a href="http://blogs.perl.org/users/erez_schatz/">Erez Schatz</a>. It was a nice one, and I’ve learned about
<a href="http://metacpan.org/release/CPAN-Changes">the CPAN-Changes module</a> there
(after Florian mentioned it, though). Sawyer covered the way to get to a
working CPAN-like distribution from scratch using tools such as
module-starter and explained what every file in the CPAN module hierarchy
does, and demonstrated some test-driven-development. I knew most of it already,
but it was still a fun talk.</p>
<p><a href="http://www.linkedin.com/in/amirfr">Amir Friedman</a>‘s talk about software
configuration management (SCM) came next,
and he discussed some open-source solutions for the various parts of SCM,
which include version control, release management, task management, and
project management. He recommended Gitflow (which we had a talk about
on the Tel Aviv mongers mailing list) for version control and release
management, and a different solution called Jenkins for issue tracking (if
I remember correctly). I then asked what he thought of integrated “all-in-one”
solutions for SCM, and he said that those were pricey and he did not have
any significant experience with them.</p>
<p>The lunch break came next and I overheard a talk between two other people
about teaching English to speakers of non-English languages. One of them
said that he once worked with some Spanish Electrical Engineers and that they
were “completely isolated” from the rest of the world because they didn’t
read the literature in English. Then we discussed whether it was economical
to teach English to hundreds of millions of speakers of Spanish, or whether
we should expect most things to be translated. It was compared to the
“give a man a fish” vs. “teach a man to fish”. We also discussed the fact that
Dutchmen tended to have very good English, and one of the other people
commented that it was true, but that they still tended to prefer using
software with Dutch localisation.</p>
<p>I’ve also talked with Sawyer about his upcoming
<a href="http://act.perl.org.il/ilpw2012/talk/3936">“CGI.pm MUST DIE!” talk</a>. He
said that he needs to become mentally energised for that talk because he
feels strongly about it and wants to convey the energy. He passed an
anecdote from a conference in Europe, in which he had given a talk about
Dancer, and said he was so emotional then that people said “You must
see him” and rushed to see his other talk. Moreover, afterwards, when asked
who were the two best presenters in the conference, they said “[Someone
very famous] and that Dancer guy”.</p>
<p>The anti-CGI.pm presenting was indeed energetic and emotional, but kinda fell
below my expectations due to the yard talk that preceded it. It was still
pretty informative. Dotan Dimet later took the stage for the rebuttal
of “CGI.pm - the only web development framework you’ll ever need” which was
less emotional but still interesting. I was not convinced that CGI.pm’s
HTML generation routines were a good way to do output HTML (I never really
liked them), so I may have been more convinced by Sawyer.</p>
<p><a href="http://www.ynonperek.com/">Ynon Perek</a>’s
<a href="http://act.perl.org.il/ilpw2012/talk/3977">talk</a> about
“Implementing Perl (Moose) Design Patterns” came next, which was interesting,
but again lacked adequate time to cover everything, and I hope will be given
with less time constraints. One anecdote from there was that Ynon said there
where three primary ways for polymorphism in Perl: Inheritance (“is-a”),
Roles/Traits (“does-a”) and Containment/Delegation (“has-a”) and that
he could no longer recommend inheritance (but did not get to explain why not
from what I recall).</p>
<p>In any case, I was surprised at Ynon’s implementation of the Factory
pattern, and don’t remember the implementation given by him.</p>
<p>Next came Tamir Lousky’s
<a href="http://act.perl.org.il/ilpw2012/talk/3953">talk</a> about generating vector
graphics with Perl and SVG. Its slides contained a lot of very nice eye candy.
The introduction
to SVG and generating it was quite rudimentary, and did not cover the full
potential of SVG. The demonstration and explanation of the module for
generating random trees using SVG was interesting.</p>
<p><a href="http://act.perl.org.il/ilpw2012/talk/3959">David Tabachnikov</a>’s next gave an
interesting talk called “Scaling Up”. He
contrasted optimisation (which makes your code run faster with the existing
resources) to vertical scaling (= buying faster computers) to Horizontal
scaling (= buying more hardware). He also noted that there’s some speed
difference between the various SQL databases, but he did not encounter a
situation where it would have made too much difference.</p>
<p>The last feature of the evening were the lightning talks. I recall a talk
by Florian Ragwitz about Google Code-In and Google Summer-of-Code. I also
recall <a href="http://szabgab.com/">Gabor</a>’s talk about surviving in an uncooperative
workplace. He said
that if the workplace does not practise best practices such as using version
control systems or writing automated tests, one can create their own
small island of sanity where they make use of that on their own, and gradually
convince the rest of the organisation that it’s beneficial.</p>
<p>After the lightning talks, some people went to a local restaurant for dinner,
but I decided against it because I was too tired from waking up early. As a
result, I found someone who drove up north to drive me home, and got home.</p>
<p>In the schedule I noticed that one could go to a certain URL at
<a href="http://www.oreilly.com/">O’Reilly</a> and
receive a free E-book of their choice. I used this opportunity to get the book
<a href="http://shop.oreilly.com/product/9780596510046.do">Beautiful Code</a> , which
I have started reading.</p>
<p>The day was exhausting but very fun, and I enjoyed all the talks I attended.
I’d like to thank the organisers of the event and most notably
<a href="http://szabgab.com/">Gabor Szabo</a> and Sawyer X,
<a href="http://www.shenkar.ac.il/">Shenkar college</a> for providing the venue,
<a href="http://www.booking.com/">Booking.com</a> for the sponsorship, O’Reilly for
the free book presents, the foreign guests who came to present and to attend,
and all the other presenters, who volunteered to give talks.</p>
<p>I hope we can repeat this the next year.
</p>

</div>

<div class="entry" id="the_perl_april_fools_that_could_have_been">

<ul class="info">
<li><b>Date:</b> 09-04-2012</li>
<li class="tags">perl, april fools, joke</li>
</ul>

<h1>The Perl April Fools' Gag That Could Have Been</h1>

<p>
On my <a href="http://blogs.perl.org/users/shlomi_fish/2012/03/report-on-the-israeli-perl-workshop-2012.html">last entry</a>,
I told you that I have had an idea for a Perl-related April Fools’ day gag,
and that I would possibly reveal it on 2-April with a big disclaimer
on top, just for kicks. Well, it’s already 9-April, but I guess it is better
late than never, right?
</p>

<p>
OK, here is the big disclaimer: <b>THIS IS A JOKE. IT’S NOT SERIOUS. SO
RELAX - IT IS NOT GOING TO HAPPEN SOON (AND HOPEFULLY WILL NOT EVER
HAPPEN).</b>.
</p>

<p>
OK, now let’s move on to the gag itself:
</p>

<blockquote>
<p>
1 April 2012, Tel Aviv, Israel: the Perl foundation has announced today
that by inspiration from Mozilla Firefox, the perl-porters (formerly known
as perl5-porters) will adopt a schedule of a quarterly major release.
</p>

<p>
“Since version 6 of Perl has been claimed by a malevolent project that
amounted to very little, we will release Perl version 7 next Summer, followed
by Perl 8 in next Fall, and Perl 9 next Winter.” said the designated Perl
pumpking.The Perl foundation commented that it is sure that users will
appreciate the accelerated release schedule, despite the fact that a lot
of backwards’ compatibility will be broken in each release to further
the language’s improvement.
</p>

<p>
Some prominent Perl porters have added that they are looking into ways
to automatically upgrade the Perl version automatically upon new
releases, similar to the approach followed by the Google Chrome browser.
“We are tired of people using outdated versions of Perl, which results in
a maintenance burden for us, to say nothing of the security risk by bugs in
old Perl versions. So we think the best way to mitigate that would be to
simply force people to upgrade.”
</p>

<p>
The Perl porters are hard at work on perl-7.0.0, which will implement the
upcoming Perl 7 specification with many new and exciting features and
incompatibilities.
</p>

</blockquote>

<p>
Well, like I said, after discussing this idea with
<a href="http://rjbs.manxome.org/">RJBS</a> (the current Perl 5 Pumpking),
he and I agreed that it would be too cruel, given that many people
are sensitive about upgrading their versions of Perl 5. Comparisons of how
old the perl that your workplace/client/etc. has deployed on their systems
is a common source of discussion among perl mongers (and someone told me
one of his clients still used perl 4), and many people would have found
such an announcement alarming instead of funny. But I hope you enjoyed reading
it, and hope you're also looking forward to perl-5.16.0, which should be out
soon.
</p>

</div>

<div class="entry" id="perl_begin_news_9_July_2002">

<ul class="info">
<li><b>Date:</b> 09-07-2012</li>
<li class="tags">perl, begin, beginners, perl-begin, learn</li>
</ul>

<h1>What’s new on the Perl Beginners’s Site</h1>

<p>
The last update on the news feed for
<a href="http://perl-begin.org/">The Perl Beginners’s site</a> was almost a
year ago. While the site continued to improve, I neglected writing a new
entry until now, so I hope this one will compensate for that.
</p>

<p>
So without further ado, here is what is new:
</p>

<ol>

<li>
<p>
We now have a page about <a href="http://perl-begin.org/humour/">Perl
Humour</a>, which was restored from a page in the now offline perl.net.au
wiki.
</p>
</li>

<li>
<p>
Also originally from that wiki is the <a
href="http://perl-begin.org/FAQs/freenode-perl/">Freenode’s #perl channel
Frequently Asked Questions (FAQ) List</a>, which is well worth a read.
</p>
</li>

<li>
<p>
Another restored page is
<a href="http://perl-begin.org/topics/cpan/wrappers-for-distributions/">the
list of CPAN Wrappers for Distributions</a>.
</p>
</li>

<li>
<p>
We added <a href="http://perl-begin.org/uses/web-automation/">a page</a>
about web automation in Perl, and <a
href="http://perl-begin.org/topics/files-and-directories/">one about
manipulating files and directories</a>.
</p>
</li>

<li>
<p>
The
<a href="http://perl-begin.org/platforms/windows/">Perl on Windows page</a>
was enhanced with new links to Strawberry Perl and DWIM Perl.
</p>
</li>


<li>
<p>
We have a new page about
<a href="http://perl-begin.org/training/">Perl Training Providers</a>, which
currently only contains a link to <a href="http://perltraining.org/">the Perl
Training Directory</a>.
</p>
</li>

<li>
<p>
<a href="http://perl-begin.org/tutorials/bad-elements/">The “Perl
Elements to Avoid” page</a> contains many new entries.
</p>
</li>

<li>
<p>
<a href="http://perl-begin.org/tutorials/modern-perl/">Our mirror of
the book <i>Modern Perl</i> by chromatic</a> was updated to its latest
edition.
</p>
</li>
</ol>

<p>
We hope you find these additions useful or enlightening.
</p>

</div>

<div class="entry" id="App_Notifier_cpan_distributions">

<ul class="info">
<li><b>Date:</b> 22-07-2012</li>
<li class="tags">perl, cpan, dancer</li>
</ul>

<h1>Announcement: the App-Notifier CPAN Distributions</h1>

<p>
I would like to announce two new CPAN distributions of mine:
<a href="https://metacpan.org/release/App-Notifier-Service">App-Notifier-Service</a>
and
<a href="https://metacpan.org/release/App-Notifier-Client">App-Notifier-Client</a>.
These are derived from a few simplistic scripts I've written in shell and
Perl, to allow me to notify when a task has finished (e.g:
<tt>make ; finish-client</tt>) or a certain time has elapsed (e.g:
<tt>sleep 240 ; finish-client</tt>), and I decided to create something
more serious as CPAN modules.
</p>

<p>
App-Notifier-Service implements an HTTP service (using Dancer), which
listens for requests, and once one arrives, implements a callback, which
notifies the user on the localhost that the event occured. App-Notifier-Client
complements it by implementing a client that connects to the service
and sends the event.
</p>

<p>
Currently documentation may be lacking, and there are almost no automated
tests in the distributions, but it appears to work nicely. To get started,
read the documentation and you may wish to peruse some of these files
from my home directory. First of all, the <tt>.app_notifier.yml</tt> file:
</p>

<pre>
commands:
    default:
        - /home/shlomif/bin/desktop-finish-cue
    cookie:
        - /home/shlomif/bin/desktop-finish-cue
        - "--song"
        - "/home/music/Music/dosd-mp3s/Cookie.mp3"
client:
    targets:
        default:
            url: "http://localhost:6300/"
        lap:
            url: "http://lap.shlomifish.org:6300/"

</pre>

<p>
The <tt>desktop-finish-cue</tt> file:
</p>

<pre>
#!/bin/bash

song="/home/music/Music/dosd-mp3s/Theme - Eurovision.mp2"

param="$1"
shift
if test "$param" = "--song"; then
    arg="$1"
    shift
    song="$arg"
fi

xmessage "Your task has been finished! Go check it out." &amp;
mplayer "$song"
</pre>

<p>
And the <tt>finish-server</tt> script:
</p>

<pre>
#!/bin/bash
cd "$HOME"/progs/perl/alert/http-based/hg/App-Notifier-Service &amp;&amp;
    perl ./bin/app.pl --port=6300
</pre>

<hr />

<p>
Otherwise, if you're in the Tel Aviv or vicinity, you are invited to
<a href="http://mail.perl.org.il/pipermail/perl/2012-July/012671.html">the
next Tel Aviv Perl Mongers meeting on Wednesday, 25 July 2012</a>. Otherwise,
I wish to note that I have written my first Java golf program as part
of <a href="http://golf.shinh.org/p.rb?Alphabet+texture+">Anarchy golf’s
“Alphabet Texture” challenge</a> (Anarchy golf accepts challenges in many
languages). At 167 bytes, it is over 3 times longer than the shortest Perl
entry which is only 50 bytes (my Perl solution is 52 bytes). But it
was fun to write. For your information,
<a href="http://en.wikipedia.org/wiki/Code_golf">code golf</a> is a challenge
in which, participating programmers are challenged to write the shortest
program that achieves a certain objective. I find it fun and addictive.
</p>

</div>

<div class="entry" id="tech_tip_packaging_cpan_distributions_in_mageia">

<ul class="info">
<li><b>Date:</b> 16-08-2012</li>
<li class="tags">perl, cpan, tip, tech, tech tip, mageia, linux</li>
</ul>

<h1>Tech Tip: How to Package and Maintain CPAN Distributions in Mageia</h1>

<p>
<a href="http://www.mageia.org/">Mageia Linux</a> is an RPM-based
Linux distribution, whose repositories contain
<a href="http://jquelin.blogspot.co.il/2012/07/more-than-3000-perl-packages-in-mageia.html">over
3,000 CPAN packages</a>, and part of the reason why it has so many is
because Jerome Quelin and the other maintainers have worked on tools to
facilitate creating Mageia packages for CPAN distributions and maintaining
them.
</p>

<p>
However, I was a little confused about using
<a href="https://metacpan.org/release/App-Magpie">magpie</a>, so I'd like
to share my findings here:
</p>

<ol>

<li>
<p>
In order to import, upload and submit a new CPAN package into Mageia,
along with all of its dependencies, one should not use magpie, but rather
<a href="https://metacpan.org/release/App-CPAN2Pkg">cpan2pkg</a>. Its use
is very simple: make <tt>rpm</tt> and <tt>urpmi</tt> sudoable, and type
<tt>cpan2pkg Package::Name</tt> from the command-line inside an X terminal.
This will start a Tk window where one can monitor the progress of preparing
new RPM packages and it has an entry box to create more packages (which
saves time on re-initialising CPAN.pm or CPANPLUS.pm).
</p>
</li>

<li>
<p>
In order to upgrade a package, one can type
<tt>eval $( magpie co -s perl-[PACKAGE_NAME] )</tt> and then
<tt>magpie update</tt>. magpie requires <a href="https://metacpan.org/release/CPAN-Mini">minicpan</a> to be installed and updated.
</p>
</li>

<li>
<p>
In order to install packages, one can do
<tt>sudo urpmi 'perl(Package::Name)'</tt>. My
<a href="https://metacpan.org/release/Module-Format">Module-Format module</a>
facilitates the translation from other notations for writing modules:
</p>

<pre>
up()
{
    sudo urpmi --auto $(perlmf as_rpm_colon "$@")
}
</pre>
</li>
</ol>

</div>

<div class="entry" id="tpf_debugger_grant_and_new_cpan_distributions">

<ul class="info">
<li><b>Date:</b> 01-09-2012</li>
<li class="tags">perl, foundation, tpf, grant, debugger, cpan, ruby</li>
</ul>

<h1>Grant for Improving the Perl Debugger + New CPAN Distributions</h1>

<p>
First of all, I am glad to announce that the Perl Foundation grant
committee has accepted my
<a href="http://news.perlfoundation.org/2012/08/2012q3-grant-proposal-adding-t.html">grant
proposal for adding tests and refactoring the built-in perl debugger</a>.
Here is <a href="http://news.perlfoundation.org/2012/08/2012q3-grant-proposals---resul.html">the announcement</a> for which grant proposals were
accepted. My grant manager for this grant is
<a href="http://alanhaggai.org/">Alan Haggai Alavi</a>, whom I've been
talking with online and have collaborated on a few projects, so I'm really
happy to work with him again.
</p>

<p>
I have already made some progress with the grant (and this post is part
of it), and sent a log for Alan Haggai to post as a grant update.
</p>

<p>
That put aside, I'd now like to publicise some of the new distributions
I have uploaded to CPAN, as I had some ideas for new ones, and am also
contemplating making enough uploads to have 100 CPAN distributions or more:
</p>

<ol>

<li>
<p>
<a href="https://metacpan.org/release/WWW-LinkChecker-Internal">WWW-LinkChecker-Internal</a>
is a distribution wrapping a script that checks for internal broken links. I
released the first three versions of it in a day, and it uses WWW::Mechanize.
The reason why I wrote it was that the WDG HTML validator reported some broken
links in one of my sites, but not their origins, so I had to trace them in
a different way, and ended up writing that.
</p>
</li>

<li>
<p>
<a href="https://metacpan.org/release/Inline-Ruby">Inline-Ruby</a> is
an Inline:: distribution I adopted that allows to embed Ruby code inside
Perl programs. I applied some fixes for it (some of which were not released
to CPAN yet and some are ugly workarounds), and am planning to maintain it
further down the road.
</p>
</li>

<li>
<p>
<a href="https://metacpan.org/release/Test-TrailingSpace">Test-TrailingSpace</a>
is a <tt>Test::</tt> namespace distribution for verifying that your code
does not contain trailing space. Death to trailing space!
</p>
</li>

</ol>

<p>
A final anecdote is that when working on one of my CPAN modules I found the
<tt>b [filename]:[line_num]</tt> feature that I implemented in the perl
debugger to be of great help, and can be content that I'm eating my own
dogfood.
</p>

<p>
Cheers for now.
</p>

</div>

<div class="entry" id="tech_tip_overriding_eumm_compiler">

<ul class="info">
<li><b>Date:</b> 09-09-2012</li>
<li class="tags">tech, tip, tech tip, perl, eumm, compiler, gcc, clang</li>
</ul>

<h1>Tech Tip: Overriding the C compiler with ExtUtils::MakeMaker</h1>

<p>
In order to override the C compiler with ExtUtils::MakeMaker, one can
do something like:
</p>

<pre>
perl Makefile.PL CC=/usr/bin/clang
</pre>

<p>
Which will make the "CC" variable in the generated makefile be set to
<tt>/usr/bin/clang</tt> instead of the default. Apparently, setting the
<tt>CC</tt> environment variable does not work like it does with CMake.
</p>

<p>
Thanks to <a href="http://www.mail-archive.com/makemaker@perl.org/msg03060.html">Sisyphus for the tip</a>.
</p>

</div>

<div class="entry" id="perl_events_should_be_placed_on_lwn.net">

<ul class="info">
<li><b>Date:</b> 18-10-2012</li>
<li class="tags">lwn, lwn.net, events, perl, conferences, yapc</li>
</ul>

<h1>Please Publish Perl Events on the LWN.net Calendar</h1>

<p>
As I read last week’s
<a href="http://lwn.net/Articles/518564/">LWN.net’s Announcement Page</a>
(LWN.net is a news site for open-source-related news, formerly standing
for “Linux Weekly News”),
I noticed that there were few if any Perl events featured in its upcoming
events calendar. However, these events appear in
<a href="http://perlweekly.com/">the Perl Weekly</a>, and there are many
upcoming Python events featured in LWN.net.
</p>

<p>
So, please, if you are organising a Perl-related event (or any other major
open-source event), make sure you put it on
<a href="http://lwn.net/Calendar/">the LWN.net calendar</a>.
</p>

</div>

</body>
</html>