<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
<channel>
    <title>Posteet: perl</title> 
    <link>http://posteet.com/</link> 
    <description>Recent posteets posted to Posteet</description>
    <ttl>60</ttl>

    
    <item>
        <title>Perl package install with CPAN: Writing Makefile for &lt;any module&gt; -- NOT OK</title>
        <link>http://feeds.feedburner.com/~r/posteet_perl/~3/311316375/1006</link>
        <description>
        <![CDATA[<pre># Synopisis: following error while installing any perl package with CPAN

# Looks good
# Writing Makefile for Package
#     -- NOT OK
# Running make test
#   Can't test without successful make
# Running make install
#   make had returned bad status, install seems impossible

# Solution: set make to /usr/bin/make in CPAN configuration
$ cpan
cpan&gt; o conf make /usr/bin/make</pre> <a href="http://posteet.com/tags/cpan">[cpan]</a>  <a href="http://posteet.com/tags/error">[error]</a>  <a href="http://posteet.com/tags/make">[make]</a>  <a href="http://posteet.com/tags/perl">[perl]</a> ]]>        </description>
        <dc:creator>spirit</dc:creator>
        <pubDate>Tue, 10 Jun 2008 13:54:16 +0000</pubDate>

            <category>cpan</category>
            <category>error</category>
            <category>make</category>
            <category>perl</category>
    
    <feedburner:origLink>http://posteet.com/view/1006</feedburner:origLink></item>

  
    <item>
        <title>Requete SQL sur la base d'OCS Inventory en Perl</title>
        <link>http://feeds.feedburner.com/~r/posteet_perl/~3/230161674/513</link>
        <description>
        <![CDATA[<pre>#!/usr/bin/perl -w
use strict;
use warnings;
use DBI;

#Connection à la base de donnes OCS
my $dns = 'dbi:mysql:ocsweb:localhost';
my $login = 'root';
my $passwd = 'secret';
my $dbh = DBI-&gt;connect($dns, $login, $passwd) or die &quot;Connection impossible: $DBI::errstr\n&quot;;

# Recuperation des IP et des MAC  des postes SANS &quot;Anti-virus&quot;
my $query = &quot;SELECT DISTINCT hard.NAME, net.IPADDRESS, net.MACADDR &quot;.
		&quot;FROM softwares AS soft, hardware AS hard, networks AS net &quot;.
		&quot;WHERE hard.ID = soft.HARDWARE_ID &quot;.
		  &quot;AND hard.ID = net.HARDWARE_ID &quot;.
		  &quot;AND net.STATUS = 'up' &quot;.
		  &quot;AND soft.name NOT LIKE '%anti-virus%' &quot;.
		&quot;ORDER BY INET_ATON(net.IPADDRESS) &quot;;

my $result = $dbh-&gt;prepare($query) or die &quot;Preparation impossible: $DBI::errstr\n&quot;;

$result-&gt;execute() or die &quot;Execution impossible: $DBI::errstr\n&quot;;

#$result-&gt;dump_results();

printf (&quot;Il y a %d correspondances:\n&quot;,$result-&gt;rows);

while ( my ($name, $ip, $mac) = $result-&gt;fetchrow_array()){
	print &quot;$name, \t$ip, \t$mac\n&quot;;
}
$result-&gt;finish();
$dbh-&gt;disconnect();</pre> <a href="http://posteet.com/tags/DBI">[DBI]</a>  <a href="http://posteet.com/tags/INET_ATON">[INET_ATON]</a>  <a href="http://posteet.com/tags/MySQL">[MySQL]</a>  <a href="http://posteet.com/tags/OCS">[OCS]</a>  <a href="http://posteet.com/tags/OCS inventory">[OCS inventory]</a>  <a href="http://posteet.com/tags/perl">[perl]</a> ]]>        </description>
        <dc:creator>toff</dc:creator>
        <pubDate>Thu, 22 Nov 2007 22:39:59 +0000</pubDate>

            <category>DBI</category>
            <category>INET_ATON</category>
            <category>MySQL</category>
            <category>OCS</category>
            <category>OCS inventory</category>
            <category>perl</category>
    
    <feedburner:origLink>http://posteet.com/view/513</feedburner:origLink></item>

  
    <item>
        <title>Indenter automatiquement du code source avec vim</title>
        <link>http://feeds.feedburner.com/~r/posteet_perl/~3/230161675/461</link>
        <description>
        <![CDATA[<pre>Vim peut indenter automatiquement du code source (c, java, ...)

Sélectionner la partie du code source à traiter en mode visuel (v)
Appuyer sur la touche =</pre> <a href="http://posteet.com/tags/c">[c]</a>  <a href="http://posteet.com/tags/c++">[c++]</a>  <a href="http://posteet.com/tags/java">[java]</a>  <a href="http://posteet.com/tags/perl">[perl]</a>  <a href="http://posteet.com/tags/vim">[vim]</a> ]]>        </description>
        <dc:creator>sebclick</dc:creator>
        <pubDate>Fri, 16 Nov 2007 11:23:57 +0000</pubDate>

            <category>c</category>
            <category>c++</category>
            <category>java</category>
            <category>perl</category>
            <category>vim</category>
    
    <feedburner:origLink>http://posteet.com/view/461</feedburner:origLink></item>

  
    <item>
        <title>installation de modules PERL via le CPAN</title>
        <link>http://feeds.feedburner.com/~r/posteet_perl/~3/230161676/338</link>
        <description>
        <![CDATA[<pre># mode interactif
perl -MCPAN -e shell

# installation directe
perl -MCPAN -e 'install MODULE'</pre> <a href="http://posteet.com/tags/CPAN">[CPAN]</a>  <a href="http://posteet.com/tags/PERL">[PERL]</a> ]]>        </description>
        <dc:creator>griffith</dc:creator>
        <pubDate>Thu, 08 Nov 2007 15:18:27 +0000</pubDate>

            <category>CPAN</category>
            <category>PERL</category>
    
    <feedburner:origLink>http://posteet.com/view/338</feedburner:origLink></item>

  
    <item>
        <title>Perl - Expression régulière pour tester la validité d'une adresse IP</title>
        <link>http://feeds.feedburner.com/~r/posteet_perl/~3/230161677/199</link>
        <description>
        <![CDATA[<pre>while($addr !~ /^([O1]?\d\d?|2[0-4]\d|25[0-5])\.([O1]?\d\d?|2[0-4]\d|25[0-5])\.([O1]?\d\d?|2[0-4]\d|25[0-5])\.([O1]?\d\d?|2[0-4]\d|25[0-5])$/){
		print &quot;Please give the IP address of the remote server:\n&quot;;
		$addr = get_answer();
	}</pre> <a href="http://posteet.com/tags/adresse ip">[adresse ip]</a>  <a href="http://posteet.com/tags/expression régulière">[expression régulière]</a>  <a href="http://posteet.com/tags/ip">[ip]</a>  <a href="http://posteet.com/tags/ip address">[ip address]</a>  <a href="http://posteet.com/tags/perl">[perl]</a>  <a href="http://posteet.com/tags/regex">[regex]</a>  <a href="http://posteet.com/tags/regular expression">[regular expression]</a> ]]>        </description>
        <dc:creator>henri</dc:creator>
        <pubDate>Mon, 05 Nov 2007 08:23:28 +0000</pubDate>

            <category>adresse ip</category>
            <category>expression régulière</category>
            <category>ip</category>
            <category>ip address</category>
            <category>perl</category>
            <category>regex</category>
            <category>regular expression</category>
    
    <feedburner:origLink>http://posteet.com/view/199</feedburner:origLink></item>

  
    <item>
        <title>Rename subtitles script</title>
        <link>http://feeds.feedburner.com/~r/posteet_perl/~3/230161678/124</link>
        <description>
        <![CDATA[<pre>#!/usr/bin/perl
#
# It's my first script in Perl, so be lenient.
#
# This script works only for TV shows and their subtitles !
# When you want to see your favorite tv show, with its sub, you launch the video
# with your favorite video player, and you add the path of the subtitles.
# Many video players, like mplayer, import automatically the subtitles if they 
# have the same name. This script renames the subtitles files (.srt) of a directory
# exactly like the corresponding videos (.avi).
# You won't need to specify the path of the subtitles to your video player anymore.
# 
# Example:
# Video: my_video.s04e38.something.dot.something_else.avi
# Subtitle file: video.438.srt
# After running the script, the subtitle will be named:
# my_video.s04e38.something.dot.something_else.srt
#
# The formats supported by the script:
# - sAAeBB or SAAEBB with AA the season and BB the episode.
# - ABB with A the season and BB the episode.
# - AxBB with A the season and BB the episode.
#
# If the script is launched without any arguments, then the videos and subtitles 
# directories will be set to the current directory.
#
# Options:
#       
#       -h print command list
#
# -d (-dir) &lt;videos directory&gt; 
# Specify the directory where the videos are located.
# If this option is not set, the video directory will be the current directory.
#
# -s (-sub) &lt;subtitles files directory&gt;
# Specify the directory of the subtitles files.
# If this option is not set, the subtitles directory will be the same directory as
# the videos directory. Which means that if the videos directory is not set, it will be
# the current directory.
# 
# -p (--preview)  &lt;without arguments&gt;
# Preview mode. If this options is set, the subtiles new names will be display on the
# screen without being renamed.
#
# I hope this script will be as useful as it's to me.
# 
# Enjoy your tv shows ;-)
#

use Cwd;
#use Getopt::Std;
use Getopt::Long;

my $preview = 0;
my $help = 0;
GetOptions( &quot;dir=s&quot; =&gt; \$dir, &quot;sub=s&quot; =&gt; \$sub, &quot;preview!&quot; =&gt; \$preview, &quot;help!&quot; =&gt;\$help ) or printOptions();

if ($help == 1){
  print &quot;Command list\n&quot;;
  printOptions();
}


if ($preview == 1) {print &quot;****** PREVIEW MODE ******\n&quot;;}
else {print &quot;****** RENAME MODE *******\n&quot;;}

chomp ($currentDir = getcwd());
my $videoDir = $currentDir;
my $subDir = $currentDir;

if (defined $dir){
  $videoDir = $dir;
}
print &quot;dir: $videoDir\n&quot;;

if (defined $sub) {
        $subDir = $sub;
}
else {
        $subDir = $videoDir;
}

opendir(DIR, $videoDir) || die &quot;can't opendir $videoDir: $!&quot;;
while (my $path = readdir(DIR)) { 
        push(@videosList, $path) if $path =~ m/\.avi$/;
} 
closedir(DIR);

if (!@videosList){
        print&quot;\n No videos found ! check your path !\n&quot;;
        exit();
}

$temp = getcwd();
opendir(DIR, $subDir) || die &quot;can't opendir $subDir: $!&quot;;
while (my $path = readdir(DIR)) {
        push(@subsList, $path) if $path =~ m/\.srt$/;
}
closedir(DIR);

if (!@subsList){
        print &quot;\n No subtitles found ! check your path !\n&quot;;
        exit();
}

if ($videoDir ne $currentDir){
        chdir ($videoDir) || die &quot;Can't cd to spool: $!\n&quot;;
}

foreach $f (@videosList) {
                
        ################
        # VIDEOS FILES #
        ################
        
        my @result = getSeasonEpisod($f);
        $season = @result[0];
        $episod = @result[1];

        foreach $s (@subsList) {
                
                if ($videoDir ne $subDir) {
                        chdir ($currentDir) || die &quot;Can't cd to spool: $!\n&quot;;
                        chdir ($subDir) || die &quot;Can't cd to spool: $!\n&quot;;
                }

                ####################
                # SUBTITLES FILES  #
                ####################
        
                my @result = getSeasonEpisod($s);
                $seasonSub = @result[0];
                $episodSub = @result[1];        

                if ($season == $seasonSub and $episod == $episodSub){
                        my ($vidName) = $f =~ m/(.*)\.avi$/;
                        print &quot;Rename: $s --&gt; $vidName.srt&quot;;
                        print &quot;\n&quot;;
                        if ($preview != 1){
                                rename($s,&quot;$vidName.srt&quot;) || die &quot;Cannot rename $s: $!&quot;;
                        }
                }
        }
}

# get season and episode
sub getSeasonEpisod {
        my $season = 0;
        my $episod = 0;

        # format ABB
        if(@_[0] =~ /(\d)(\d\d)/){
                $season = $1;
                $episod = $2;
        }

        # format sAAeBB
        elsif (@_[0] =~ /[sS](\d\d)[eE](\d\d)/){
                $season = $1;
                $episod = $2;
        }

        # format AxBB
        elsif (@_[0] =~ /(\d)[xX](\d\d)/){
                $season = $1;
                $episod = $2;
        }
        
        else {  
                print &quot;Video format Not Match ! \n&quot;;
        }
        
        return ($season,$episod);
}

# print options
sub printOptions(){
  print &quot;-h print command list\n&quot;;
  print &quot;-d (-dir) &lt;videos directory&gt;\n&quot;;
  print &quot;-s (-sub) &lt;subtitles files directory&gt;\n&quot;;
  print &quot;-p (--preview)  &lt;without arguments&gt;\n&quot;;
  exit();
}</pre> <a href="http://posteet.com/tags/perl">[perl]</a>  <a href="http://posteet.com/tags/rename">[rename]</a>  <a href="http://posteet.com/tags/subtitle">[subtitle]</a>  <a href="http://posteet.com/tags/videos">[videos]</a> ]]>        </description>
        <dc:creator>celos</dc:creator>
        <pubDate>Sat, 03 Nov 2007 13:25:32 +0000</pubDate>

            <category>perl</category>
            <category>rename</category>
            <category>subtitle</category>
            <category>videos</category>
    
    <feedburner:origLink>http://posteet.com/view/124</feedburner:origLink></item>


</channel>
</rss>
