<?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># rm-rf.es &#187; perl</title>
	<atom:link href="http://rm-rf.es/categoria/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://rm-rf.es</link>
	<description>Administración de sistemas, Unix, Linux, FreeBSD, Windows, hosting, dominios, servidores...</description>
	<lastBuildDate>Fri, 18 May 2012 21:00:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>DB_File.xs:101: db.h: No such file or directory</title>
		<link>http://rm-rf.es/db_file-xs101-db-h-no-such-file-or-directory/</link>
		<comments>http://rm-rf.es/db_file-xs101-db-h-no-such-file-or-directory/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 19:27:20 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[compilador]]></category>
		<category><![CDATA[perl module]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://rm-rf.es/?p=2420</guid>
		<description><![CDATA[La situación es la siguiente. Estamos compilando en Solaris 10 el módulo de Perl DB_File. El requerimiento lógico es tener instalado BerkeleyDB en el servidor así que procedemos a ello: # pkgadd -d db-4.7.25.NC-sol10-x86-local Ahora procedemos a la típica compilación (Elegir el compilador correcto para Perl en Solaris) y nos encontramos con uno de estos [...]]]></description>
			<content:encoded><![CDATA[<p>La situación es la siguiente. Estamos <strong>compilando en Solaris 10 el módulo de Perl DB_File</strong>. El requerimiento lógico es tener instalado <strong>BerkeleyDB</strong> en el servidor así que procedemos a ello:</p>
<pre># pkgadd -d db-4.7.25.NC-sol10-x86-local</pre>
<p>Ahora procedemos a la típica compilación (<a title="Elegir el compilador correcto para Perl en Solaris" href="http://rm-rf.es/elegir-el-compilador-correcto-para-perl-en-solaris/">Elegir el compilador correcto para Perl en Solaris</a>) y nos encontramos con uno de estos dos errores:</p>
<pre>  cc -c -I/usr/local/include -Dbool=char -DHAS_BOOL
  -O2    -DVERSION=\"1.64\" -DXS_VERSION=\"1.64\" -fpic
  -I/usr/local/lib/perl5/i586-linux/5.00404/CORE -DmDB_Prefix_t=size_t
  -DmDB_Hash_t=u_int32_t DB_File.c
  DB_File.xs:101: db.h: No such file or directory</pre>
<pre>  LD_RUN_PATH="/lib" cc -o blib/arch/auto/DB_File/DB_File.so  -shared
  -L/usr/local/lib DB_File.o    -L/usr/local/lib -ldb
  ld: cannot open -ldb: No such file or directory</pre>
<p>Es raro porque el fichero db.h se encuentra en la ruta de instalación de DB. El problema es que <strong>el fichero de configuración para la compilación del módulo presupone una ruta estándar</strong> que en este caso no se cumple. Así que modificamos dicho fichero de esta forma:</p>
<p>Antes (<strong>config.in</strong>):</p>
<pre>	INCLUDE = /usr/local/BerkeleyDB/include
	LIB     = /usr/local/BerkeleyDB/lib</pre>
<p>Por la ruta donde se encuentre, en mi caso /usr/local/BerkeleyDB.4.7/include/db.h:</p>
<pre>	INCLUDE = /usr/local/BerkeleyDB.4.7/include
	LIB     = /usr/local/BerkeleyDB.4.7/lib</pre>
<p>Y a compilar.</p>
<h4  class="related_post_title">También te puede interesar:</h4><ul class="related_post"><li><a href="http://rm-rf.es/elegir-el-compilador-correcto-para-perl-en-solaris/" title="Elegir el compilador correcto para Perl en Solaris">Elegir el compilador correcto para Perl en Solaris</a></li><li><a href="http://rm-rf.es/bucle-de-password-expirado-en-ldap-nativo-rhel-contra-sun-ldap/" title="Bucle de password expirado en ldap nativo RHEL contra Sun LDAP">Bucle de password expirado en ldap nativo RHEL contra Sun LDAP</a></li><li><a href="http://rm-rf.es/consultar-y-exportar-certificados-ssl-en-sun-web-server-certutil-y-pkcs12/" title="Consultar y exportar certificados SSL en Sun Web Server (certutil y pkcs12)">Consultar y exportar certificados SSL en Sun Web Server (certutil y pkcs12)</a></li><li><a href="http://rm-rf.es/debug-de-procesos-en-solaris-con-truss/" title="Debug de procesos en Solaris con Truss">Debug de procesos en Solaris con Truss</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://rm-rf.es/db_file-xs101-db-h-no-such-file-or-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Elegir el compilador correcto para Perl en Solaris</title>
		<link>http://rm-rf.es/elegir-el-compilador-correcto-para-perl-en-solaris/</link>
		<comments>http://rm-rf.es/elegir-el-compilador-correcto-para-perl-en-solaris/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 18:32:35 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[compilador]]></category>
		<category><![CDATA[perl module]]></category>
		<category><![CDATA[solaris]]></category>

		<guid isPermaLink="false">http://rm-rf.es/?p=2416</guid>
		<description><![CDATA[Cuando compilamos módulos de Perl en Solaris (en este caso Solaris 10) hay que tener muy claro el compilador a utilizar. En esta versión de Solaris tenemos por defecto la versión 5.8.4 de Perl, la cual ha sido compilada con la suite de compilación de Sun Studio. La forma habitual de compilar módulos es la [...]]]></description>
			<content:encoded><![CDATA[<p>Cuando <strong>compilamos módulos de Perl en Solaris</strong> (en este caso Solaris 10) hay que tener muy claro el compilador a utilizar. En esta versión de Solaris tenemos por defecto la versión 5.8.4 de Perl, la cual ha sido compilada con la <strong>suite de compilación de Sun Studio</strong>. La forma habitual de compilar módulos es la siguiente:</p>
<pre># perl Makefile.PL
# make
# make test
# make install</pre>
<p>Si lo hacemos así, el sistema utilizará el compilador Sun Studio y habrá flags incompatibles, errores de compilación, etc. Lo que tenemos que hacer es <strong>forzar la utilización del compilador GNU C/C++</strong>, que por defecto lo encontraremos en <strong>/usr/sfw/bin</strong> como nos indica el <a href="http://twiki.org/cgi-bin/view/Codev/SolarisInstallCookbookPerlModules" target="_blank">Solaris Install CookBook</a>.</p>
<p>Lo primero que tenemos que hacer es añadir esta ruta al PATH ya que por defecto no está:</p>
<pre>export PATH=$PATH:/usr/sfw/bin</pre>
<p>Para la ejecución del Makefile.PL utilizaremos perlgcc en lugar de perl a secas, está en la ruta &#8220;<strong>/usr/perl5/bin/perlgcc</strong>&#8220;. Para los make forzaremos la utilización de gmake en la ruta anteriormente citada. La lista de comandos sería la siguiente:</p>
<pre># /usr/perl5/bin/perlgcc Makefile.PL
# /usr/sfw/bin/gmake MAKE=/usr/sfw/bin/gmake
# /usr/sfw/bin/gmake MAKE=/usr/sfw/bin/gmake test
# /usr/sfw/bin/gmake MAKE=/usr/sfw/bin/gmake install</pre>
<h4  class="related_post_title">También te puede interesar:</h4><ul class="related_post"><li><a href="http://rm-rf.es/db_file-xs101-db-h-no-such-file-or-directory/" title="DB_File.xs:101: db.h: No such file or directory">DB_File.xs:101: db.h: No such file or directory</a></li><li><a href="http://rm-rf.es/bucle-de-password-expirado-en-ldap-nativo-rhel-contra-sun-ldap/" title="Bucle de password expirado en ldap nativo RHEL contra Sun LDAP">Bucle de password expirado en ldap nativo RHEL contra Sun LDAP</a></li><li><a href="http://rm-rf.es/consultar-y-exportar-certificados-ssl-en-sun-web-server-certutil-y-pkcs12/" title="Consultar y exportar certificados SSL en Sun Web Server (certutil y pkcs12)">Consultar y exportar certificados SSL en Sun Web Server (certutil y pkcs12)</a></li><li><a href="http://rm-rf.es/debug-de-procesos-en-solaris-con-truss/" title="Debug de procesos en Solaris con Truss">Debug de procesos en Solaris con Truss</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://rm-rf.es/elegir-el-compilador-correcto-para-perl-en-solaris/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cPanel 11.25: error en módulo perl Mail::SPF</title>
		<link>http://rm-rf.es/cpanel-11-25-error-en-modulo-perl-mailspf/</link>
		<comments>http://rm-rf.es/cpanel-11-25-error-en-modulo-perl-mailspf/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 09:20:55 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[cPanel]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[mail]]></category>

		<guid isPermaLink="false">http://rm-rf.es/?p=1209</guid>
		<description><![CDATA[Al parecer en algunas versiones del nuevo cPanel 11.25.0-RELEASE se están detectando errores en la instalación del módulo de perl Mail::SPF. Si ejecutamos /scripts/checkperlmodules encontramos los siguientes errores: CPAN.pm: Going to build J/JM/JMEHNLE/mail-spf/Mail-SPF-v2.007.tar.gz perl-64bit-hack: enabled # running Build.PL --otherldflags -L/usr/lib64 --config ldflags=-L/usr/lib64 --extralibdir /usr/lib64 Creating new 'MYMETA.yml' with configuration results Creating new 'Build' script for [...]]]></description>
			<content:encoded><![CDATA[<p>Al parecer en algunas versiones del nuevo <strong>cPanel 11.25.0-RELEASE</strong> se están detectando errores en la instalación del módulo de <strong>perl Mail::SPF</strong>. Si ejecutamos /scripts/checkperlmodules encontramos los siguientes errores:</p>
<pre>
CPAN.pm: Going to build J/JM/JMEHNLE/mail-spf/Mail-SPF-v2.007.tar.gz

perl-64bit-hack: enabled
# running Build.PL --otherldflags -L/usr/lib64 --config ldflags=-L/usr/lib64 --extralibdir /usr/lib64
Creating new 'MYMETA.yml' with configuration results
Creating new 'Build' script for 'Mail-SPF' version 'v2.7.0'
Prereq 'v5.6' for 'perl' is not supported by Module::Build::Compat
make: *** No targets.  Stop.
 JMEHNLE/mail-spf/Mail-SPF-v2.007.tar.gz
 /usr/bin/make OTHERLDFLAGS=-L/usr/lib64 LDFLAGS=-L/usr/lib64 EXTRALIBDIR=/usr/lib64 OTHERLDFLAGS=-L/usr/lib64 LDFLAGS=-L/usr/lib64 EXTRALIBDIR=/usr/lib64 -- NOT OK
Running make install
 Make had returned bad status, install seems impossible
perlmod--Install done
</pre>
<p>Para efectuar la instalación de un modo correcto ejecutad el siguiente comando:</p>
<pre> perl -MCPAN -e "get('Mail::SPF')" &#038;&#038; cd /home/.cpan/sources/authors/id/J/JM/JMEHNLE/mail-spf &#038;&#038; tar -xzvf Mail-SPF-v2.007.tar.gz &#038;&#038; cd Mail-SPF-v2.007 &#038;&#038; perl Build.PL &#038;&#038; ./Build &#038;&#038; ./Build test &#038;&#038; ./Build install &#038;&#038; /scripts/checkperlmodules --full</pre>
<p>Fuente | <a target="_blank" href="http://forums.cpanel.net/f43/mail-spf-fails-install-142285.html">Foros cPanel</a></p>
<h4  class="related_post_title">También te puede interesar:</h4><ul class="related_post"><li><a href="http://rm-rf.es/cpanel-internal-server-error-user-is-over-quota/" title="cPanel: Internal Server Error User is over quota">cPanel: Internal Server Error User is over quota</a></li><li><a href="http://rm-rf.es/cpanel-roundcube-service-currently-not-available-error-no-0x01f4/" title="cPanel: Roundcube SERVICE CURRENTLY NOT AVAILABLE! Error No. [0x01F4]">cPanel: Roundcube SERVICE CURRENTLY NOT AVAILABLE! Error No. [0x01F4]</a></li><li><a href="http://rm-rf.es/cpanel-backup-the-backup-of-account-encountered-errors-on/" title="cPanel Backup: The backup of <user> account encountered errors on &#8230;">cPanel Backup: The backup of <user> account encountered errors on &#8230;</a></li><li><a href="http://rm-rf.es/dbd-driver-has-not-implemented-the-autocommit-attribute-at-usrlocallibperl5site_perl588machdbipm/" title="DBD driver has not implemented the AutoCommit attribute at /usr/local/lib/perl5/site_perl/5.8.8/mach/DBI.pm">DBD driver has not implemented the AutoCommit attribute at /usr/local/lib/perl5/site_perl/5.8.8/mach/DBI.pm</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://rm-rf.es/cpanel-11-25-error-en-modulo-perl-mailspf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Actualizar todos los módulos de Perl desde CPAN</title>
		<link>http://rm-rf.es/actualizar-modulos-perl-cpan/</link>
		<comments>http://rm-rf.es/actualizar-modulos-perl-cpan/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 18:02:45 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[actualizar]]></category>
		<category><![CDATA[cpan]]></category>

		<guid isPermaLink="false">http://rm-rf.es/?p=1205</guid>
		<description><![CDATA[Gracias a CPAN, existe una forma muy sencilla y cómoda de actualizar de vez todos los módulos de PERL que tengamos instalados en el sistema, para ello, simplemente ejecutad lo siguiente: cpan -r Automáticamente comenzará la actualización de los módulos: $ cpan -r CPAN: Storable loaded ok Going to read /home/alex/.cpan/Metadata Database was generated on [...]]]></description>
			<content:encoded><![CDATA[<p>Gracias a <strong><a title="Instalación módulos de Perl con CPAN" target="_blank" href="http://rm-rf.es/como-instalar-modulos-de-perl-via-cpan/">CPAN</a></strong>, existe una forma muy sencilla y cómoda de actualizar de vez todos los módulos de <strong><a target="_blank" title="PERL"  href="http://rm-rf.es/sobre/perl/">PERL</a></strong> que tengamos instalados en el sistema, para ello, simplemente ejecutad lo siguiente:</p>
<pre>cpan -r</pre>
<p>Automáticamente comenzará la actualización de los módulos:</p>
<pre>$ cpan -r
CPAN: Storable loaded ok
Going to read /home/alex/.cpan/Metadata
  Database was generated on Mon, 10 Aug 2009 23:26:58 GMT
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
  ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz
Going to read /home/alex/.cpan/sources/authors/01mailrc.txt.gz
CPAN: Compress::Zlib loaded ok
Fetching with LWP:
  ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz
LWP failed with code[500] message[LWP::Protocol::MyFTP: connect: Conexi�n rechazada]
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz
Going to read /home/alex/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Fri, 18 Dec 2009 01:45:07 GMT

Fetching with LWP:
  ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz

Going to read /home/alex/.cpan/sources/modules/03modlist.data.gz
Going to write /home/alex/.cpan/Metadata
...................... etc etc
</pre>
<h4  class="related_post_title">También te puede interesar:</h4><ul class="related_post"><li><a href="http://rm-rf.es/como-instalar-modulos-de-perl-via-cpan/" title="Cómo instalar módulos de Perl vía CPAN">Cómo instalar módulos de Perl vía CPAN</a></li><li><a href="http://rm-rf.es/postfix-mailscanner-you-must-upgrade-your-perl-io-module-to-at-least/" title="Postfix + MailScanner: You must upgrade your perl IO module to at least&#8230;">Postfix + MailScanner: You must upgrade your perl IO module to at least&#8230;</a></li><li><a href="http://rm-rf.es/db_file-xs101-db-h-no-such-file-or-directory/" title="DB_File.xs:101: db.h: No such file or directory">DB_File.xs:101: db.h: No such file or directory</a></li><li><a href="http://rm-rf.es/elegir-el-compilador-correcto-para-perl-en-solaris/" title="Elegir el compilador correcto para Perl en Solaris">Elegir el compilador correcto para Perl en Solaris</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://rm-rf.es/actualizar-modulos-perl-cpan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl: Enviar correos con el módulo MIME::Lite</title>
		<link>http://rm-rf.es/perl-enviar-correos-modulo-mimelite/</link>
		<comments>http://rm-rf.es/perl-enviar-correos-modulo-mimelite/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 20:16:12 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[correo]]></category>
		<category><![CDATA[mime::lite]]></category>
		<category><![CDATA[sendmail]]></category>

		<guid isPermaLink="false">http://rm-rf.es/?p=1032</guid>
		<description><![CDATA[Hoy vamos a ver un ejemplo sencillo de programación en Perl, mediante el cual vamos a enviar un correo electrónico. Utilizamos el módulo MIME::Lite, que permite mandar contenido html (u otro MIME) en el cuerpo del mensaje. El ejemplo que os voy a mostrar envía el correo utilizando el método de envío por defecto que [...]]]></description>
			<content:encoded><![CDATA[<p>Hoy vamos a ver un ejemplo sencillo de programación en Perl, mediante el cual vamos a enviar un correo electrónico. Utilizamos el módulo <strong>MIME::Lite</strong>, que permite mandar contenido html (u otro MIME) en el cuerpo del mensaje.</p>
<p>El ejemplo que os voy a mostrar envía el correo utilizando el método de envío por defecto que tenga el sistema en el que se ejecuta (si es Linux, normalmente sendmail). Ahí va:</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl -w</span><br />
<span style="color: #000000; font-weight: bold;">use</span> MIME<span style="color: #339933;">::</span><span style="color: #006600;">Lite</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$subject</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Asunto del correo&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$from</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;test<span style="color: #000099; font-weight: bold;">\@</span>dominio.com&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$to</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;destinatario<span style="color: #000099; font-weight: bold;">\@</span>dominio.com&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$body</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Esto es el cuerpo del correo ...&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$msg</span> <span style="color: #339933;">=</span> MIME<span style="color: #339933;">::</span><span style="color: #006600;">Lite</span><span style="color: #339933;">-&gt;</span><span style="color: #000000; font-weight: bold;">new</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Subject <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$subject</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; From &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$from</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; To &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$to</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Type &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'text/html'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Data &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">$body</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; <br />
<span style="color: #0000ff;">$msg</span><span style="color: #339933;">-&gt;</span><a href="http://perldoc.perl.org/functions/send.html"><span style="color: #000066;">send</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Básicamente declaramos las variables que contienen el asunto, destinatarios, cuerpo del mensaje, etc y abrimos la clase para trabajar con ella, finalmente enviamos el correo.</p>
<p>En la propia página de cpan hay bastantes ejemplos y muy útiles, os dejo un par de ellos, <a href="http://search.cpan.org/dist/MIME-Lite/lib/MIME/Lite.pm#field_order">podéis ver los demás aquí</a>.</p>
<p>Agregar una imagen a un mensaje con varios destinatarios:</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">### Start with a simple text message:</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$msg</span> <span style="color: #339933;">=</span> MIME<span style="color: #339933;">::</span><span style="color: #006600;">Lite</span><span style="color: #339933;">-&gt;</span><span style="color: #000000; font-weight: bold;">new</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; From &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">'me@myhost.com'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; To &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">'you@yourhost.com'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Cc &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">'some@other.com, some@more.com'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Subject <span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">'A message with 2 parts...'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Type &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">'TEXT'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Data &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">&quot;Here's the GIF file you wanted&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">### Attach a part... the make the message a multipart automatically:</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$msg</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">attach</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Type &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">'image/gif'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Path &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">'aaa000123.gif'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Filename <span style="color: #339933;">=&gt;</span><span style="color: #ff0000;">'logo.gif'</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Utilizar otro método de envío de correo si no tenemos sendmail:</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">### Do something like this in your 'main':</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$I_DONT_HAVE_SENDMAIL</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;MIME<span style="color: #339933;">::</span><span style="color: #006600;">Lite</span><span style="color: #339933;">-&gt;</span><a href="http://perldoc.perl.org/functions/send.html"><span style="color: #000066;">send</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'smtp'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$host</span><span style="color: #339933;">,</span> Timeout<span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">60</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AuthUser<span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">$user</span><span style="color: #339933;">,</span> AuthPass<span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">$pass</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">### Now this will do the right thing:</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">$msg</span><span style="color: #339933;">-&gt;</span><a href="http://perldoc.perl.org/functions/send.html"><span style="color: #000066;">send</span></a><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">### will now use Net::SMTP as shown above</span></div></div>
<h4  class="related_post_title">También te puede interesar:</h4><ul class="related_post"><li><a href="http://rm-rf.es/consultar-imap-o-pop-desde-shell-con-mutt/" title="Consultar IMAP o POP desde shell con mutt">Consultar IMAP o POP desde shell con mutt</a></li><li><a href="http://rm-rf.es/db_file-xs101-db-h-no-such-file-or-directory/" title="DB_File.xs:101: db.h: No such file or directory">DB_File.xs:101: db.h: No such file or directory</a></li><li><a href="http://rm-rf.es/elegir-el-compilador-correcto-para-perl-en-solaris/" title="Elegir el compilador correcto para Perl en Solaris">Elegir el compilador correcto para Perl en Solaris</a></li><li><a href="http://rm-rf.es/exim-establecer-filtros-anti-spam-para-entrada-y-salida-de-correo/" title="Exim: establecer filtros anti-spam para entrada y salida de correo">Exim: establecer filtros anti-spam para entrada y salida de correo</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://rm-rf.es/perl-enviar-correos-modulo-mimelite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl: Encriptar y desencriptar base64 con MIME::Base64</title>
		<link>http://rm-rf.es/perl-encriptar-desencriptar-base64-mimebase64/</link>
		<comments>http://rm-rf.es/perl-encriptar-desencriptar-base64-mimebase64/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 07:37:47 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[perl]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[desencriptar]]></category>
		<category><![CDATA[encriptar]]></category>

		<guid isPermaLink="false">http://rm-rf.es/?p=1001</guid>
		<description><![CDATA[El módulo de Perl MIME::Base64 proporciona funciones para codificar y descodificar cadenas en y desde base64. Base 64 es un sistema de numeración posicional que usa 64 como base. Es la mayor potencia de dos que puede ser representada usando únicamente los caracteres imprimibles de ASCII. Esto ha propiciado su uso para codificación de correos [...]]]></description>
			<content:encoded><![CDATA[<p>El módulo de Perl MIME::Base64 proporciona funciones para codificar y descodificar cadenas en y desde base64.</p>
<blockquote><p>Base 64 es un sistema de numeración posicional que usa 64 como base. Es la mayor potencia de dos que puede ser representada usando únicamente los caracteres imprimibles de ASCII. Esto ha propiciado su uso para codificación de correos electrónicos, PGP y otras aplicaciones. Todas las variantes famosas que se conocen con el nombre de Base64 usan el rango de caracteres A-Z, a-z y 0-9 en este orden para los primeros 62 dígitos, pero los símbolos escogidos para los últimos dos dígitos varían considerablemente de unas a otras. <a href="http://es.wikipedia.org/wiki/Base64" target="_blank">Wikipedia</a></p></blockquote>
<p>Las funciones que nos ofrece son las siguientes:</p>
<p>encode_base64($str);<br />
encode_base64($str, $eol);<br />
decode_base64($str);</p>
<p>Os dejo un par de ejemplos muy sencillos, podéis encontrar más en <a href="http://search.cpan.org/~gaas/MIME-Base64-3.08/Base64.pm" target="_blank">cPan.org</a>.</p>
<p>Decodificación:</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span><br />
<span style="color: #000000; font-weight: bold;">use</span> warnings<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> MIME<span style="color: #339933;">::</span><span style="color: #006600;">Base64</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$string_codificada</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;RXN0byBlcyB1bmEgcHJ1ZWJh&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$string</span> <span style="color: #339933;">=</span> decode_base64<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$codificado</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;String ($string_codificada) decodificada:<span style="color: #000099; font-weight: bold;">\n</span> &quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$string</span><span style="color: #339933;">;</span></div></div>
<p>Codificación:</p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span><br />
<span style="color: #000000; font-weight: bold;">use</span> warnings<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> MIME<span style="color: #339933;">::</span><span style="color: #006600;">Base64</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$string</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">'Esto es una prueba'</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$string_codificada</span> <span style="color: #339933;">=</span> encode_base64<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://perldoc.perl.org/functions/print.html"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;String ($string) codificada:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$string_codificada</span><span style="color: #339933;">;</span></div></div>
<h4  class="related_post_title">También te puede interesar:</h4><ul class="related_post"><li><a href="http://rm-rf.es/encriptacion-y-desencriptacion-con-gnupg/" title="Encriptación y desencriptación con GnuPG">Encriptación y desencriptación con GnuPG</a></li><li><a href="http://rm-rf.es/db_file-xs101-db-h-no-such-file-or-directory/" title="DB_File.xs:101: db.h: No such file or directory">DB_File.xs:101: db.h: No such file or directory</a></li><li><a href="http://rm-rf.es/elegir-el-compilador-correcto-para-perl-en-solaris/" title="Elegir el compilador correcto para Perl en Solaris">Elegir el compilador correcto para Perl en Solaris</a></li><li><a href="http://rm-rf.es/encriptar-un-filesystem-con-luks-y-cryptsetup/" title="Encriptar un filesystem con LUKS y cryptsetup">Encriptar un filesystem con LUKS y cryptsetup</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://rm-rf.es/perl-encriptar-desencriptar-base64-mimebase64/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

