<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: using the sphincter-sigil to abuse Perl</title>
	<atom:link href="http://lispy.wordpress.com/2008/09/23/using-the-sphincter-sigil-to-abuse-perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://lispy.wordpress.com/2008/09/23/using-the-sphincter-sigil-to-abuse-perl/</link>
	<description>(notes from an average programmer studying the hard stuff)</description>
	<lastBuildDate>Thu, 21 May 2009 01:17:58 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: draegtun</title>
		<link>http://lispy.wordpress.com/2008/09/23/using-the-sphincter-sigil-to-abuse-perl/#comment-2235</link>
		<dc:creator>draegtun</dc:creator>
		<pubDate>Wed, 24 Sep 2008 12:29:22 +0000</pubDate>
		<guid isPermaLink="false">http://lispy.wordpress.com/?p=286#comment-2235</guid>
		<description>Re: eval

There&#039;s probably a good reason why eval is only one letter away from evil ;-)    But used wisely it can be very powerful.

However be wary of the differences between string &amp; block &lt;a href=&quot;http://perldoc.perl.org/functions/eval.html&quot; rel=&quot;nofollow&quot;&gt;evals&lt;/a&gt;.

If you can do it in an eval block then do so because this catches compile time errors and is faster because doesn&#039;t need recompiling each time its run unlike a string eval.

Of course in your first example you can do it without eval by just passing a subroutine coderef.....
[sourcecode language=&#039;ruby&#039;]
sub loadme {
  my ($name, $code) = @_;
  no strict &#039;refs&#039;;
  *$name = $code;
}

loadme(&quot;noway&quot;, sub { print &quot;yadda yadda yadda\n&quot; } );
noway();
[/sourcecode]

For your other examples and what your really after in previous blog you may find something useful on CPAN.  Have a look at &lt;a href=&quot;http://search.cpan.org/dist/Parse-RecDescent/lib/Parse/RecDescent.pm&quot; rel=&quot;nofollow&quot;&gt;Parse::RecDescent&lt;/a&gt;.

/I3az/</description>
		<content:encoded><![CDATA[<p>Re: eval</p>
<p>There&#8217;s probably a good reason why eval is only one letter away from evil <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />     But used wisely it can be very powerful.</p>
<p>However be wary of the differences between string &amp; block <a href="http://perldoc.perl.org/functions/eval.html" rel="nofollow">evals</a>.</p>
<p>If you can do it in an eval block then do so because this catches compile time errors and is faster because doesn&#8217;t need recompiling each time its run unlike a string eval.</p>
<p>Of course in your first example you can do it without eval by just passing a subroutine coderef&#8230;..</p>
<pre class="brush: ruby;">
sub loadme {
  my ($name, $code) = @_;
  no strict 'refs';
  *$name = $code;
}

loadme("noway", sub { print "yadda yadda yadda\n" } );
noway();
</pre>
<p>For your other examples and what your really after in previous blog you may find something useful on CPAN.  Have a look at <a href="http://search.cpan.org/dist/Parse-RecDescent/lib/Parse/RecDescent.pm" rel="nofollow">Parse::RecDescent</a>.</p>
<p>/I3az/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: draegtun</title>
		<link>http://lispy.wordpress.com/2008/09/23/using-the-sphincter-sigil-to-abuse-perl/#comment-2234</link>
		<dc:creator>draegtun</dc:creator>
		<pubDate>Wed, 24 Sep 2008 11:34:38 +0000</pubDate>
		<guid isPermaLink="false">http://lispy.wordpress.com/?p=286#comment-2234</guid>
		<description>Nice title Lispy!  The name your looking for is Typeglobs but sphincter-sigil might actually be an improvement ;-)

Your description of Typeglobs is correct.  Simon Cozens in his book &quot;Advanced Perl Programming&quot; has a very good section on it.   His code below helps explain typeglobs succinctly.....

[sourcecode language=&#039;ruby&#039;]
*a = \&quot;Hello&quot;;
*a = [ 1, 2, 3 ];
*a = { red =&gt; &#039;rouge&#039;, blue =&gt; &#039;bleu&#039; };

print $a;          # Hello
print $a[1];       # 2
print $a{&#039;red&#039;};   # rouge
[/sourcecode]


Simon also goes to show how you can alias variables together using typeglobs....

[sourcecode language=&#039;ruby&#039;]
@b = (1,2,3,4);
*a = \@b;
push @b, 5;
print @a;  # 12345

# however
$a = &quot;Bye&quot;;
$b = &quot;Hello there!&quot;;
print $a;   # Bye
[/sourcecode]

You need to understand about the Symbol Table to explain why first bit works and second bit doesn&#039;t in the above example.  Simon&#039;s book or &quot;Mastering Perl&quot; by brian d foy are both excellent resources on this.  brian&#039;s book (or versions of) are available online at his website.  Here&#039;s the chapter on &lt;a href=&quot;http://www252.pair.com/comdog/mastering_perl/Chapters/08.symbol_tables.html&quot; rel=&quot;nofollow&quot;&gt;symbol tables and typeglobs&lt;/a&gt;

/I3az/

PS.  My perl code always does strange things!   Your right to always treat it with due caution and very wise to use/learn/adapt it a snippet at a time.</description>
		<content:encoded><![CDATA[<p>Nice title Lispy!  The name your looking for is Typeglobs but sphincter-sigil might actually be an improvement <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Your description of Typeglobs is correct.  Simon Cozens in his book &#8220;Advanced Perl Programming&#8221; has a very good section on it.   His code below helps explain typeglobs succinctly&#8230;..</p>
<pre class="brush: ruby;">
*a = \&quot;Hello&quot;;
*a = [ 1, 2, 3 ];
*a = { red =&gt; 'rouge', blue =&gt; 'bleu' };

print $a;          # Hello
print $a[1];       # 2
print $a{'red'};   # rouge
</pre>
<p>Simon also goes to show how you can alias variables together using typeglobs&#8230;.</p>
<pre class="brush: ruby;">
@b = (1,2,3,4);
*a = \@b;
push @b, 5;
print @a;  # 12345

# however
$a = "Bye";
$b = "Hello there!";
print $a;   # Bye
</pre>
<p>You need to understand about the Symbol Table to explain why first bit works and second bit doesn&#8217;t in the above example.  Simon&#8217;s book or &#8220;Mastering Perl&#8221; by brian d foy are both excellent resources on this.  brian&#8217;s book (or versions of) are available online at his website.  Here&#8217;s the chapter on <a href="http://www252.pair.com/comdog/mastering_perl/Chapters/08.symbol_tables.html" rel="nofollow">symbol tables and typeglobs</a></p>
<p>/I3az/</p>
<p>PS.  My perl code always does strange things!   Your right to always treat it with due caution and very wise to use/learn/adapt it a snippet at a time.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
