Perl

Calling Gnuplot from Perl

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 "data file" as an argument for script
 
use strict;
use warnings;
 
my $file = ARGV[0];
 
# POSTSCRIPT
open (GNUPLOT, "|gnuplot");
print GNUPLOT [...]


How to install a Perl module

1. Download, extract, cd into directory
2. Compile & Install
perl Makefile.PL
make
make install

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


Generating passwords with Perl

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”)’


Play a MP3 list over HTTP

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 [...]