<?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>Matthew Lenz &#187; Programming</title>
	<atom:link href="http://www.nocturnal.org/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nocturnal.org/blog</link>
	<description>Ignore the typos and spelling.  I do.</description>
	<lastBuildDate>Wed, 03 Feb 2010 00:21:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Finding perl packages with APT</title>
		<link>http://www.nocturnal.org/blog/2009/09/02/finding-perl-packages-with-apt/</link>
		<comments>http://www.nocturnal.org/blog/2009/09/02/finding-perl-packages-with-apt/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 16:07:12 +0000</pubDate>
		<dc:creator>Matthew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.nocturnal.org/blog/2009/09/02/finding-perl-packages-with-apt/</guid>
		<description><![CDATA[If you are attempting to satisfy dependencies for perl software that was NOT available via your favourite repository (this is sometimes unavoidable in enterprise environments) you should AT LEAST attempt to satisfy those dependencies using said repository.  The easiest solution is to install &#8216;apt-file&#8217; from your repo and for any perl modules you can [...]]]></description>
			<content:encoded><![CDATA[<p>If you are attempting to satisfy dependencies for perl software that was NOT available via your favourite repository (this is sometimes unavoidable in enterprise environments) you should AT LEAST attempt to satisfy those dependencies using said repository.  The easiest solution is to install &#8216;apt-file&#8217; from your repo and for any perl modules you can simply call:</p>
<pre>apt-file search "LWP::UserAgent"</pre>
<p>This will return the following list on Debian Lenny:</p>
<pre>liblwp-useragent-determined-perl: /usr/share/man/man3/LWP::UserAgent::Determined.3pm.gz
libtest-mock-lwp-perl: /usr/share/man/man3/Test::Mock::LWP::UserAgent.3pm.gz
libwww-perl: /usr/share/man/man3/LWP::UserAgent.3pm.gz</pre>
<p>Now you know that in order to satisfy a dependency on &#8220;LWP::UserAgent&#8221; you would need to install the &#8216;libwww-perl&#8217; module from the repo.</p>
<p>If the module is not available via the repo you should next consider installing the package into a custom perl lib directory specifically for the software (and/or user account) in question.  To do this read the documentation for the <a href="http://search.cpan.org/search?query=local%3A%3Alib&amp;mode=dist">local::lib module in CPAN</a>.</p>
<p>Ultimately your goal should be to not install non-packaged software to /usr/local and by doing so increase the maintainability of your systems.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.nocturnal.org%2Fblog%2F2009%2F09%2F02%2Ffinding-perl-packages-with-apt%2F&amp;linkname=Finding%20perl%20packages%20with%20APT">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.nocturnal.org/blog/2009/09/02/finding-perl-packages-with-apt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>perl MIME::Lite sendmail Return-Path fix/override</title>
		<link>http://www.nocturnal.org/blog/2009/08/12/perl-mimelite-sendmail-return-path-fixoverride/</link>
		<comments>http://www.nocturnal.org/blog/2009/08/12/perl-mimelite-sendmail-return-path-fixoverride/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 00:20:36 +0000</pubDate>
		<dc:creator>Matthew</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.nocturnal.org/blog/?p=153</guid>
		<description><![CDATA[I&#8217;m not sure this affects the newest version of MIME::Lite; however, if you find that you are having issues with your messages being rejected or marked as spam, due to an internal host being added to the Return-Path, the following fix might work for you.
Rather than using:
my $ml = MIME::Lite-new(
    From =&#62; ...
   [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure this affects the newest version of MIME::Lite; however, if you find that you are having issues with your messages being rejected or marked as spam, due to an internal host being added to the Return-Path, the following fix might work for you.</p>
<p>Rather than using:</p>
<pre style="padding-left: 30px;">my $ml = MIME::Lite-new(
    From =&gt; ...
    To =&gt; ...
    ...
);

$ml-&gt;send();</pre>
<p>Use the following:</p>
<pre style="padding-left: 30px;">$ml-&gt;send_by_sendmail(SetSender =&gt; 1);</pre>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.nocturnal.org%2Fblog%2F2009%2F08%2F12%2Fperl-mimelite-sendmail-return-path-fixoverride%2F&amp;linkname=perl%20MIME%3A%3ALite%20sendmail%20Return-Path%20fix%2Foverride">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.nocturnal.org/blog/2009/08/12/perl-mimelite-sendmail-return-path-fixoverride/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Find page count in TIFF or PDF with perl</title>
		<link>http://www.nocturnal.org/blog/2009/08/06/find-page-count-in-tiff-or-pdf-with-perl/</link>
		<comments>http://www.nocturnal.org/blog/2009/08/06/find-page-count-in-tiff-or-pdf-with-perl/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 13:52:44 +0000</pubDate>
		<dc:creator>Matthew</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.nocturnal.org/blog/?p=140</guid>
		<description><![CDATA[The perl module you&#8217;ll want to install is called PerlMagick (Image::Magick) and rather than loading the image into memory you can just use the Ping method.  The Ping method returns an array with 4 elements of information for each page of a multi-page TIFF/PDF.  If we divide the number of elements by 4 [...]]]></description>
			<content:encoded><![CDATA[<p>The perl module you&#8217;ll want to install is called PerlMagick (Image::Magick) and rather than loading the image into memory you can just use the Ping method.  The Ping method returns an array with 4 elements of information for each page of a multi-page TIFF/PDF.  If we divide the number of elements by 4 we know how many pages there are in the TIFF/PDF.</p>
<pre style="padding-left: 30px;"><span style="color: #ff9900;">use Image::Magick;

my $im = Image::Magick-&gt;new();</span><span style="color: #ff9900;">

my @ping_info = $im-&gt;Ping('fax.tif');

## If we access an @rray in a scalar context we get the element count
my $count = @ping_info / 4;

print $count;</span></pre>
<p>There you have it, good luck.</p>
<p>UPDATE:</p>
<p>The example above may or may not work properly with PDF&#8217;s.  Even if it does work it appears that ImageMagick makes an external call to the ghostscript (gs) executable on the system to determine the properties of the pdf.  Here is an example that will work for PDFs:</p>
<pre style="padding-left: 30px;"><span style="color: #ff9900;">use PDF::API2;

my $pdf = PDF::API2-&gt;open('2.pdf');
print $pdf-&gt;pages();</span></pre>
<p>I&#8217;m guessing that eventually ImageMagick won&#8217;t be &#8220;broken&#8221; but you can use the above in the meantime.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.nocturnal.org%2Fblog%2F2009%2F08%2F06%2Ffind-page-count-in-tiff-or-pdf-with-perl%2F&amp;linkname=Find%20page%20count%20in%20TIFF%20or%20PDF%20with%20perl">Share/Save</a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.nocturnal.org/blog/2009/08/06/find-page-count-in-tiff-or-pdf-with-perl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
