<?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>Ionut's WebSpace &#187; Perl</title>
	<atom:link href="http://www.vioan.ro/wp/category/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vioan.ro/wp</link>
	<description>Exploring Creativity Is My Passion</description>
	<lastBuildDate>Wed, 05 Oct 2011 14:28:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Calling Gnuplot from Perl</title>
		<link>http://www.vioan.ro/wp/2008/09/30/calling-gnuplot-from-perl/</link>
		<comments>http://www.vioan.ro/wp/2008/09/30/calling-gnuplot-from-perl/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 21:18:31 +0000</pubDate>
		<dc:creator>ionut</dc:creator>
				<category><![CDATA[Gnuplot]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[SciComputing]]></category>
		<category><![CDATA[scientific]]></category>

		<guid isPermaLink="false">http://www.vioan.ro/wp/?p=163</guid>
		<description><![CDATA[


In my previous post I discussed how to call Gnuplot from C and Python language. If you are using Perl, then, here is the script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl
# Generate postscript and png plot with GNUplot from Perl
# Author: Ioan Vancea
# Usage: Give &#34;data file&#34; as an argument for script
&#160;
use strict;
use warnings;
&#160;
my $file = ARGV&#91;0&#93;;
&#160;
# POSTSCRIPT
open &#40;GNUPLOT, &#34;&#124;gnuplot&#34;&#41;;
print GNUPLOT [...]]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.vioan.ro/wp/2008/09/30/graphics-with-gnuplot-from-c-and-python-language/">my previous post</a> I discussed how to call Gnuplot from C and Python language. If you are using Perl, then, here is the script:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
</pre></td><td class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
<span style="color: #666666; font-style: italic;"># Generate postscript and png plot with GNUplot from Perl</span>
<span style="color: #666666; font-style: italic;"># Author: Ioan Vancea</span>
<span style="color: #666666; font-style: italic;"># Usage: Give &quot;data file&quot; as an argument for script</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> warnings<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$file</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">ARGV</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># POSTSCRIPT</span>
<span style="color: #000066;">open</span> <span style="color: #009900;">&#40;</span>GNUPLOT<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;|gnuplot&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> GNUPLOT <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOPLOT;
set term post color &quot;Courier&quot; 12
set output &quot;$file.ps&quot;
set size 1 ,1
set nokey
set data style line
set xlabel &quot;frequency&quot; font &quot;Courier,14&quot;
set title &quot;Fast Fourier Transform&quot; font &quot;Courier,14&quot;
set grid xtics ytics
set xtics 100
plot &quot;$file&quot; using 1:2 w lines 1
EOPLOT</span>
<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span>GNUPLOT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># PNG</span>
<span style="color: #000066;">open</span> <span style="color: #009900;">&#40;</span>GNUPLOT<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;|gnuplot&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">print</span> GNUPLOT <span style="color: #cc0000; font-style: italic;">&lt;&lt;EOPLOT;
set term png small xFFFFFF
set output &quot;$file.png&quot;
set size 1 ,1
set nokey
set data style line
set xlabel &quot;frequency&quot; font &quot;VeraMono,10&quot;
set title &quot;Fast Fourier Transform&quot; font &quot;VeraMono,10&quot;
set grid xtics ytics
set xtics 100
plot &quot;$file&quot; using 1:2 w lines 1
EOPLOT</span>
<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span>GNUPLOT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.vioan.ro/wp/2008/09/30/calling-gnuplot-from-perl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to install a Perl module</title>
		<link>http://www.vioan.ro/wp/2007/07/31/how-to-install-a-perl-module/</link>
		<comments>http://www.vioan.ro/wp/2007/07/31/how-to-install-a-perl-module/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 09:19:01 +0000</pubDate>
		<dc:creator>ionut</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.vioan.ro/wp/?p=14</guid>
		<description><![CDATA[1. Download, extract, cd into directory
2. Compile &#038; Install
perl Makefile.PL
    make
    make install

the second method can be:
perl -MCPAN -e shell
    install modulename

]]></description>
			<content:encoded><![CDATA[<p>1. Download, extract, cd into directory</p>
<p>2. Compile &#038; Install</p>
<pre><code>perl Makefile.PL
    make
    make install
</code></pre>
<p>the second method can be:</p>
<pre><code>perl -MCPAN -e shell
    install modulename
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.vioan.ro/wp/2007/07/31/how-to-install-a-perl-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating passwords with Perl</title>
		<link>http://www.vioan.ro/wp/2007/07/31/generating-passwords-with-perl/</link>
		<comments>http://www.vioan.ro/wp/2007/07/31/generating-passwords-with-perl/#comments</comments>
		<pubDate>Tue, 31 Jul 2007 09:04:09 +0000</pubDate>
		<dc:creator>ionut</dc:creator>
				<category><![CDATA[*BSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.vioan.ro/wp/?p=9</guid>
		<description><![CDATA[DES:
mkpasswd
  perl -e 'printf "%s\n", crypt("pass", "two-letter-salt")'
MD5:
mkpasswd --hash=md5
perl -e 'printf "%s\n", crypt("pass", "\$1\$6-8-letter-salt\$")'
PLAIN-MD5:
perl -MDigest::MD5 -e 'printf "{PLAIN-MD5}%s\n", Digest::MD5::md5_hex("pass")'
DIGEST-MD5:
perl -MDigest::MD5 -e 'printf "{DIGEST-MD5}%s\n", Digest::MD5::md5_hex("user:realm:pass")'
]]></description>
			<content:encoded><![CDATA[<p>DES:</p>
<pre><code>mkpasswd
  perl -e 'printf "%s\n", crypt("pass", "two-letter-salt")'</code></pre>
<p>MD5:</p>
<pre><code>mkpasswd --hash=md5
perl -e 'printf "%s\n", crypt("pass", "\$1\$6-8-letter-salt\$")'</code></pre>
<p>PLAIN-MD5:</p>
<pre><code>perl -MDigest::MD5 -e 'printf "{PLAIN-MD5}%s\n", Digest::MD5::md5_hex("pass")'</code></pre>
<p>DIGEST-MD5:</p>
<pre><code>perl -MDigest::MD5 -e 'printf "{DIGEST-MD5}%s\n", Digest::MD5::md5_hex("user:realm:pass")'<c/ode></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.vioan.ro/wp/2007/07/31/generating-passwords-with-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Play a MP3 list over HTTP</title>
		<link>http://www.vioan.ro/wp/2007/07/29/play-a-mp3-list-over-http/</link>
		<comments>http://www.vioan.ro/wp/2007/07/29/play-a-mp3-list-over-http/#comments</comments>
		<pubDate>Sun, 29 Jul 2007 10:14:59 +0000</pubDate>
		<dc:creator>ionut</dc:creator>
				<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.vioan.ro/wp/?p=29</guid>
		<description><![CDATA[ All my mp3s are stored on my filesever. Normally I just mount the mp3 directory on my current workstation (either via NFS or Samba). I have some playlists too which store all files with relative paths (relative to the playlist location). This works fine.
But sometimes I want to have an easy way to listen [...]]]></description>
			<content:encoded><![CDATA[<p class="level1"> All my mp3s are stored on my filesever. Normally I just mount the mp3 directory on my current workstation (either via NFS or Samba). I have some playlists too which store all files with relative paths (relative to the playlist location). This works fine.</p>
<p>But sometimes I want to have an easy way to listen to a playlist without mounting anything (eg. when using the laptop). So I made the mp3 files and playlists available on my local Apache webserver and use the following short <acronym title="Common Gateway Interface">CGI</acronym> to get a playlist with http adresses to the file.</p>
<pre class="code perl"><span class="co1">#!/usr/bin/perl</span>

<span class="re0">$WEBDIR</span> = <span class="st0">'/var/www'</span>;
<span class="re0">$WEBSERVER</span> = <span class="st0">'xerxes'</span>;

<span class="kw2">use</span> CGI;
<span class="kw2">use</span> File::<span class="me2">Basename</span>;

<a href="http://www.perldoc.com/perl5.6/pod/func/print.html"><span class="kw3">print</span></a> <span class="st0">"Content-type: audio/x-mpegurl<span class="es0">r</span><span class="es0">n</span><span class="es0">r</span><span class="es0">n</span>"</span>;

<span class="re0">$q</span> = <span class="kw2">new</span> CGI<span class="br0">(</span><span class="br0">)</span>;

<span class="re0">$list</span> = <span class="re0">$q</span>-&gt;<span class="me1">param</span><span class="br0">(</span><span class="st0">'list'</span><span class="br0">)</span>;
<span class="re0">$dir</span>  = dirname<span class="br0">(</span><span class="re0">$list</span><span class="br0">)</span>;
<span class="re0">$list</span> = <span class="re0">$WEBDIR</span>.<span class="st0">'/'</span>.<span class="re0">$list</span>;

<a href="http://www.perldoc.com/perl5.6/pod/func/open.html"><span class="kw3">open</span></a> <span class="br0">(</span>LIST, <span class="re0">$list</span><span class="br0">)</span> <span class="kw1">or</span> <a href="http://www.perldoc.com/perl5.6/pod/func/die.html"><span class="kw3">die</span></a><span class="br0">(</span><span class="st0">"Could not read $list"</span><span class="br0">)</span>;
<span class="re0">@m3u</span> = <span class="re4">&lt;LIST&gt;</span>;
<a href="http://www.perldoc.com/perl5.6/pod/func/close.html"><span class="kw3">close</span></a> LIST;

<span class="kw1">foreach</span> <span class="re0">$file</span> <span class="br0">(</span><span class="re0">@m3u</span><span class="br0">)</span><span class="br0">{</span>
 <span class="re0">$file</span> = <span class="st0">'http://'</span>.<span class="re0">$WEBSERVER</span>.<span class="re0">$dir</span>.<span class="st0">'/'</span>.<span class="re0">$file</span>;
 <a href="http://www.perldoc.com/perl5.6/pod/func/chomp.html"><span class="kw3">chomp</span></a><span class="br0">(</span><span class="re0">$file</span><span class="br0">)</span>;
 <a href="http://www.perldoc.com/perl5.6/pod/func/print.html"><span class="kw3">print</span></a> <span class="st0">"$file<span class="es0">n</span>"</span>;
<span class="br0">}</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.vioan.ro/wp/2007/07/29/play-a-mp3-list-over-http/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

