Les Partages de Memiks
Tag cloud
Picture wall
Daily
Plugins
  • ► Play Videos
RSS Feed
  • RSS Feed
  • Daily Feed
  • Weekly Feed
  • Monthly Feed
Filters

Links per page

  • 20 links
  • 50 links
  • 100 links

Filters

Untagged links
13 results tagged perl  ✕
Générer un token sécurisé avec String::Random // blog.kharec.info https://blog.kharec.info/post/generer-un-token-securise-avec-string-random/
Mon May 18 15:22:05 2020 archive.org
QRCode
Comments

Je bosse en ce moment sur une petite API pour un usage ludique au bureau (j’expliquerais ce que c’est une prochaine fois), et ça m’a inspiré une courte note sur comment générer un token sécurisé en perl.

Pour générer des chaînes de caractères en perl, il existe l’excellent String::Random. Il combine plusieurs méthodes mais elles peuvent s’avérer pauvres pour générer un token, car celui-ci doit :

être une suite aléatoire de caractères alphanumériques
avoir un pattern dynamique

Avoir un pattern dynamique, ça veut dire que la séquence ne doit pas se répéter même si les caractères sont aléatoires, par exemple:

Majuscule-minuscule-chiffre-minucule...

C’est un pattern statique : les caractères auront beau être aléatoires, la suite restera la même. Ce serait donc mieux si le pattern était également aléatoire.

Pour répondre à cette problématique, j’ai combiné la méthode randpattern à la méthode randregex.

randpattern renvoie une chaîne de caractère définie par un pattern respectant :

c : tout caractère latin en minuscule
C : tout caractère latin en majuscule
n : tout chiffre
. : n’importe lequel des trois précédents

Par exemple :

my $s = String::Random->new();
$s->randpattern("cCn"); # renvoie jR4, sK1, pF3...

Utiliser seulement randpattern revient à utiliser un pattern statique puisqu’écrit en dur.

randregex renvoie une suite de caractère aléatoire qui sont choisis dans la regex donnée en argument. Par exemple :

my $s = String::Random->new();
$s->randregex('\d\w\d{5}'); # renvoie 5Z61258, 8R46964, 6l14705...

Les lettres pouvant être majuscules ou minuscules, c’est presque aléatoire. Mais en combinant les deux ainsi :

my $s = String::Random->new();
$s->randpattern($s->randregex('[CcnCn]{20}'));

J’obtiens donc une suite réelement aléatoire de 20 caractères, puisque pris aléatoirement dans l’ensemble CcnCn, et utilisés ensuite par randpattern pour mixer ce pattern afin de cracher le token voulu :

S5eYwWj30MWXEZ4FmWmr
1BW93BAh9ueCsYIY2js7
vW9ytOPVaG571BK40Ove
J491kSRwn9Wh3ZoRZS9J
0LQoVwF512GR4mcLAZ86

Cela permet des suites aléatoires et dont le pattern est dynamique : par exemple, le premier caractère est parfois un chiffre, parfois une majuscule, parfois une minuscule.

perl token random pattern regex
How to create a Perl Module for code reuse? https://perlmaven.com/how-to-create-a-perl-module-for-code-reuse
Tue Aug 7 16:27:48 2018 archive.org
QRCode
Comments
thumbnail

You may be creating more and more scripts for your systems, which need to use the same functions.

You already mastered the ancient art of copy-paste, but you are not satisfied with the result.

You probably know lots of Perl modules that allow you to use their functions and you also want to create one.

However, you don't know how to create such a module.

perl module lib
Recommended Project Layout http://www.epic-ide.org/guide/ch03s04.php
Tue Aug 7 16:24:45 2018 archive.org
QRCode
Comments
thumbnail

Recommended Project Layout

In order to avoid problems with syntax validation (such as packages reported missing) and the debugger (such as skipped breakpoints), it is best to organize your project according to the conventions of the core Perl distribution:

