<?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>gnucom.cc &#187; perl</title>
	<atom:link href="http://blog.gnucom.cc/tag/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.gnucom.cc</link>
	<description>Code snippets and more...</description>
	<lastBuildDate>Wed, 18 Jan 2012 23:50:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>List disks on linux server for nagios.</title>
		<link>http://blog.gnucom.cc/2010/list-disks-on-linux-server-for-nagios/</link>
		<comments>http://blog.gnucom.cc/2010/list-disks-on-linux-server-for-nagios/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 01:24:01 +0000</pubDate>
		<dc:creator>sholsapp</dc:creator>
				<category><![CDATA[Nagios]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[nrpe]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://blog.gnucom.cc/?p=716</guid>
		<description><![CDATA[I wrote this simple script that I named list_disks.pl to help me configure my hosts. I use it as a NRPE check to query a server for all of its available disks, and parse the output to write configuration files. It is useful for automating host configuration files when the hosts don&#8217;t have consistent naming [...]]]></description>
		<wfw:commentRss>http://blog.gnucom.cc/2010/list-disks-on-linux-server-for-nagios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get alexa rank from alexa.com with perl.</title>
		<link>http://blog.gnucom.cc/2009/get-alexa-rank-from-alexa-com-with-perl/</link>
		<comments>http://blog.gnucom.cc/2009/get-alexa-rank-from-alexa-com-with-perl/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 02:45:03 +0000</pubDate>
		<dc:creator>sholsapp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Webhosting]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://gnucom.cc/blog/?p=236</guid>
		<description><![CDATA[This is just a little code snippet to return the alexa rank of a given site from http://alexa.com. The script should be easily adaptable to whatever you&#8217;re using it for, but let me know if you have any questions. #!/usr/bin/perl use strict; use LWP::Simple; use URI::URL; my $need_alexa_rank = $ARGV[0]; my $url = url("http://alexa.com/siteinfo/$need_alexa_rank"); my [...]]]></description>
		<wfw:commentRss>http://blog.gnucom.cc/2009/get-alexa-rank-from-alexa-com-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check if file exists with perl.</title>
		<link>http://blog.gnucom.cc/2009/check-if-file-exists-with-perl/</link>
		<comments>http://blog.gnucom.cc/2009/check-if-file-exists-with-perl/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 05:23:00 +0000</pubDate>
		<dc:creator>sholsapp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Webhosting]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://gnucom.cc/blog/?p=148</guid>
		<description><![CDATA[Take a command line filename and check if the file exists. I think this is a bashy way of doing this, but its useful nonetheless: #!/usr/bin/perl use strict; die &#34;usage: exist.pl file\n&#34; unless defined&#40;$ARGV&#91;0&#93;&#41;; &#160; if &#40;-e $ARGV&#91;0&#93;&#41; &#123; print &#34;File exists!\n&#34;; &#125; else &#123; print &#34;File does not exist!\n&#34;; &#125; The opposite can also [...]]]></description>
		<wfw:commentRss>http://blog.gnucom.cc/2009/check-if-file-exists-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to enable shell access for a user with perl.</title>
		<link>http://blog.gnucom.cc/2009/how-to-enable-shell-access-for-a-user-with-perl/</link>
		<comments>http://blog.gnucom.cc/2009/how-to-enable-shell-access-for-a-user-with-perl/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 04:06:45 +0000</pubDate>
		<dc:creator>sholsapp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Webhosting]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://gnucom.cc/blog/?p=142</guid>
		<description><![CDATA[Here is a quick script to rewrite a passwd file to enable shell access for a given user. my $user = $someuser; my $found_user; my $passwd_path = &#34;/etc/passwd&#34;; open&#40;my $fh_pw, &#34;&#60;&#34;, $passwd_path&#41; or die &#34;can't open $passwd_path: $!\n&#34;; open&#40;my $fh_pw_w, &#34;&#62;&#34;, &#34;$passwd_path.temp&#34;&#41; or die &#34;can't open $passwd_path.temp: $!\n&#34;; while &#40;&#60;$fh_pw&#62;&#41; &#123; my $cur_line = $_; [...]]]></description>
		<wfw:commentRss>http://blog.gnucom.cc/2009/how-to-enable-shell-access-for-a-user-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Perl and LWP::UserAgent to POST to a HTML/PHP form.</title>
		<link>http://blog.gnucom.cc/2009/using-perl-and-lwpuseragentpost-to-post-data-to-a-htmlphp-form/</link>
		<comments>http://blog.gnucom.cc/2009/using-perl-and-lwpuseragentpost-to-post-data-to-a-htmlphp-form/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 20:49:49 +0000</pubDate>
		<dc:creator>sholsapp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Webhosting]]></category>
		<category><![CDATA[agent]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[lwp]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://gnucom.cc/blog/?p=122</guid>
		<description><![CDATA[Here is the original HTML form that you would see if you were navigating to the page to fill out the form: &#60;form name=&#34;input&#34; action=&#34;form_rec.php&#34; method=&#34;post&#34;&#62; Ye giveth:&#60;input type=&#34;text&#34; name=&#34;in&#34;&#62; &#60;input type=&#34;submit&#34; value=&#34;Go&#34;&#62; &#60;/form&#62; Notice that we&#8217;re posting to the file form_rec.php, not the file that actually contains this form code.  If you try posting [...]]]></description>
		<wfw:commentRss>http://blog.gnucom.cc/2009/using-perl-and-lwpuseragentpost-to-post-data-to-a-htmlphp-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My most used Perl regular expressions.</title>
		<link>http://blog.gnucom.cc/2009/favorite-perl-regular-expressions/</link>
		<comments>http://blog.gnucom.cc/2009/favorite-perl-regular-expressions/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 00:54:21 +0000</pubDate>
		<dc:creator>sholsapp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Webhosting]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://gnucom.cc/blog/?p=113</guid>
		<description><![CDATA[Match full path of image and extention and store in an array. my @arr = ($string =~ m/([\/A-Za-z0-9_\-]+\.(?:jpg&#124;png))/g); Add something to the end of a line. $string =~ s/(.*)/$1 something/; Add something to the beginning of a line. $string =~ s/(.*)/something $1/; Match an HTML &#60;img&#62; tag. $string =~ m/(&#60;img.*?&#62;)/;]]></description>
		<wfw:commentRss>http://blog.gnucom.cc/2009/favorite-perl-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing leading whitespace in file with perl.</title>
		<link>http://blog.gnucom.cc/2009/removing-leading-whitespace-in-file-with-perl/</link>
		<comments>http://blog.gnucom.cc/2009/removing-leading-whitespace-in-file-with-perl/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 02:19:39 +0000</pubDate>
		<dc:creator>sholsapp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Webhosting]]></category>
		<category><![CDATA[one-liner]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://gnucom.cc/blog/?p=101</guid>
		<description><![CDATA[Do you ever have code with such poor formatting that you just need to start over? This will let you remove all leading whitespace from every line in the file. I&#8217;ve found it handy every now and then. perl -i -pe's/^\s+//' file.c]]></description>
		<wfw:commentRss>http://blog.gnucom.cc/2009/removing-leading-whitespace-in-file-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resolve IP address from hostname with perl.</title>
		<link>http://blog.gnucom.cc/2009/resolve-ip-address-from-hostname-with-perl/</link>
		<comments>http://blog.gnucom.cc/2009/resolve-ip-address-from-hostname-with-perl/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 02:11:20 +0000</pubDate>
		<dc:creator>sholsapp</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Webhosting]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://gnucom.cc/blog/?p=93</guid>
		<description><![CDATA[Here is a small section of perl code that I stumbled upon that resolves an IP from a supplied hostname. Written by detour@metalshell.com. use Socket; use strict; &#160; sub hostname &#123; my &#40;@bytes, @octets, $packedaddr, $raw_addr, $host_name, $ip&#41;; if&#40;$_&#91;0&#93; =~ /[a-zA-Z]/g&#41; &#123; $raw_addr = &#40;gethostbyname&#40;$_&#91;0&#93;&#41;&#41;&#91;4&#93;; @octets = unpack&#40;&#34;C4&#34;, $raw_addr&#41;; $host_name = join&#40;&#34;.&#34;, @octets&#41;; &#125; else [...]]]></description>
		<wfw:commentRss>http://blog.gnucom.cc/2009/resolve-ip-address-from-hostname-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

