<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rohan&#039;s Blog</title>
	<atom:link href="http://rohan.almeida.in/feed/" rel="self" type="application/rss+xml" />
	<link>http://rohan.almeida.in</link>
	<description>Web Developer. Linux Geek. Practicing Guitarist.</description>
	<lastBuildDate>Thu, 13 Oct 2011 07:54:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Cemetery Gates solo cover</title>
		<link>http://rohan.almeida.in/2011/10/12/cemetery-gates-solo-cover/</link>
		<comments>http://rohan.almeida.in/2011/10/12/cemetery-gates-solo-cover/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 14:39:16 +0000</pubDate>
		<dc:creator>rohan</dc:creator>
				<category><![CDATA[Guitar]]></category>
		<category><![CDATA[guitar pantera solo cemetery gates]]></category>

		<guid isPermaLink="false">http://rohan.almeida.in/?p=22</guid>
		<description><![CDATA[This is a great song by Pantera. I decided to learn the solo played by Dimebag Darell around 2 months back. Its not that difficult to play but the stretching lick and the legato run near the end required some &#8230; <a href="http://rohan.almeida.in/2011/10/12/cemetery-gates-solo-cover/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>
This is a great song by <strong>Pantera</strong>. I decided to learn the solo played by <strong>Dimebag Darell</strong> around 2 months back. Its not that difficult to play but the stretching lick and the legato run near the end required some amount of practice.
</p>
<p><iframe width="420" height="315" src="http://www.youtube.com/embed/s8FL056QvxI" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://rohan.almeida.in/2011/10/12/cemetery-gates-solo-cover/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl one liner to display module version info</title>
		<link>http://rohan.almeida.in/2011/10/09/perl-one-liner-to-display-module-version-info/</link>
		<comments>http://rohan.almeida.in/2011/10/09/perl-one-liner-to-display-module-version-info/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 10:56:58 +0000</pubDate>
		<dc:creator>rohan</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://rohan.almeida.in/?p=6</guid>
		<description><![CDATA[I use this Perl one-liner to display the version number of a module. This module should be available in your @INC paths. If I need to know the version of CGI.pm $ perl -MCGI -e &#8216;print &#8220;$CGI::VERSION\n&#8221;&#8216; 3.29 I created &#8230; <a href="http://rohan.almeida.in/2011/10/09/perl-one-liner-to-display-module-version-info/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I use this Perl one-liner to display the version number of a module. This module should be available in your @INC paths.</p>
<p>If I need to know the version of CGI.pm</p>
<blockquote><p>
$ perl -MCGI -e &#8216;print &#8220;$CGI::VERSION\n&#8221;&#8216;<br />
3.29
</p></blockquote>
<p>I created a shell script so that I can just type the module name.</p>
<blockquote><p>
$ cat pm_version.sh<br />
#!/bin/sh<br />
MODULE=$1<br />
perl -M$MODULE -e &#8216;print &#8220;$&#8217;$MODULE&#8217;::VERSION\n&#8221;&#8216;
</p></blockquote>
<p>So now, I can do this.</p>
<blockquote><p>
$ pm_version.sh Google::Adwords<br />
v1.13
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://rohan.almeida.in/2011/10/09/perl-one-liner-to-display-module-version-info/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Test::Deep to test list of objects</title>
		<link>http://rohan.almeida.in/2011/05/10/using-testdeep-to-test-list-of-objects/</link>
		<comments>http://rohan.almeida.in/2011/05/10/using-testdeep-to-test-list-of-objects/#comments</comments>
		<pubDate>Tue, 10 May 2011 08:32:22 +0000</pubDate>
		<dc:creator>rohan</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://rohan.almeida.in/?p=13</guid>
		<description><![CDATA[What would you do if you wanted to test (using Test::More) whether a certain method call returns a list of objects? Maybe use a while loop and test each element with an isa_ok($_ , &#8216;Object&#8217;) But that would just increase &#8230; <a href="http://rohan.almeida.in/2011/05/10/using-testdeep-to-test-list-of-objects/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>What would you do if you wanted to test (using <a href="http://search.cpan.org/search?m=module&#038;q=Test::More" target="_new">Test::More</a>) whether a certain method call returns a list of objects?</p>
<p>Maybe use a while loop and test each element with an <b>isa_ok($_ , &#8216;Object&#8217;)</b></p>
<p>But that would just increase the number of tests and if the method call returns an unknown number of objects then you won&#8217;t know in advance how many tests are to be run.</p>
<p>Another option is to cycle through the list and check each element using a <b>if (ref($_) eq &#8220;Object&#8221;)</b> and use a count variable to keep track of the number of objects. At the end of the loop, you can check the count variable against the number of elements in the list and accordingly set up a <b>ok()</b> test.</p>
<p>Too messy for me.</p>
<p>And that&#8217;s where the <a href="http://search.cpan.org/search?m=module&#038;q=Test::Deep" target="_new">Test::Deep</a> CPAN module can really help you out</p>
<p>Check this sample code:<br/></p>
<blockquote><p>
use Test::More tests => 1;<br />
use Test::Deep;</p>
<p>my @items = $feed->get_items;<br />
cmp_deeply(\@items, array_each(isa(&#8220;Item&#8221;)), &#8220;get_items&#8221;);
</p></blockquote>
<p>Great!</p>
]]></content:encoded>
			<wfw:commentRss>http://rohan.almeida.in/2011/05/10/using-testdeep-to-test-list-of-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SOAP WSDL binding type</title>
		<link>http://rohan.almeida.in/2011/03/11/soap-wsdl-binding-type/</link>
		<comments>http://rohan.almeida.in/2011/03/11/soap-wsdl-binding-type/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 08:16:04 +0000</pubDate>
		<dc:creator>rohan</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[soap]]></category>
		<category><![CDATA[wsdl]]></category>

		<guid isPermaLink="false">http://rohan.almeida.in/?p=18</guid>
		<description><![CDATA[I recently came across a stumbling block while writing a WSDL for a Web Service. Many of the WSDL validators I tried were raising a validation error while parsing the WSDL. Well, I learnt something new. The issue was that &#8230; <a href="http://rohan.almeida.in/2011/03/11/soap-wsdl-binding-type/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently came across a stumbling block while writing a WSDL for a Web Service. Many of the WSDL validators I tried were raising a validation error while parsing the WSDL.</p>
<p>Well, I learnt something new. The issue was that the WSDL had attributes defined for the XML. i.e. the XML resulting from the WSDL was making use of attributes.</p>
<p>The SOAP binding in the WSDL gives us a way to specify how the web service is bound to a messaging  protocol, in particular the SOAP protocol for this case. This binding can be utilized in two ways: <b>encoded</b> or <b>literal</b>.</p>
<p>Here&#8217;s the catch. In case you use a binding of <b>encoded</b>, then its not possible to use attributes in your XML. Thats because each element of your XML would then have an attribute defined automatically (<i>type</i>), which tells you about the type of the element. For example: <b>&lt;x type=&#8221;xsd:int&#8221;&gt;5&lt;/x&gt; </b> It would not be considered safe to put your own attributes for the x element, for the simple reason being, what if element x has an attribute named &#8220;type&#8221; defined in your WSDL? Thus most WSDL validators will either flag the WSDL as invalid or just plain refuse to include attributes in your XML.</p>
<p>The way to get around this in case you&#8217;re adamant on using attributes for your XML, is to use a SOAP binding of &#8220;literal&#8221;. Doing this, does not include the element type information in the XML, and you can then use attributes for your elments. Example XML: <b>&lt;x width=&#8221;6&#8243;&gt;5&lt;/x&gt;</b></p>
<p><a href="http://www-128.ibm.com/developerworks/library/ws-whichwsdl/">This article</a> provides a nice comparion about the different WSDL styles one can use.</p>
]]></content:encoded>
			<wfw:commentRss>http://rohan.almeida.in/2011/03/11/soap-wsdl-binding-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finance::Bank::HDFC and Template::Extract</title>
		<link>http://rohan.almeida.in/2011/01/13/financebankhdfc-and-templateextract/</link>
		<comments>http://rohan.almeida.in/2011/01/13/financebankhdfc-and-templateextract/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 07:48:01 +0000</pubDate>
		<dc:creator>rohan</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://rohan.almeida.in/?p=30</guid>
		<description><![CDATA[I released Finance::Bank::HDFC version 0.14 recently. The latest release has the all important get_mini_statement() method implemented. Yes! Check your mini account statement (last 20 transactions) from the command line! The Template::Extract module from CPAN was extremely helpful here. The account &#8230; <a href="http://rohan.almeida.in/2011/01/13/financebankhdfc-and-templateextract/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I released <a href="http://search.cpan.org/perldoc?Finance::Bank::HDFC">Finance::Bank::HDFC</a> version 0.14 recently. The latest release has the all important <b>get_mini_statement()</b> method implemented. Yes! Check your mini account statement (last 20 transactions) from the command line!</p>
<p>The <a href="http://search.cpan.org/perldoc?Template::Extract">Template::Extract</a> module from CPAN was extremely helpful here. The account statements were available as JavaScript code in the source HTML file. </p>
<p><code><br />
	dattxn[l_count] = '10 Apr 2008';<br />
	txndesc[l_count] = "Description blah blah";<br />
	refchqnbr[l_count] = '000003009168';<br />
	datvalue[l_count] = '11 Apr 2008';<br />
	amttxn[l_count] = '0.01';<br />
	balaftertxn[l_count] = '999999.99';<br />
	coddrcr[l_count] = 'D';<br />
	l_count ++;</p>
<p>	dattxn[l_count] = '01 Apr 2008';<br />
	txndesc[l_count] = "A millionaire?";<br />
	refchqnbr[l_count] = '037103902179';<br />
	datvalue[l_count] = '01 Apr 2008';<br />
	amttxn[l_count] = '1000000.00';<br />
	balaftertxn[l_count] = '1000000.00';<br />
	coddrcr[l_count] = 'C';<br />
	l_count ++;<br />
</code></p>
<p>
Looks just like a template right? Correct. Enter <a href="http://search.cpan.org/perldoc?Template::Extract">Template::Extract</a>.
</p>
<p><code><br />
Template::Extract - Use TT2 syntax to extract data from documents<br />
</code></p>
<p>
This is the template code I used
</p>
<p><code></p>
<p># template for extracting mini statements</p>
<p>Readonly my $TEMPLATE_MINI_STATEMENT =&gt; &lt;&lt;'EOF';</p>
<p>[% FOREACH record %]<br />
    [% ... %]dattxn[l_count] = '[% date_transaction %]';<br />
    [% ... %]txndesc[l_count] = "[% description %]";<br />
    [% ... %]refchqnbr[l_count] = '[% ref_chq_num %]';<br />
    [% ... %]datvalue[l_count] = '[% date_value %]';<br />
    [% ... %]amttxn[l_count] = '[% amount %]';<br />
    [% ... %]balaftertxn[l_count] = '[% balance %]';<br />
    [% ... %]coddrcr[l_count] = '[% type %]';<br />
[% END %]</p>
<p>EOF</p>
<p></code></p>
<p>
After using the extract() method:
</p>
<p><code></p>
<p>my $template = Template::Extract-&gt;new;</p>
<p>my $ref = $template-&gt;extract($TEMPLATE_MINI_STATEMENT, $response-&gt;content);</p>
<p></code></p>
<p>This is the resulting arrayref. Use it the way you want.</p>
<p><code></p>
<p>$ref = [<br />
          {<br />
            'amount' =&gt; '0.01',<br />
            'balance' =&gt; '999999.99',<br />
            'ref_chq_num' =&gt; '000003009168',<br />
            'date_transaction' =&gt; '10 Apr 2008',<br />
            'type' =&gt; 'D',<br />
            'date_value' =&gt; '11 Apr 2008',<br />
            'description' =&gt; 'Description blah blah'<br />
          },<br />
          {<br />
            'amount' =&gt; '1000000.00',<br />
            'balance' =&gt; '1000000.00',<br />
            'ref_chq_num' =&gt; '037103902179',<br />
            'date_transaction' =&gt; '01 Apr 2008',<br />
            'type' =&gt; 'C',<br />
            'date_value' =&gt; '01 Apr 2008',<br />
            'description' =&gt; 'A millionaire?'<br />
          }<br />
        ];<br />
</code></p>
<p>For example:</p>
<p><code></p>
<p>foreach my $stmt_ref (@$ref) {<br />
      print  "Amount: " . $stmt_ref-&gt;{amount} . "\n";<br />
      print  "Balance: " . $stmt_ref-&gt;{balance} . "\n";<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://rohan.almeida.in/2011/01/13/financebankhdfc-and-templateextract/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