Keep your own modules in dedicated subtrees of your project. For example, create a subdirectory lib as the root of the subtree containing all *.pm files. Note that you can have more than one such subtree. For example, you could also create test/lib to store modules that are only imported by test scripts.

Add the root directories of your subtrees to the @INC path (see the section called “Perl Include Path”). For example, add the entries lib and test/lib there.

Map package names to paths in the subtree (and vice versa). For example, store code for the package Foo::Bar in file lib/Foo/Bar.pm and ensure that lib/Foo/Baz.pm contains only package Foo::Baz.

Store your Perl scripts anywhere you like in the project. For example, in subdirectory bin or cgi-bin.

To import from a package, use it, rather than require it. For example, use Foo::Bar; rather than require '../lib/Foo/Bar.pm';
perl project module organise
ZM::Template - Merges runtime data with static HTML or Plain Text template file. - metacpan.org https://metacpan.org/pod/ZM::Template
Thu Jul 26 21:26:56 2018 archive.org
QRCode
Comments
thumbnail

In an ideal web system, the HTML used to build a web page would be kept distinct from the application logic populating the web page. This module tries to achieve this by taking over the chore of merging runtime data with a static html template. Template can contain SSI derectives like and It is used ZM::SSI for SSI parsing. If module ZM::SSI not installed SSI derectives will be ignoring.

The ZM::Template module can address the following template scenarios :

Single values assigned to tokens

Multiple values assigned to tokens (as in html table rows)

Single pages built from multiple templates (ie: header, footer, body)

html tables with runtime determined number of columns

An template consists of 2 parts; the boilerplate and the tokens (place holders) where the variable data will sit.

perl html template
How can I compile my Perl script so it can be executed on systems without perl installed? - Stack Overflow https://stackoverflow.com/questions/1237286/how-can-i-compile-my-perl-script-so-it-can-be-executed-on-systems-without-perl-i/1237313
Thu Jul 26 21:08:24 2018 archive.org
QRCode
Comments
thumbnail
  • Install PAR::Packer. Example for *nix:

sudo cpan -i PAR::Packer

  • For Strawberry Perl for Windows or for ActivePerl and MSVC installed:

cpan -i PAR::Packer

  • Pack it with pp. It will create an executable named "example" or "example.exe" on Windows.

pp -o example example.pl

This would work only on the OS where it was built.

cpan perl compile
http://www-igm.univ-mlv.fr/~dr/XPOSE/PerlVsPython/ http://www-igm.univ-mlv.fr/~dr/XPOSE/PerlVsPython/
Mon Sep 25 18:46:45 2017 archive.org
QRCode
Comments
thumbnail

Lequel choisir ?Il est difficile de donner une réponse tranchée à cette question.

Perl s'adresse d'avantage à des gens ayant déja programmé, des programmeurs familiers au C, à Sed, Awk ou aux commandes Unix. Il nécessite la compréhension des expressions rationnelles, et d'avoir la faculté de comprendre le code des autres. On l'utilise plus volontier pour le traitement de chaînes de caractères ainsi que pour les CGI.

Python semble plus approprié aux débutants en programmation. Il intéressera d'avantage ceux qu'ils veulent faire de la programmation orientée objet. Les réactions contre Perl n'apparaissent pas avec Python : ceci atteste la qualité du design et l'implémentation en Python. De part ses conventions, son esthétisme et son support inhérent pour des ensembles d'objets, Python est plus adapté aux projets de grande taille.

Pour conclure, si vous ne savez toujours pas lequel choisir, le mieux de les essayer tous les deux par vous même ! ;-)

perl python code
Lucy – Apache Lucy Documentation https://lucy.apache.org/docs/perl/Lucy.html
Fri Sep 22 21:34:56 2017 archive.org
QRCode
Comments
thumbnail

Lucy - Apache Lucy search engine library.
VERSION

0.6.0
SYNOPSIS

First, plan out your index structure, create the index, and add documents

lucy search engine perl
Mojolicious - Perl real-time web framework http://mojolicious.org/
Tue Jun 20 06:08:12 2017 archive.org
QRCode
Comments

