<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6406023849649551478</id><updated>2011-11-27T23:42:38.282Z</updated><category term='facebook'/><category term='i18n'/><category term='binaire'/><category term='snippet'/><category term='astuce'/><category term='news'/><category term='truc'/><category term='ajax'/><category term='echappement'/><category term='cryptage'/><category term='perl'/><category term='texte'/><category term='rien a voir'/><category term='internationalisation'/><category term='heritage'/><category term='scan'/><category term='panne'/><category term='page'/><category term='test'/><category term='mason'/><category term='blogger'/><category term='quick'/><category term='web2.0'/><category term='configuration'/><category term='compilation'/><category term='adsense'/><category term='html'/><category term='makefile'/><category term='composant'/><category term='anniversaire'/><category term='unicode'/><category term='bookmarking'/><category term='dirty'/><category term='generalite'/><category term='google'/><title type='text'>Le web avec mason, perl, apache</title><subtitle type='html'>Principalement mason. Le reste a l'occasion</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-439681324107050867</id><published>2008-06-18T14:09:00.001+01:00</published><updated>2008-06-18T14:09:23.256+01:00</updated><title type='text'>Firefox 3/ Convaincu aux plugins pres.</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;J'ai installe ff3 et pour l'instant je suis assez convaincu du resultat. On sent vraiment la difference de rapidite du moteur javascript. Les utilisateurs de gmail, yahoo mail et autres applications javascript y trouverons un tres grand confort supplementaire.&lt;br/&gt;&lt;br/&gt;Au niveau de la gestion de la memoire (autre avancee fondamentale de ff3), la chose devrait se reveller beaucoup plus efficace, ce qui me manquera pas de ravir nos amis surfeurs qui ont comme moi une moyenne de  10 onglets ouverts en permanence.&lt;br/&gt;&lt;br/&gt;Quant a la super barre et autres gadgets bookmarkisants, c'est plutot une question de gout il faut avouer.&lt;br/&gt;&lt;br/&gt;Attention cependant aux plugins. J'ai eu la mauvaise surprise de voir les miens desactives pour cause de non compatibilite. &lt;br/&gt;&lt;br/&gt;Donc si vous ne pouvez pas vivre sans vos plugins preferes, mieux vaut attendre un peu pour que les developeurs mettent tout ca a jour.&lt;br/&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-439681324107050867?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/439681324107050867/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=439681324107050867' title='6 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/439681324107050867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/439681324107050867'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2008/06/firefox-3-convaincu-aux-plugins-pres.html' title='Firefox 3/ Convaincu aux plugins pres.'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-2521343226328298473</id><published>2008-01-12T20:18:00.000Z</published><updated>2008-01-12T20:25:22.793Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='adsense'/><category scheme='http://www.blogger.com/atom/ns#' term='panne'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Bientôt du nouveau avec adsense ?</title><content type='html'>Une fois n'est pas coutume, google nous affiche une page bien affreuse lorsqu'on essaie de se connecter à son compte adsense :&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_KUgWQCbhgu8/R4khOIEAKtI/AAAAAAAAAN0/1dX8i3mTNCM/s1600-h/adsensedown.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_KUgWQCbhgu8/R4khOIEAKtI/AAAAAAAAAN0/1dX8i3mTNCM/s320/adsensedown.png" alt="" id="BLOGGER_PHOTO_ID_5154687775068400338" border="0" /&gt;&lt;/a&gt;
Que se passe-t-il chez google ? Vraie panne (on à du mal à y croire) ? Migration vers une nouvelle version (dans ce cas, pourquoi ne pas l'avoir faite en douceur comme avec analytics ) ?

La réponse prochainement j'espère !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-2521343226328298473?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/2521343226328298473/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=2521343226328298473' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/2521343226328298473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/2521343226328298473'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2008/01/bientt-du-nouveau-avec-adsense.html' title='Bientôt du nouveau avec adsense ?'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_KUgWQCbhgu8/R4khOIEAKtI/AAAAAAAAAN0/1dX8i3mTNCM/s72-c/adsensedown.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-3577855537519165265</id><published>2008-01-08T19:05:00.000Z</published><updated>2008-01-08T19:13:15.561Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='adsense'/><category scheme='http://www.blogger.com/atom/ns#' term='test'/><category scheme='http://www.blogger.com/atom/ns#' term='google'/><title type='text'>Google adsense passe au web2.0</title><content type='html'>Je ne sais pas si vous avez vu, mais google fait des tests en ce moment d'une nouvelle fonctionnalite pour les unit adsense : Des micro fleches permettent de faire defiler de nouvelles annonces dans le bloc avec un effet de carroussel tres  web2.0 .  Est ce que google va generaliser tout ca ? Nous le saurons sans doute dans quelques mois. Allez, je vous met un screenshot en plus :
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_KUgWQCbhgu8/R4PKpoEAKsI/AAAAAAAAANs/zRA3Py5QV3c/s1600-h/snapshot_google1.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_KUgWQCbhgu8/R4PKpoEAKsI/AAAAAAAAANs/zRA3Py5QV3c/s320/snapshot_google1.png" alt="" id="BLOGGER_PHOTO_ID_5153185215119633090" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-3577855537519165265?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/3577855537519165265/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=3577855537519165265' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/3577855537519165265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/3577855537519165265'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2008/01/google-adsense-passe-au-web20.html' title='Google adsense passe au web2.0'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_KUgWQCbhgu8/R4PKpoEAKsI/AAAAAAAAANs/zRA3Py5QV3c/s72-c/snapshot_google1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-5295667111644817711</id><published>2007-12-28T15:38:00.001Z</published><updated>2007-12-28T15:38:53.021Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='snippet'/><category scheme='http://www.blogger.com/atom/ns#' term='compilation'/><category scheme='http://www.blogger.com/atom/ns#' term='composant'/><title type='text'>Compilez avant de publier</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Avant de publier un composant mason sur votre site (et si vous ne disposez pas d'un serveur dedie au developpement), il peut etre tres utile de le compiler avant pour eliminer les erreurs les plus flagrantes (syntaxe, variables mal declarees ..).&lt;br/&gt;&lt;br/&gt;Un petit script bien utile pour compiler vos composants:&lt;br/&gt;&lt;br/&gt;&lt;ol&gt;&lt;li&gt;&lt;pre&gt;!/usr/bin/perl  -w&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;pre&gt;use strict;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;pre&gt;use HTML::Mason;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;pre&gt;my $interp = HTML::Mason::Interp-&amp;amp;gt;new();&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;pre&gt;my $file = shift;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;pre&gt;eval {&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;pre&gt; $interp-&amp;amp;gt;make_component(comp_file=&amp;amp;gt;$file);&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;pre&gt;};&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;pre&gt;die $@ if $@;&lt;/pre&gt;&lt;/li&gt;&lt;/ol&gt;A mettre dans votre ~/bin pour les etrennes :)&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-5295667111644817711?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/5295667111644817711/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=5295667111644817711' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/5295667111644817711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/5295667111644817711'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/12/compilez-avant-de-publier.html' title='Compilez avant de publier'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-811076150885823933</id><published>2007-12-28T15:30:00.001Z</published><updated>2007-12-28T15:30:48.051Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='anniversaire'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>5.10 et anniversaire.</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Oyez Oyez, en meme temps que &lt;a href='http://perlbuzz.com/2007/12/it-was-twenty-years-ago-today.html'&gt;l'anniversaire des 20 ans&lt;/a&gt; de perl (le bel age), sort la version 5.10 . Cette version a un an de retard, mais la &lt;a href='http://news.perlfoundation.org/2007/12/perl_510_now_available.html'&gt;liste des nouveautes&lt;/a&gt; vaut le coup d'oeil.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-811076150885823933?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/811076150885823933/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=811076150885823933' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/811076150885823933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/811076150885823933'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/12/510-et-anniversaire_28.html' title='5.10 et anniversaire.'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-5985580383790083676</id><published>2007-12-19T10:43:00.000Z</published><updated>2007-12-19T10:50:00.661Z</updated><title type='text'>5.10 et anniversaire.</title><content type='html'>Oyez Oyez, en meme temps que &lt;a href="http://perlbuzz.com/2007/12/it-was-twenty-years-ago-today.html"&gt;l'anniversaire des 20 ans&lt;/a&gt; de perl (le bel age), sort la version 5.10 . Cette version a un an de retard, mais la &lt;a href="http://news.perlfoundation.org/2007/12/perl_510_now_available.html"&gt;liste des nouveautes&lt;/a&gt; vaut le coup d'oeil.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-5985580383790083676?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/5985580383790083676/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=5985580383790083676' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/5985580383790083676'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/5985580383790083676'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/12/510-et-anniversaire.html' title='5.10 et anniversaire.'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-4855903076087288318</id><published>2007-11-29T16:09:00.001Z</published><updated>2007-11-29T16:13:42.164Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='truc'/><category scheme='http://www.blogger.com/atom/ns#' term='snippet'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='composant'/><title type='text'>Ajax et mason</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;Faire de l'ajax avec mason est parfaitement possible, meme sans aucune connaissance de la librairie &lt;a href="http://www.prototypejs.org/"&gt;prototype.js&lt;/a&gt; .
Vous avez quand meme besoin d'installer cette librairie javascript et le la charger dans vos pages.

Sur le &lt;a href="http://www.masonhq.com/"&gt;mason headquarter&lt;/a&gt;, vous trouverez un &lt;a href="http://www.masonhq.com/?Component:ajax"&gt;composant ajax&lt;/a&gt; tres simple a utiliser.


Tout d'abord, downloadez le et sauvegardez le dans votre arborescence de composants (a la racine par exemple). Mettons que son nom dans l'espace mason soit /ajax.

Ce composant a deux fonctions:

&lt;ul&gt;&lt;li&gt;La premiere est qu'il agit en tant que helper pour inclure des appels ajax dans vos pages.&lt;/li&gt;&lt;li&gt;La seconde est qu'il s'occupe de l'appel de la methode (une methode mason) du cote serveur lorsque l'evenement ajax est declenche.&lt;/li&gt;&lt;/ul&gt;La doc du composant est assez claire donc je ne vais pas en dire beaucoup plus.

Juste une petite astuce quand meme: lorsque vous declarez quel formulaire serialiser pour faire votre appel ajax, il faut doubler les quotes de l'identifiant du formulaire.

Par exemple:

&lt;ol&gt;&lt;li&gt;&amp;lt;form id="myform"&gt; ..... &amp;lt;/form&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;a href="javascript:&amp;lt;&amp; /ajax, comp=&gt; 'SELF:ajaxservermethod' ,  form =&gt; 'myform' &amp;amp;&gt;"&gt;Action&amp;lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;

ne fonctionne pas sur tout les navigateurs. Il vous faut ecrire ca:

&lt;ol&gt;&lt;li&gt;..... form =&gt; '\'myform\'' .....&lt;/li&gt;&lt;/ol&gt;C'est tout pour aujourd'hui.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-4855903076087288318?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/4855903076087288318/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=4855903076087288318' title='1 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/4855903076087288318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/4855903076087288318'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/11/ajax-et-mason.html' title='Ajax et mason'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-3471480566830311059</id><published>2007-11-28T21:50:00.001Z</published><updated>2007-11-28T21:50:47.582Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='web2.0'/><category scheme='http://www.blogger.com/atom/ns#' term='facebook'/><category scheme='http://www.blogger.com/atom/ns#' term='i18n'/><title type='text'>Facebook sur la voie de l'internationalisation ?</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Pour l'instant, ce n'est pas encore &lt;a href='http://facebook.com'&gt;facebook&lt;/a&gt; lui même, mais l'application FunWall (&lt;a href='http://slide.com'&gt;slide.com&lt;/a&gt;).&lt;br/&gt;&lt;br/&gt;On voit apparaitre ça et la quelques mots en français, comme '&lt;em&gt;choose an image in mes fichiers&lt;/em&gt;'.&lt;br/&gt;&lt;br/&gt;Je ne sais pas ce que vous en pensez, mais facebook en langue locale, personnellement ça va me faire bizarre. Comment fera-t-on pour comprendre les blagues de nos amis d'autres pays ? Tiens, je vais créer un groupe 'keep facebook english' !!&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p class='poweredbyperformancing'&gt;Powered by &lt;a href='http://scribefire.com/'&gt;ScribeFire&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-3471480566830311059?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/3471480566830311059/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=3471480566830311059' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/3471480566830311059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/3471480566830311059'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/11/facebook-sur-la-voie-de-l.html' title='Facebook sur la voie de l&amp;#39;internationalisation ?'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-1289366654134696880</id><published>2007-11-28T11:20:00.001Z</published><updated>2007-11-28T11:20:13.873Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='snippet'/><category scheme='http://www.blogger.com/atom/ns#' term='quick'/><category scheme='http://www.blogger.com/atom/ns#' term='dirty'/><category scheme='http://www.blogger.com/atom/ns#' term='cryptage'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Quick and dirty encryptage et decryptage</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;Une fois n'est pas coutume, un peu de code pour encrypter/decrypter des chaines simples rapidement.&lt;br/&gt;&lt;br/&gt;&lt;ol&gt;&lt;li&gt;sub simplecrypt{&lt;/li&gt;&lt;li&gt;    my ($string , $key ) = @_ ;&lt;/li&gt;&lt;li&gt;    my $mask = substr($key x length($string), 0 , length($string)) ;&lt;/li&gt;&lt;li&gt;    my $crypt = $string ^ $mask ;&lt;/li&gt;&lt;li&gt;    return unpack("H*" , $string ^ $mask );&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;li&gt;sub simpledecrypt{&lt;/li&gt;&lt;li&gt;    my ($string , $key ) = @_ ;&lt;/li&gt;&lt;li&gt;    my $crypted = pack("H*", $string );&lt;/li&gt;&lt;li&gt;    my $mask = substr($key x length($crypted) , 0 , length($crypted));&lt;/li&gt;&lt;li&gt;    return $crypted ^ $mask ;&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;/ol&gt;Avantage: vraiment simple (base sur un XOR) et surtout independant de tout module supplementaire.&lt;br/&gt;&lt;br/&gt;Inconvenient: vraiment trop simple. Le codage XOR n'est pas vraiment connu pour sa securite, impossible d'encrypter des chaines unicode.&lt;br/&gt;&lt;br/&gt;Conclusion: A utiliser pour des cryptages de base d'identifiants non confidentiels. Par exemple, si vous faite des urls comme celle ci:&lt;br/&gt;&lt;br/&gt;&lt;ol&gt;&lt;li&gt;http://www.myserver/article/77.html&lt;/li&gt;&lt;/ol&gt;et que vous ne voulez pas que vos visiteurs puissent essayer 76, 75 ...&lt;br/&gt;&lt;br/&gt;Vous pouvez encrypter le numero avec cette methode.&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-1289366654134696880?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/1289366654134696880/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=1289366654134696880' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/1289366654134696880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/1289366654134696880'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/11/quick-and-dirty-encryptage-et.html' title='Quick and dirty encryptage et decryptage'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-4774783366579703026</id><published>2007-11-07T00:43:00.001Z</published><updated>2007-11-07T00:43:43.591Z</updated><title type='text'>On demande un développeur mason sur paris</title><content type='html'>&lt;div xmlns='http://www.w3.org/1999/xhtml'&gt;C'est assez rare pour le signaler: la société &lt;a href='http://www.apartia.fr'&gt;apartia&lt;/a&gt; cherche un développeur mason pour bosser sur un gros projet déjà installé chez un client.&lt;br/&gt;&lt;br/&gt;Une petite citation de l'annonce parue:&lt;br/&gt;&lt;br/&gt;==============================================&lt;br/&gt;I know this is not a jobs list but after seeing the "UK Developers" it&lt;br/&gt;seemed not entirely out of place to say: I am looking for a Mason&lt;br/&gt;developer in Paris (France) to work on a large modular application&lt;br/&gt;already in production at a client's. Pay is good (ie: comensurate with&lt;br/&gt;the rarity of Mason devs). Please contact me at &lt;a href='mailto:ldm@apartia.fr'&gt;ldm@apartia.fr&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Cheers and hail HTML::Mason&lt;br/&gt;=============================================&lt;br/&gt;&lt;br/&gt;Si vous êtes dans le coin et que mason n'a plus de secrets pour vous, profitez en !&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p class='poweredbyperformancing'&gt;Powered by &lt;a href='http://scribefire.com/'&gt;ScribeFire&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-4774783366579703026?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/4774783366579703026/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=4774783366579703026' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/4774783366579703026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/4774783366579703026'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/11/on-demande-un-dveloppeur-mason-sur.html' title='On demande un développeur mason sur paris'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-6437180085155591075</id><published>2007-10-15T21:18:00.000+01:00</published><updated>2007-10-15T21:30:08.959+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='news'/><category scheme='http://www.blogger.com/atom/ns#' term='bookmarking'/><title type='text'>Du nouveau chez addthis</title><content type='html'>Après 2 ou 3 semaines d'interruption de service, l'interface de &lt;a href="http://www.addthis.com/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;addthis&lt;/span&gt;&lt;/a&gt; est de nouveau fonctionnelle avec son lot de nouveautés. &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;Parmi&lt;/span&gt; celles-ci, l'ajout facile du &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;widget&lt;/span&gt; de &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;bookmarking&lt;/span&gt; au bas de chaque &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;post&lt;/span&gt;. Bon social &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;bookmarking&lt;/span&gt; !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-6437180085155591075?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/6437180085155591075/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=6437180085155591075' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/6437180085155591075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/6437180085155591075'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/10/du-nouveau-chez-addthis.html' title='Du nouveau chez addthis'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-8884420701146156401</id><published>2007-10-15T14:23:00.000+01:00</published><updated>2007-10-15T14:40:10.467+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='astuce'/><category scheme='http://www.blogger.com/atom/ns#' term='mason'/><category scheme='http://www.blogger.com/atom/ns#' term='binaire'/><title type='text'>Servir du contenu binaire</title><content type='html'>Voici comment servir du contenu binaire avec mason (en mode download):

&lt;ol&gt;&lt;li&gt;%#  file.html
&lt;/li&gt;&lt;li&gt;&amp;lt;%init&gt;&lt;/li&gt;&lt;li&gt;use Apache2::Const qw(OK);&lt;/li&gt;&lt;li&gt;my $content = ... ; # Votre contenu binaire&lt;/li&gt;&lt;li&gt;my $mimeType = 'application/pdf' ; # par exemple&lt;/li&gt;&lt;li&gt;my $fileName   = 'rapport.pdf' ;&lt;/li&gt;&lt;li&gt;$m-&gt;clear_buffer; # On vide le buffer de tout contenu precedant&lt;/li&gt;&lt;li&gt;$r-&gt;content_type($mimeType) ; # Reglage du type mime&lt;/li&gt;&lt;li&gt;$r-&gt;headers_out-&gt;add('Content-Disposition' =&gt; "attachment; filename=$fileName");&lt;/li&gt;&lt;li&gt;# Nom du fichier&lt;/li&gt;&lt;li&gt;binmode STDOUT ;  #Sortie purement binaire&lt;/li&gt;&lt;li&gt;print STDOUT $content; # Les donnee&lt;/li&gt;&lt;li&gt;$m-&gt;abort(OK); # C'est fini&lt;/li&gt;&lt;li&gt;&amp;lt;/%init&gt;&lt;/li&gt;&lt;/ol&gt;
Pour afficher le contenu binaire en ligne (par exemple dans le cas d'une image, ou pour provoquer l'affichage d'un pdf par le plugin du navigateur), il suffit de supprimer la ligne 9.

Si ca perturbe vos visiteurs d'avoir une ressource en .html qui sert un pdf, vous pouvez toujours appeller votre fichier &lt;span style="font-style: italic;"&gt;file.pdf&lt;/span&gt; , et ajouter la chose suivante dans la conf d'apache :

&lt;ol&gt;&lt;li&gt;&amp;lt;LocationMatch "/file.pdf$"&gt;&lt;/li&gt;&lt;li&gt;  SetHandler   perl-script&lt;/li&gt;&lt;li&gt;  PerlHandler  HTML::Mason::ApacheHandler&lt;/li&gt;&lt;li&gt;&amp;lt;/LocationMatch&gt;&lt;/li&gt;&lt;/ol&gt;On spécifie ainsi a apache qu'il doit laisser &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;mason&lt;/span&gt; s'occuper de la ressource.

C'est tout pour aujourd'hui ! Voir la &lt;a href="http://www.iana.org/assignments/media-types/"&gt;liste des types mime&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-8884420701146156401?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/8884420701146156401/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=8884420701146156401' title='2 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/8884420701146156401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/8884420701146156401'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/10/servir-du-contenu-binaire.html' title='Servir du contenu binaire'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-3685605550196999844</id><published>2007-10-12T17:13:00.000+01:00</published><updated>2007-10-12T17:23:57.478+01:00</updated><title type='text'>Faire un widget pour blogger</title><content type='html'>Sur l'aide de blogger, on trouve une &lt;a href="http://help.blogger.com/bin/answer.py?answer=53219&amp;amp;topic=10274"&gt;documentation&lt;/a&gt; &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;très&lt;/span&gt; bien &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;conçue&lt;/span&gt; qui explique &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;ça&lt;/span&gt; &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;très&lt;/span&gt; bien. On peut mettre ce qu'on veut dans le code du &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;widget&lt;/span&gt;. De &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;l'html&lt;/span&gt; bien sur, et surtout du javascript pour rendre un contenu dynamiquement. C'est le cas des &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;widgets&lt;/span&gt; offres d'emploi de ce blog ! (en bas de page).

Pour avoir les &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_7"&gt;vôtres&lt;/span&gt;, c'est par &lt;a href="http://www.optioncarriere.com/partners/searchbox.html"&gt;ici&lt;/a&gt; !&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-3685605550196999844?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/3685605550196999844/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=3685605550196999844' title='3 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/3685605550196999844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/3685605550196999844'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/10/faire-un-widget-pour-blogger.html' title='Faire un widget pour blogger'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-4085061379502453131</id><published>2007-10-02T13:53:00.000+01:00</published><updated>2007-10-09T22:04:48.684+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='generalite'/><category scheme='http://www.blogger.com/atom/ns#' term='mason'/><category scheme='http://www.blogger.com/atom/ns#' term='heritage'/><category scheme='http://www.blogger.com/atom/ns#' term='page'/><category scheme='http://www.blogger.com/atom/ns#' term='composant'/><title type='text'>Composition de page par heritage</title><content type='html'>La dernière fois, nous avons abordé la &lt;a href="http://perlmason.blogspot.com/2007/09/pages-et-composants-mason.html"&gt;composition de page par aggrégation de composants&lt;/a&gt;. Ce type de composition est particulierement bien adapté aux composants fonctionnels. Par exemple, une page d'accueil peut être composée des composants "Dernieres news", "Utilisateurs en lignes", "Bloc de publicite", "Edito", "Boite de connexion". Chacun de ces composants apporte une fonctionnalité a la page.

Aujourd'hui, je vous propose d'aborder la mise en place d'un layout de page cohérent pour toutes les pages de votre site. Le problème: pouvoir ajouter facilement une page a votre site en gardant le layout general. La solution: utiliser la notion d'heritage de mason pour factoriser le layout global de votre site.

&lt;span style="font-weight: bold;"&gt;L'héritage en mason.&lt;/span&gt;

Mason permet de définir une chaine d'héritage entre composants. Le &lt;span style="font-weight: bold;"&gt;composant terminal&lt;/span&gt; de cette chaîne d'héritage doit être &lt;a href="http://perlmason.blogspot.com/2007/09/pages-et-composants-mason.html"&gt;&lt;span style="font-weight: bold;"&gt;une page&lt;/span&gt;&lt;/a&gt;. En fait, la notion d'héritage en mason est un peu éloignée de la notion d'héritage classique que l'on connait dans les langages objets. Pour faire simple, il faudrait plutôt parler d'auto inclusion inversée automatique. Pour être plus clair, prenons un exemple basique: traditionnellement, une page est composée d'un layout global (incluant le header et le footer) et d'un contenu utile. Dans un système à base d'inclusion, on écrierait une page comme ceci:

&lt;ol&gt;&lt;li&gt;INCLUDE header&lt;/li&gt;&lt;li&gt;Contenu  utile&lt;/li&gt;&lt;li&gt;INCLUDE footer&lt;/li&gt;&lt;/ol&gt;
Avec les fichiers (ou les scripts) header et footer écrits de façon séparée. Cette approche est possible en mason, mais elle n'est pas optimale. En mason, on fait un composant "de base" contenant le layout global de toutes les pages:

&lt;ol&gt;&lt;li&gt;%# layout.mas&lt;/li&gt;&lt;li&gt;&amp;lt;html&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;head&gt;&lt;/li&gt;&lt;li&gt;...&lt;/li&gt;&lt;li&gt;&amp;lt;/head&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;body&gt;&lt;/li&gt;&lt;li&gt;...
&lt;/li&gt;&lt;li&gt;% $m-&gt;call_next()&lt;/li&gt;&lt;li&gt;...
&lt;/li&gt;&lt;li&gt;&amp;lt;/body&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/html&gt;&lt;/li&gt;&lt;/ol&gt;
A la ligne 8, le &lt;span style="font-style: italic;"&gt;$m-&gt;call_next()&lt;/span&gt; permet à mason de continuer dans la chaine d'héritage. Lorsqu'on fait une nouvelle page, il suffit de préciser qu'elle hérite de &lt;span style="font-style: italic;"&gt;layout.mas&lt;/span&gt; pour que son rendu inclue automatiquement le layout:

&lt;ol&gt;&lt;li&gt;%# page.html&lt;/li&gt;&lt;li&gt;&amp;lt;flags&gt;&lt;/li&gt;&lt;li&gt; inherit =&gt; '/layout.mas'&lt;/li&gt;&lt;li&gt;&amp;lt;/flags&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;p&gt;&lt;/li&gt;&lt;li&gt;Contenu&lt;/li&gt;&lt;li&gt;&amp;lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;
Lorsqu'on interroge l'url &lt;span style="font-style: italic;"&gt;http://yourserver/page.html&lt;/span&gt; , mason va automatiquement inclure le contenu de page.html dans le layout de &lt;span style="font-style: italic;"&gt;layout.mas&lt;/span&gt;. En ligne 3, on spécifie de quel composant hérite la page. Par défaut, mason assume que toutes les pages héritent d'un composant particulier: &lt;span style="font-weight: bold;"&gt;autohandler&lt;/span&gt; . C'est donc plutôt dans un composant nommé &lt;span style="font-weight: bold;"&gt;autohandler&lt;/span&gt; qu'on va définir le layout global de la page plutôt que dans un layout.mas. De cette façon, on n'a pas besoin de spécifier de quel composant héritent nos pages:

&lt;ol&gt;&lt;li&gt;%# autohandler
&lt;/li&gt;&lt;li&gt;&amp;lt;html&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;head&gt;&lt;/li&gt;&lt;li&gt;...&lt;/li&gt;&lt;li&gt;&amp;lt;/head&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;body&gt;&lt;/li&gt;&lt;li&gt;...
&lt;/li&gt;&lt;li&gt;% $m-&gt;call_next()&lt;/li&gt;&lt;li&gt;...
&lt;/li&gt;&lt;li&gt;&amp;lt;/body&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/html&gt;&lt;/li&gt;&lt;/ol&gt; Ensuite, plus besoin de spéficier l'héritage:
&lt;ol&gt;&lt;li&gt;%# page.html&lt;/li&gt;&lt;li&gt;&amp;lt;p&gt;&lt;/li&gt;&lt;li&gt;Contenu&lt;/li&gt;&lt;li&gt;&amp;lt;/p&gt;&lt;/li&gt;&lt;/ol&gt; On voit que de cette manière, ajouter une page qui hérite du &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;layout&lt;/span&gt; global est facile. Il suffit de faire une page avec le contenu utile, et elle héritera automatiquement du composant &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;autohandler&lt;/span&gt;.

La prochaine fois, je vous parlerai des méthodes et de leur comportement dans la chaîne d'héritage.

Référence : &lt;a href="http://www.masonbook.com/book/chapter-1.mhtml#TOC-ANCHOR-4"&gt;l'héritage dans le mason book&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-4085061379502453131?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/4085061379502453131/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=4085061379502453131' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/4085061379502453131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/4085061379502453131'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/10/composition-de-page-par-heritage.html' title='Composition de page par heritage'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-6596158468028689532</id><published>2007-09-29T09:33:00.000+01:00</published><updated>2007-09-30T11:12:03.214+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='internationalisation'/><category scheme='http://www.blogger.com/atom/ns#' term='generalite'/><category scheme='http://www.blogger.com/atom/ns#' term='unicode'/><category scheme='http://www.blogger.com/atom/ns#' term='i18n'/><title type='text'>Internationalisation, i18n, unicode et utf8</title><content type='html'>Aujourd'hui c'est le week end et j'oublie un peu le code. J'ai donc choisi de vous parler de l'internationalisation et de la saine gestion des caractères exotiques. Ceci afin de pouvoir créer des sites qui acceptent et qui affichent n'importe quel caractère. Vous permettrez ainsi à vos visiteurs suédois, polonais, irakiens, tchèques ou japonais de sentir que votre site à été conçu aussi pour eux. Pour vos tests, vous pouvez vous référer à &lt;a href="http://www.columbia.edu/kermit/utf8.html"&gt;cette page&lt;/a&gt;. Pour clarifier les choses, commençons par quelques définitions.
&lt;p&gt;
&lt;span style="font-weight: bold;"&gt;Unicode&lt;/span&gt; définit de manière globale ce qu'est un caractère. Unicode définit un numéro, appellé codepoint pour chaque caractère possible sur la planète terre. Vous pouvez voir la liste de ces caractères &lt;a href="http://www.utf8-chartable.de/"&gt;ici&lt;/a&gt;. Par exemple le caractère 'k' est au codepoint 'U+006B' . Le caractère khmer 'dap roc' est situé au codepoint 'U+19FA' . Unicode est donc une manière globale de traiter les caractères de manière abstraite. Depuis perl 5.8, perl est compatible avec unicode. Ainsi pour faire faire une chaine composée des deux caractères cités en exemple, on peut utiliser la notation suivante:
&lt;/p&gt;

&lt;ol&gt;&lt;li&gt;my $kkhmer = "\x{006B}\x{19FA}"&lt;/li&gt;&lt;/ol&gt;C'est d'ailleurs un moyen pour écrire du &lt;a href="http://en.wikipedia.org/wiki/Obfuscated_code"&gt;code "obsfuscated"&lt;/a&gt;. Cette chaine kkhmer est donc de longueur 2 en perl. Il existe aussi un moyen d'écrire des caractères unicode sous forme d'entités html: &amp;006B;&amp;19FA; . Le module &lt;a href="http://search.cpan.org/perldoc?HTML::Entities"&gt;HTML::Entities&lt;/a&gt; vous permet d'automatiser cette transformation, et &lt;a href="http://perlmason.blogspot.com/2007/09/echappement-de-code-html-dans-les.html"&gt;mason fournit un mécanisme&lt;/a&gt; pour la faire automatiquement.

&lt;p&gt;
&lt;span style="font-weight: bold;"&gt;UTF-8&lt;/span&gt; est un encodage. C'est donc un moyen de représenter un caractère sous une forme binaire pour le stockage dans un fichier, la transmission à travers un réseau ou le stockage dans une base de données. Contrairement à l'encodage ISO-8859-1 (plus connu sous le nom latin 1), UTF-8 est capable d'encoder tout les caractères unicodes. Sans rentrer dans les détails, utf-8 encode chaque caractère sur 1 ou plusieurs octets. Beaucoup de problèmes d'encodage proviennent de la confusion entre la notion de chaine unicode et de chaine binaire d'octets encodant ces chaines unicodes. Pour reprendre notre exemple, le caractère 'k' est représenté en UTF-8 par l'octet '6B' et le caractère khmer est représenté par les 3 octets 'xE1xA7xBA' .
&lt;/p&gt;
&lt;p&gt;
Beaucoup de confusions proviennent aussi du fait que pour les caractères purement ascii (comme dans le bon vieux temps), le codepoint unicode, l'encodage UTF-8 et l'encodage latin1 sont identiques. C'est pourquoi on ne se rend compte de ce genre de problème que lorsqu'il commence à y avoir des accents dans le système.
&lt;/p&gt;
&lt;span style="font-weight: bold;"&gt;Cas pratique.&lt;/span&gt;
&lt;p&gt;
Après ces quelques clarifications, construire un système compatible avec les caractères internationaux est beaucoup plus facile. Il suffit de cloisonner les responsabilités et d'assurer que la communication entre les composants du système se fait dans le bon encodage. Pour un exemple concret, nous allons prendre 3 &lt;span style="font-weight: bold;"&gt;composants&lt;/span&gt;: le navigateur web, perl (sous apache) et mysql. Pour chacun de ces composants, on va définir (et assurer) trois choses: l'encodage de sortie, l'encodage d'entrée et la représentation interne.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Le navigateur:&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Encodage d'entrée:&lt;/span&gt; Défini à la fois par l'entête HTTP '&lt;span style="font-style: italic;"&gt;Content-Type: text/html; charset=UTF-8&lt;/span&gt;' et éventuellement par la balise méta HTML : &lt;span style="font-style: italic;"&gt;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;/span&gt; . Chaque navigateur à un comportement spécifique lorsque ces deux informations ne sont pas identiques. Assurez vous donc qu'elle le sont. Ajoutez la directive &lt;span style="font-style: italic;"&gt;AddDefaultCharset      UTF-8&lt;/span&gt; Dans votre config d'apache.
&lt;/li&gt;
&lt;li&gt;
&lt;span style="font-weight: bold;"&gt;   Encodage de sortie&lt;/span&gt; (POST de formulaire ou GET vers le serveur): par défaut c'est le même que l'encodage d'entrée. Il est cependant bon de le spécifier dans chaque formulaire, au cas ou des utilisateurs changerais l'encodage de la page avant d'envoyer leurs informations. Dans chaque formulaire, ajoutez simplement l'attribut &lt;span style="font-style: italic;"&gt;accept-charset="UTF-8"&lt;/span&gt; .
&lt;/li&gt;
&lt;li&gt;
&lt;span style="font-weight: bold;"&gt;    Encodage interne:&lt;/span&gt; Normalement, on n'a pas à connaître cette information. Chaque système à fait un choix. L'important c'est que le système puisse traiter des chaines unicode. C'est le cas des navigateurs et de javascript.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="font-weight: bold;"&gt; Perl:&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;span style="font-weight: bold;"&gt;   Encodage d'entrée (web):&lt;/span&gt; Par défaut rien n'est défini. C'est donc des chaines binaires que vous récupérez. Si vous faite du cgi, spécifiez l'encodage au niveau de l'objet $c avec &lt;span style="font-style: italic;"&gt;$c-&gt;charset('utf-8')&lt;/span&gt;. Les appels à &lt;span style="font-style: italic;"&gt;$c-&gt;param()&lt;/span&gt; vous donnerons des chaines perl correctes (unicode). En mason, le problème est identique. J'utilise personnellement la fonction &lt;span style="font-style: italic;"&gt;Encode::decode_utf8&lt;/span&gt; sur chaque paramêtre que je sais pouvoir être du texte libre.
&lt;/li&gt;
&lt;li&gt;
&lt;span style="font-weight: bold;"&gt;Encodage de sortie:&lt;/span&gt; Par défaut perl encode les chaines en latin1 en sortie. On peur modifier ce comportement avec '&lt;span style="font-style: italic;"&gt;binmode STDOUT  , ':utf8&lt;/span&gt;' en CGI. En mason, on peut ajouter un filtre à la sortie en ajoutant la directive suivante dans apache: &lt;span style="font-style: italic;"&gt;PerlAddVar MasonOutMethod "sub{ binmode STDOUT , ':utf8' ; print @_ ;}"&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="font-weight: bold;"&gt;Encodage interne:&lt;/span&gt; Comme je l'ai dit précédemment, on ne devrait pas connaitre cette information. Cependant en perl, les chaines unicode internes sont encodées en UTF-8. C'est aussi une source de confusion, puisque ça amène a penser qu'on peut outputer directement une chaine interne. Ce n'est pas le cas (voir point précédent).
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;
&lt;span style="font-weight: bold;"&gt;MySQL:&lt;/span&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;span style="font-weight: bold;"&gt;Encodage d'entrée:&lt;/span&gt; Aucun. En utilisation avec perl, ce n'est pas génant, étant donné que les chaines internes sont représentées en UTF-8. Lorsqu'on fait un insert ou un update avec le driver MySQL, c'est donc des octets UTF-8 qui sont envoyés et stockés par MySQL.
&lt;/li&gt;
&lt;li&gt;
&lt;span style="font-weight: bold;"&gt;Encodage de sortie:&lt;/span&gt; Aucun. C'est donc des octets qu'on obtient par défault lorsqu'on fait un select avec le driver standard. Pour eviter de les décoder à chaque fois et pour obtenir des vraies chaines perl UTF-8, j'ai écrit &lt;a href="http://jerome.eteve.free.fr/spip.php?article28"&gt;un patch&lt;/a&gt; pour le driver disponible ici. Ce patch a été inclu dans la version officielle du &lt;a href="http://search.cpan.org/%7Ecapttofu/DBD-mysql-4.005/lib/DBD/mysql.pm"&gt;driver&lt;/a&gt; à titre expérimental. Activez le décodage UTF-8 automatique comme ceci: &lt;span style="font-style: italic;"&gt;$dbh-&gt;{'mysql_enable_utf8} = 1&lt;/span&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;span style="font-weight: bold;"&gt;Conclusion:&lt;/span&gt;
&lt;p&gt;
Grace à ces quelques techniques, vous êtes maintenant en mesure de construire un site compatible avec tout les caractères de la planète. Dans notre cas pratique, on voit que les choses sont nettes concernant le navigateur et perl. MySQL doit certainement être encore amélioré sur ce point. Pour d'autres bases de données, les choses sont plus claires. Par exemple en Postgresql, si on déclare une colonne comme UTF-8, la communication avec perl à travers le driver se fait de manière transparente.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-6596158468028689532?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/6596158468028689532/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=6596158468028689532' title='1 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/6596158468028689532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/6596158468028689532'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/09/internationalisation-i18n-unicode-et.html' title='Internationalisation, i18n, unicode et utf8'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-8412814294412081498</id><published>2007-09-28T12:04:00.001+01:00</published><updated>2007-09-28T19:27:29.945+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='astuce'/><category scheme='http://www.blogger.com/atom/ns#' term='makefile'/><title type='text'>Makefile: Modifier une variable pour une cible specifique</title><content type='html'>&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;Pour modifier une variable pour une cible specifique, on utilise la forme suivante:

&lt;ol&gt;&lt;li&gt;cible: &amp;lt;assignement&gt;&lt;/li&gt;&lt;li&gt;cible: dependance&lt;/li&gt;&lt;li&gt;         etc..&lt;/li&gt;&lt;/ol&gt;
Par exemple:

&lt;ol&gt;&lt;li&gt;prog : CFLAGS = -g&lt;/li&gt;&lt;li&gt;prog : prog.o foo.o bar.o&lt;/li&gt;&lt;/ol&gt;Dans ce cas, la valeur de CFLAGS sera -g dans le contexte des dependances de prog.

&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-8412814294412081498?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/8412814294412081498/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=8412814294412081498' title='3 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/8412814294412081498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/8412814294412081498'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/09/makefile-modifier-une-variable-pour-une_28.html' title='Makefile: Modifier une variable pour une cible specifique'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-2713623006882813721</id><published>2007-09-27T15:09:00.000+01:00</published><updated>2007-09-28T10:08:36.626+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='generalite'/><category scheme='http://www.blogger.com/atom/ns#' term='mason'/><category scheme='http://www.blogger.com/atom/ns#' term='page'/><category scheme='http://www.blogger.com/atom/ns#' term='composant'/><title type='text'>Pages et composants mason</title><content type='html'>En mason, il n'existe pas de difference entre la notion de page et de composant. Une page est simplement un composant qu'on utilise en bout de chaine de traitement mason pour le rendu du code html. Structurellement, un composant est compose d'html, de directives mason, de divers blocs de code perl et eventuellement de methodes et de sous composants.

On nomme generalement les composants qui ne sont pas de pages en &lt;span style="font-weight: bold;"&gt;.mas&lt;/span&gt;. Par exemple, voici un composant qui rend la date courante:

&lt;ol&gt;&lt;li&gt;% # date.mas&lt;/li&gt;&lt;li&gt;%  my $when = gmtime() ;&lt;/li&gt;&lt;li&gt;&amp;lt;p&gt;Page rendue a &amp;lt;% $when %&gt;&amp;lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;On inclut ensuite ce composant dans la page &lt;span style="font-weight: bold;"&gt;index.html&lt;/span&gt; ( voir &lt;a href="http://perlmason.blogspot.com/2007/09/configuration-minimale-avec-apache-et.html"&gt;post précèdent&lt;/a&gt; ) de la façon suivante:

&lt;ol&gt;&lt;li&gt;...&lt;/li&gt;&lt;li&gt;&lt;&amp;amp; /time.mas &amp;amp;&gt;&lt;/li&gt;&lt;li&gt;...&lt;/li&gt;&lt;/ol&gt;

Si vous placez ce composant a la racine du serveur, n'importe qui pourrais recuperer votre code a l'adresse http://www.foobar.com/time.mas . Pour eviter cette situation desagreable,
l'usage preconise de stocker dans deux repertoires distincts les pages proprement dites et les composants qui ne servent jamais directement comme page.

Par exemple, on cree un repertoire &lt;span style="font-weight: bold;"&gt;masoncomp&lt;/span&gt; au meme niveau que htdocs et on ajoute ce repertoire ou mason cherche les composants (dans la conf d'apache):

&lt;ol&gt;&lt;li&gt;PerlAddVar MasonCompRoot "components =&gt; /var/www/masoncomp/"&lt;/li&gt;&lt;/ol&gt;
On peut alors déplacer le composant time.mas de &lt;span style="font-weight: bold;"&gt;htdocs&lt;/span&gt; vers &lt;span style="font-weight: bold;"&gt;masoncomp&lt;/span&gt;. Pour l'inclure, on utilise toujours '/time.mas' . C'est en quelque sorte son adresse dans l'espace des composants mason.

La prochaine fois, je parlerais de composition de page par héritage. En attendant, vous pouvez trouver plus d'information sur les composants &lt;a href="http://www.masonbook.com/book/chapter-2.mhtml"&gt;ici&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-2713623006882813721?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/2713623006882813721/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=2713623006882813721' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/2713623006882813721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/2713623006882813721'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/09/pages-et-composants-mason.html' title='Pages et composants mason'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-8032699402353858880</id><published>2007-09-26T12:01:00.000+01:00</published><updated>2007-09-26T12:08:11.413+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='astuce'/><category scheme='http://www.blogger.com/atom/ns#' term='scan'/><category scheme='http://www.blogger.com/atom/ns#' term='texte'/><category scheme='http://www.blogger.com/atom/ns#' term='perl'/><title type='text'>Text::Scan et fin de fichier</title><content type='html'>Si vous utilisez &lt;a href="http://search.cpan.org/%7Etbusch/Text-Scan-0.29/"&gt;Text::Scan&lt;/a&gt; pour scanner  des documents contre un dictionnaire et que votre document provient d'un fichier, il faut faire un chomp de $document. En effet Text::Scan considère que la fin de chaîne est l'octet x00  et non pas l'octet x0A qui est la fin de fichier texte.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-8032699402353858880?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/8032699402353858880/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=8032699402353858880' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/8032699402353858880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/8032699402353858880'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/09/textscan-et-fin-de-fichier.html' title='Text::Scan et fin de fichier'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-7301327761038365709</id><published>2007-09-25T19:12:00.000+01:00</published><updated>2007-09-26T17:56:09.862+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='astuce'/><category scheme='http://www.blogger.com/atom/ns#' term='mason'/><category scheme='http://www.blogger.com/atom/ns#' term='echappement'/><category scheme='http://www.blogger.com/atom/ns#' term='html'/><title type='text'>Echappement de code html dans les expressions</title><content type='html'>En general, on utilise la balise &lt;span style="font-weight: bold;"&gt;&amp;lt;%&lt;/span&gt; &lt;span style="font-style: italic;"&gt;$expression&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; %&gt;&lt;/span&gt; pour afficher une valeur provenant d'une entrée utilisateur, ou bien d'une base de donnée. Si la valeur de &lt;span style="font-style: italic;"&gt;$expression&lt;/span&gt; contient du code html, cela peut casser votre mise en page ou pire introduire une &lt;a href="http://fr.wikipedia.org/wiki/Cross_site_scripting"&gt;faille de sécurité XSS&lt;/a&gt;. Pour éviter cela, on peut utiliser le module perl &lt;a href="http://search.cpan.org/%7Egaas/HTML-Parser-3.56/lib/HTML/Entities.pm"&gt;HTML::Entities&lt;/a&gt; (fonction encode) pour toute les expressions affichées dans la page. Mason offre un mécanisme plus simple pour éviter cette situation.

Si vous réglez la variable suivante dans votre config d'apache:

&lt;ol&gt;&lt;li&gt;PerlAddVar MasonDefaultEscapeFlags h&lt;/li&gt;&lt;/ol&gt;Mason protégera tout les caractères nécessaires dans vos expressions en les remplaçant par des entités html.

Je vous conseille aussi de regler ce flag d'echappement (h) pour qu'il provoque seulement l'echappement des caracteres purement html. De cette facon, votre code fonctionnera avec tout les character set:
&lt;ol&gt;&lt;li&gt;PerlSetVar  MasonEscapeFlags  "h =&gt; \&amp;amp;HTML::Mason::Escapes::basic_html_escape"&lt;/li&gt;&lt;/ol&gt;
Plus d'infos &lt;a href="http://www.masonhq.com/docs/manual/Devel.html#filtering"&gt;ici&lt;/a&gt; (en anglais)

Je reviendrais sur les problèmes d'encoding dans un prochain post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-7301327761038365709?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/7301327761038365709/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=7301327761038365709' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/7301327761038365709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/7301327761038365709'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/09/echappement-de-code-html-dans-les.html' title='Echappement de code html dans les expressions'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-8968454153723744394</id><published>2007-09-25T17:36:00.001+01:00</published><updated>2007-09-25T17:41:17.869+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='blogger'/><category scheme='http://www.blogger.com/atom/ns#' term='astuce'/><category scheme='http://www.blogger.com/atom/ns#' term='rien a voir'/><title type='text'>Afficher du code dans blogger</title><content type='html'>Une astuce pour afficher du code dans blogger sans (trop) se faire mal au cerveau.

&lt;ul&gt;&lt;li&gt;Pour vos lignes de codes, utilisez le format liste &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;numérotée&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;Ajoutez un morceau de &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;css&lt;/span&gt; dans votre &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;template&lt;/span&gt; pour les afficher&lt;/li&gt;&lt;/ul&gt;&lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;Ça&lt;/span&gt; donne &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_4"&gt;ça&lt;/span&gt;:

&lt;ol&gt;&lt;li&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;post&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;ol&lt;/span&gt;{&lt;/li&gt;&lt;li&gt;  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;white-space&lt;/span&gt;: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;pre&lt;/span&gt; ;&lt;/li&gt;&lt;li&gt;  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;font-family&lt;/span&gt;: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;courier&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;margin&lt;/span&gt;: 0px;&lt;/li&gt;&lt;li&gt;  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;margin-top&lt;/span&gt;: 5px;&lt;/li&gt;&lt;li&gt;  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;margin-bottom&lt;/span&gt;: 5px;&lt;/li&gt;&lt;li&gt;  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;padding&lt;/span&gt;: 10px;&lt;/li&gt;&lt;li&gt;  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;background-color&lt;/span&gt;: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;lightgray&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;  &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;line-height&lt;/span&gt;: 1&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;em&lt;/span&gt;;&lt;/li&gt;&lt;li&gt;}&lt;/li&gt;&lt;/ol&gt;Avantage: les lignes sont &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_19"&gt;numérotées&lt;/span&gt; et on peut s'y &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_20"&gt;référer&lt;/span&gt; facilement.
&lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_21"&gt;Inconvénient&lt;/span&gt;: On perd l'usage des listes &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_22"&gt;numérotées&lt;/span&gt; (franchement, c'est important ?)

&lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_23"&gt;Ça&lt;/span&gt; ne &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_24"&gt;résout&lt;/span&gt; cependant pas un &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_25"&gt;problème&lt;/span&gt;, c'est &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;l'affichage&lt;/span&gt; des &amp;amp;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;lt&lt;/span&gt;; qu'on est oblige d'encoder a la main en &amp;amp;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;amp&lt;/span&gt;;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;lt&lt;/span&gt;; .&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-8968454153723744394?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/8968454153723744394/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=8968454153723744394' title='1 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/8968454153723744394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/8968454153723744394'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/09/afficher-du-code-dans-blogger.html' title='Afficher du code dans blogger'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-3409956129378044144</id><published>2007-09-25T16:15:00.000+01:00</published><updated>2007-09-25T17:18:55.597+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='generalite'/><category scheme='http://www.blogger.com/atom/ns#' term='configuration'/><category scheme='http://www.blogger.com/atom/ns#' term='page'/><title type='text'>Configuration minimale et test avec apache et mod_perl</title><content type='html'>Une fois &lt;span style="font-weight: bold;"&gt;apache2&lt;/span&gt; installé, ainsi que &lt;span style="font-weight: bold;"&gt;mod_perl2&lt;/span&gt; et &lt;span style="font-weight: bold;"&gt;apreq2&lt;/span&gt; installes, vous devriez
avoir dans vos fichiers de conf apache les éléments suivants:
&lt;ol&gt;&lt;li&gt;LoadModule perl_module modules/mod_perl.so&lt;/li&gt;&lt;li&gt;LoadModule apreq_module  /usr/lib/httpd/modules/mod_apreq2.so&lt;/li&gt;&lt;/ol&gt;Voyez les liens de references pour l'installation de ces composants.

Assurez vous que apache démarre correctement avec ces modules.

L'installation de mason se fait de maniere tout a fait classique via cpan. En root, lancez &lt;span style="font-weight: bold;"&gt;cpan -i HTML::Mason&lt;/span&gt; .

On peut maintenant passer a la configuration de mason proprement dite dans apache.

On charge tout d'abord le handler mason. C'est un handler mod_perl inclu dans mason configurew pour fonctionner comme point d'entree de votre application. On peut noter que l'utilisation de mason ne necessiste aucune connaissance en mod_perl (a part son installation). Toujours dans apache donc:
&lt;ol&gt;&lt;li&gt;# Load mason&lt;/li&gt;&lt;li&gt;PerlModule HTML::Mason::ApacheHandler&lt;/li&gt;&lt;/ol&gt;Ensuite, on doit specifier a mason ou il va trouver les pages a rendre:
&lt;ol&gt;&lt;li&gt;PerlAddVar MasonCompRoot "main =&gt; /var/www/htdocs/"&lt;/li&gt;&lt;/ol&gt;Je vous conseille de régler cette variable a la meme valeur que le &lt;span style="font-weight: bold;"&gt;DocumentRoot&lt;/span&gt; de apache pour éviter les confusions.

Ensuite, on doit choisir quelles ressources vont etre servies a travers mason. Ceci se fait logiquement au niveau de l'espace des urls. Pour faire simple, nous allons choisir une extension de fichier qui sera toujours servie a travers mason.
On peut choisir &lt;span style="font-weight: bold;"&gt;.html&lt;/span&gt; pour rester classique, &lt;span style="font-weight: bold;"&gt;.mas&lt;/span&gt; si vous voulez montrer que vous utilisez mason, &lt;span style="font-weight: bold;"&gt;.php&lt;/span&gt; pour faire comme tout le monde, &lt;span style="font-weight: bold;"&gt;.jsp&lt;/span&gt; pour vendre le produit plus cher ou &lt;span style="font-weight: bold;"&gt;.axa&lt;/span&gt; si vous bossez pour axa.

Ici par exemple, on choisi de servir toute les ressources .html au travers de mason:

&lt;ol&gt;&lt;li&gt;# Let mason handle html files&lt;/li&gt;&lt;li&gt;&amp;lt;locationmatch&gt;&lt;/li&gt;&lt;li&gt;  SetHandler   perl-script&lt;/li&gt;&lt;li&gt;  PerlHandler  HTML::Mason::ApacheHandler&lt;/li&gt;&lt;li&gt;&amp;lt;/locationmatch&gt;&lt;/li&gt;&lt;/ol&gt;Ceci nous laisse la possibilité de faire des pages .htm qui seront elles vraiment statiques si besoin est.

Votre première page mason est maintenant a portée de main. Creez un fichier index.html dans votre DocumentRoot, et admirez le resultat.

&lt;ol&gt;&lt;li&gt;&amp;lt;html&gt;&lt;/li&gt;&lt;li&gt;  &amp;lt;head&gt;&amp;lt;body&gt;1 + 1 = &amp;lt;% 1 + 1 %&gt;&amp;lt;/body&gt;&lt;/li&gt;&lt;li&gt;&amp;lt;/html&gt;&lt;/li&gt;&lt;/ol&gt;
Comme vous l'aurez note , la balise &lt;span style="font-weight: bold;"&gt;&amp;lt;%   %&gt;&lt;/span&gt; provoque l'évaluation et l'affichage de l'expression &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;perl&lt;/span&gt; a l'intérieur. Il y a plusieurs façons d'inclure du code &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;perl&lt;/span&gt; a l'intérieur d'une page &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;mason&lt;/span&gt;. Pour les détails, c'est &lt;a href="http://www.masonhq.com/docs/manual/Devel.html#inline_perl_sections"&gt;par ici&lt;/a&gt;(anglais).

Voila, c'est tout pour ce billet. La prochaine fois je vous parlerais de composition des pages, de composants et d'héritage.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-3409956129378044144?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/3409956129378044144/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=3409956129378044144' title='0 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/3409956129378044144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/3409956129378044144'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/09/configuration-minimale-avec-apache-et.html' title='Configuration minimale et test avec apache et mod_perl'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6406023849649551478.post-4629911411664449828</id><published>2007-09-25T14:35:00.000+01:00</published><updated>2007-09-25T15:23:10.348+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='generalite'/><category scheme='http://www.blogger.com/atom/ns#' term='mason'/><title type='text'>Introduction a mason.</title><content type='html'>Je commence ce blog pour pallier au manque d'informations sur &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;mason&lt;/span&gt; sur le &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;web&lt;/span&gt; français, comme en témoigne &lt;a href="http://www.google.fr/search?q=mason+perl&amp;amp;hl=fr&amp;amp;start=10&amp;amp;sa=N"&gt;cette recherche &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;google&lt;/span&gt;&lt;/a&gt;.

&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;Mason&lt;/span&gt; est a la base un moteur de &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;template&lt;/span&gt; écrit en &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;perl&lt;/span&gt; qui n'a en théorie rien a voir avec le &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;web&lt;/span&gt;. On peut d'ailleurs l'utiliser en dehors d'un environnement &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;web&lt;/span&gt; pour produire des mails ou encore vos fiches de cuisines préférées en &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;postscript&lt;/span&gt; - si on est un vrai &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;geek&lt;/span&gt; .
On peut donc l'utiliser en environnement perl, apache+cgi , ou encore apache+mod_perl .

Au niveau maturite et stabilite, mason n'as rien a envier aux technologies concurrentes; il est utilise pour les pages de &lt;a href="http://www.masonhq.com/?AmazonDotCom"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;amazon&lt;/span&gt;&lt;/a&gt; et pour &lt;a href="http://www.masonhq.com/?MasonPoweredSites"&gt;de nombreux autre sites&lt;/a&gt; a fort trafic.

Sur ce blog je vais donc parler principalement de &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;mason&lt;/span&gt; dans un &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_13"&gt;environnement&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;web&lt;/span&gt;. Le tout sur un mode didactique.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6406023849649551478-4629911411664449828?l=perlmason.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://perlmason.blogspot.com/feeds/4629911411664449828/comments/default' title='Publier les commentaires'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6406023849649551478&amp;postID=4629911411664449828' title='1 commentaires'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/4629911411664449828'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6406023849649551478/posts/default/4629911411664449828'/><link rel='alternate' type='text/html' href='http://perlmason.blogspot.com/2007/09/introduction-mason.html' title='Introduction a mason.'/><author><name>Jerome Eteve</name><uri>http://www.blogger.com/profile/10262102551420196339</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_KUgWQCbhgu8/TQTtfBPEohI/AAAAAAAABTM/JGfI_NTVyio/S220/bender.jpg'/></author><thr:total>1</thr:total></entry></feed>
