I’ve been working on my RSS reader (more on that later), and I noticed a strange problem. Long articles were being cut off. Content was being abruptly stopped, as in the footer wasn’t even showing up. I did a quick check of the logs, nothing there. I checked my content, nothing suspicious, and seemed complete. A quick script confirms it’s not the libraries.

1
2
my $article = mRSS::Article->find(4447);
say $article->description.

My template engine Xslate is new to me, so I’m quick to blame that. Time to pull it out of the Dancer app.

1
2
3
4
5
6
7
8
my $tx = Text::Xslate->new( path => [ '/code/rss/views' ]);
my $article = mRSS::Article->find(4447);

my %vars = (
  article => $article,
);

print $tx->render('article.tx', \%vars),"\n";

That of coarse produced the complete article. So, the other parts of my stack that are new to me.. Dancer and Starman. I load Dancer as a standalone app, and it works too.

A quick check at the changelog for Starman, and we find the culprit.

1
2
0.4005  2013-08-13 22:12:11 PDT
        - Fix SSL implementation bug where body longer than 16K doesn't get written correctly #78 (kazeburo, siracusa) 

A quick..

1
cpanm Starman

And everything is fixed. I love the simple ones.

Being able to pull out a few lines of your project into some one off script is a great litmus test for if your building things right. Having trouble setting up that action your trying to test? Then it’s time to sit back and think about your code. Yes, sometimes it is just a matter of a complex sequence of data manipulations and you just need a set up helper functions to wrap common sequences. It also can be an indicator that your flow of data isn’t optimal, or your view on your abstractions needs a fresh look.

As a side note, is there anything that Tatsuhiko Miyagawa does that isn’t awesome? Remember when you were using cpan because cpanm wasn’t around? cpanm is such a pleasure to use. I was at his polyglot talk at YAPC::NA 2012, so I understand that he pulls ideas from all of the programming communities. It’s still an impressive track record to pull the right things, translate them, and iterate through them through more community feedback.

On that note, I’m off to look at cpanfile