A next generation web framework for the Perl programming language.

Back in the early days of the web, many people learned Perl because of a wonderful Perl library called CGI. It was simple enough to get started without knowing much about the language and powerful enough to keep you going, learning by doing was much fun. While most of the techniques used are outdated now, the idea behind it is not. Mojolicious is a new endeavor to implement this idea using bleeding edge technologies.

perl framework web html
Connaitre les chemins d'accès aux modules perl ? - Programmation en Perl. 3ème édition - Larry Wall, Tom Christiansen, Jon Orwant - Google Livres http://books.google.fr/books?id=RZa7Ig-n0gMC&pg=PA789&lpg=PA789&dq=connaitre+chemin+d%27inclusion+de+perl&source=bl&ots=CdUxgzdgHX&sig=U5hX-MHCIJGz5FnE3E24sDb_5kg&hl=fr&sa=X&ei=QRWiUOmcE8eY0QW0w4GgBg&ved=0CDsQ6AEwBA#v=onepage&q=connaitre%20chemin%20d%27inclusion%20de%20perl&f=false
Tue Nov 13 18:42:17 2012 archive.org
QRCode
Comments
thumbnail

Connaitre les chemins d'accès aux modules perl ?

perl -le "print foreach @INC"

Sur mon NAS me donne :

/ffp/lib/perl5/site_perl/5.14.2/arm-linux-thread-multi-64int
/ffp/lib/perl5/site_perl/5.14.2
/ffp/lib/perl5/vendor_perl/5.14.2/arm-linux-thread-multi-64int
/ffp/lib/perl5/vendor_perl/5.14.2
/ffp/lib/perl5/5.14.2/arm-linux-thread-multi-64int
/ffp/lib/perl5/5.14.2

perl chemin acces include INC
Installation des modules Perl CPAN http://djibril.developpez.com/tutoriels/perl/installation-modules/
Thu Oct 20 07:10:46 2011 archive.org
QRCode
Comments
thumbnail

Installation des modules Perl CPAN

djibril CPAN modules perl ppm Installation des Perl
Introducing SOAP | Linux Journal http://www.linuxjournal.com/article/4519?page=0,0
Thu Oct 20 07:09:35 2011 archive.org
QRCode
Comments
thumbnail
Software In January February installments “At Forge” demonstrated simple three tier web application database server Mason templating system for mod perl We were able see some advantages disadvantages particularly when compared with its two counterpart
sql_sybase http://www.selectorweb.com/sql_sybase.html
Thu Oct 20 07:06:59 2011 archive.org
QRCode
Comments

Resume, Java, Servlet, JSP, XML, XSL, Wireless, Palm, WML, WAP, Perl, Online Trading, Financial Applications, C/C++, JavaScript, Unix, Solaris, Linux, Sybase, Oracle, DB2, MySQL, CGI, Apache, mod_perl, HTML, DHTML, CSS, SSL, CORBA, RMI, WebLogic, WebSphere, Apache/Stronghold, Netscape Enterprise Server, Dreamweaver, Adobe Photoshop

ls Resume Java Servlet JSP XML XSL Wireless Palm WML WAP Perl Online Trading Financial Applications C JavaScript Unix Solaris Linux Sybase Oracle DB2 MySQL CGI Apache mod perl HTML DHTML CSS SSL CORBA RMI WebLogic WebSphere Stronghold Netscape Enterprise Server Dreamweaver Adobe Photoshop
Java JAXP, Transforming XML to XHTML http://www.developer.com/java/data/article.php/3398741
Thu Oct 20 07:03:20 2011 archive.org
QRCode
Comments
thumbnail

Baldwin shows you how to use XSLT to
transform an XML
document into an XHTML document.  He also shows you how to
write Java code to perform the same transformation.

Java Open Source JSF Rails Mono Linux Eclipse Maven Hibernate Subversion Servlet Android Jython Python Perl clojure Baldwin shows how XSLT transform an XML document into XHTML He also write code perform same transformation
4033 links, including 962 private
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Theme by kalvn