<?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>netCUBED Blog &#187; intelliperl</title>
	<atom:link href="http://blog.netcubed.de/tag/intelliperl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.netcubed.de</link>
	<description>Just another web developer's weblog</description>
	<lastBuildDate>Mon, 29 Jun 2009 20:58:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Devel::IntelliPerl released on an unsuspecting world.</title>
		<link>http://blog.netcubed.de/2009/06/develintelliperl-released-on-an-unsuspecting-world/</link>
		<comments>http://blog.netcubed.de/2009/06/develintelliperl-released-on-an-unsuspecting-world/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 14:52:29 +0000</pubDate>
		<dc:creator>Moritz Onken</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[code completion]]></category>
		<category><![CDATA[devel]]></category>
		<category><![CDATA[intelliperl]]></category>

		<guid isPermaLink="false">http://blog.netcubed.de/?p=132</guid>
		<description><![CDATA[I managed to pack my work on code completion to a distribution and released it to the CPAN. The source code is managed on github. Use it, watch it, fork it, break it, fix it, patch it &#8230; you know the game!
Watch the demo for new features (no audio).
So what is missing?
It would be great [...]]]></description>
			<content:encoded><![CDATA[<p>I managed to pack my work on code completion to a distribution and released it to the <a href="http://search.cpan.org/perldoc?Devel::IntelliPerl" target="_blank">CPAN</a>. The source code is managed on <a href="http://github.com/monken/Devel-IntelliPerl/tree/master" target="_blank">github</a>. Use it, watch it, fork it, break it, fix it, patch it &#8230; you know the game!</p>
<p>Watch the demo for new features (no audio).</p>
<span class='flash'><span id='flash-develintelliperl-released-on-an-unsuspecting-world2.41863422437E+32'></span></span>
<script type='text/javascript'>
var params = {
allowfullscreen: 'true'
};var flashvars = null
swfobject.embedSWF('http://blog.netcubed.de/wp-content/uploads/2009/06/00000005.swf', 'flash-develintelliperl-released-on-an-unsuspecting-world2.41863422437E+32', '500', '293', '9.0.0', '', flashvars, params, '');
</script>
<p>So what is missing?<br />
It would be great if code completion works for chained method calls:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># DateTime</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$dt</span> <span style="color: #339933;">=</span> DateTime<span style="color: #339933;">-&gt;</span><span style="color: #006600;">new</span><span style="color: #009900;">&#40;</span>year <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2009</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$dt</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">add</span><span style="color: #009900;">&#40;</span> months <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>_  <span style="color: #666666; font-style: italic;"># we are still a DateTime object!</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># in a DBIC environment</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$rs</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$schema</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">resultset</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'Foo'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span>_ <span style="color: #666666; font-style: italic;"># we get a MySchema::ResultSet::Foo</span></pre></div></div>

<p>What we need is a way to define the return values of methods. Moose&#8217;s type system is not much of a help because you cannot introspect what class is behind a custom type.</p>
<p>I was thinking about an IntelliPerl profile which is stored in the home directory as well as in each project. Those two are merged and define method signatures and variable types.</p>
<p>Possible syntax:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ~/.intelliperl</span>
<span style="color: #0000ff;">$schema</span> isa DBIx<span style="color: #339933;">::</span><span style="color: #006600;">Class</span><span style="color: #339933;">::</span><span style="color: #006600;">Schema</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$rs</span> isa DBIx<span style="color: #339933;">::</span><span style="color: #006600;">Class</span><span style="color: #339933;">::</span><span style="color: #006600;">ResultSet</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$dt</span> isa DateTime<span style="color: #339933;">;</span>
&nbsp;
method DBIx<span style="color: #339933;">::</span><span style="color: #006600;">Class</span><span style="color: #339933;">::</span><span style="color: #006600;">ResultSet</span><span style="color: #339933;">::</span><span style="color: #006600;">search</span> returns DBIx<span style="color: #339933;">::</span><span style="color: #006600;">Class</span><span style="color: #339933;">::</span><span style="color: #006600;">ResultSet</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># ~/workspace/MyApp/.intelliperl</span>
&nbsp;
<span style="color: #0000ff;">$schema</span> isa MyApp<span style="color: #339933;">::</span><span style="color: #006600;">Model</span><span style="color: #339933;">::</span><span style="color: #006600;">DBIC</span>
<span style="color: #0000ff;">$rs</span> isa MyApp<span style="color: #339933;">::</span><span style="color: #006600;">Schema</span><span style="color: #339933;">::</span><span style="color: #006600;">ResultSet</span></pre></div></div>

<p>A different approach would be to add the method signature to the POD:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">&nbsp;
<span style="color: #666666; font-style: italic;">=head2 mymethod
&nbsp;
=for intelliperl
method mymethod ($dt DateTime) returns DateTime</span></pre></div></div>

<p>This will make <code>$dt</code> inside mymethod a DateTime variable and the returned value is a DateTime object as well.</p>
<p>For now only <a href="http://search.cpan.org/perldoc?Devel::IntelliPerl::Editor::TextMate" target="_blank">TextMate</a> is supported. See the documentation for details.</p>
<p>I&#8217;d love to see more Devel::IntelliPerl::Editor::s!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.netcubed.de/2009/06/develintelliperl-released-on-an-unsuspecting-world/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
