Perl Canteen
Collection of freewares developped by Baptiste. I have developped these freewares for my own purpose, but it may happen you have a use for any of them. In that case, please feel free to download, use, modify and distribute them under the term of the GNU GPL.
albagtor.pl
Albagtor stands for ALBum-GenraTOR
Albagtor is a perl script, using graphical interface (GUI) or line command, that builds a complete HTML album ready to tree-copy, using set of jpg/gif files with ACDSee comments format and file-system tree structure.
It can generate thumbnails, it displays and encode image size and dimensions in the HTML pages, it produces graphic and non-graphic photo index, it supports color/font/background/etc customization, atomic album modification (it only modifies the files that actualy need modification when reconstructed), dirty marking within filesize (modified HTML files have different filesize so that the ftp synchronizer does not miss them), built-in ftp synchronization, album indexer (manage several albums on different web servers), and many more. It comes with a full English documentation (see below) and sympathic support from the author.
There are many perl album generators out there, I wrote mine because I could not find any that satisfy these simple demands. Please visit my albums to see the result: Belphégor, Draculea, first and last metro, Plaquette ALSF 2001/2002... or the self-generated album index. All these have been produced by this script without any afterward manual modifications.
ftp_sync.pl
ftp_sync.pl is a perl script that displays differences in file lists and file size between remote and local arborescence using ftp. Using these information, it optionaly uploads and remotely deletes files to synchronise the remote tree identical to the local tree. As it bases its decision from file size, it is best used as a tree synchroniser for images-based web sites.
unicode_to_other.pl
unicode_to_other.pl is a perl script that will read input in unicode (UCS-2) and output in ANSI-escaped format (supported are java format \uFFFF and HTML escape squences).
Install note
These freewares are perl scripts, that means you need to install perl and the required packages. This step is easy, although it may be boring for some of you. I give you here brief indications that will help you if you are not familiar with perl installation process. You will find proper precise documentation on Perl or ActivePerl sites and you should refer there if you need more precise documentation.
- Install perl with the following. Go to perl.com, select the downloads section, then Binary distributions. If you have PC with Windows, select Win32: you will be directed to ActivePerl, then select Download again. You can skip the registration. Download and install the requirement if needed depending on your operating system (you will need instmsi with Windows 9x/ME). Clic Next and choose the msi file.
- There are pitfalls on installing some versions of perl:
- If you already activated the PERL5OPT option as indicated below, it may block your first install of perl, so be sure it's not set.
- Many perl outsided tools, including the very important ppm, will not work if you install perl on 'c:\program files' or any path with a blank in it. You can still install it there if you specify: 'c:\progra~1' instead. (encountered with v5.8.4)
- With Windows 7 (and possibly Vista), I found that the protection of the program files directory conflicts with PPM. SO I recommand to install perl in a different directory (not Programm Files, not Program files (x86). I installed it on c:\bin\perl.
- Once perl is installed, you will install the required missing packages. I cannot substitute your documentation which you should refer to. Please find here some guidelines that may help you through this process (these may not apply on platform other than Win32). (encountered with early versions of Activeperl, not applicable with the recent versions)
- Connect to Internet
- Run ppm (startup menu -> programs -> ActivePerl... -> ppm)
- Choose and install the packages that you want
Note:
- If you want to use ppm connected through a proxy, you need to set the variable HTTP_PROXY to the following "http://proxy_server:proxy_port" (example: "set HTTP_PROXY=http://proxy.acme.com:8080", "set HTTP_PROXY=http://acme_pro:8080")
- If you cannot connect to internet, download the package, unzip it, and type "ppm install package_name.ppd".
- If you can only find a tar.gz version, for example Image-ExifTool-6.32.tar.gz, you can still install it the classic way, using nmake.exe instead of make (download nmake from KB Microsoft, and then):
perl Makefile.PL
nmake
nmake test
nmake install
I did not find a version of nmake for Windows 7.
- Otherwise, it is sometime inough to copy the *.pm file in your perl/site/lib
- with PPM version 4.00 (distributed with ActivePerl 5.8.8), there is a bug : if the proxy is required and evironment not properly configured when you first start PPM, the cache of the repository will become corrupted, and you will not be able to resync it. If this happens to you, you must :
- configure properly your proxy environment (see below)
- Force the resync of the cache with PPM at the command line
- open a new cmd shell
- ppm install package_name (any package name ; this command will force it to refresh the repository)
- When the refresh started, you can interrupt, and reopen the GUI ppm windows graphic version. Note that last time, the resync of the repository was about 2 hours.
- This is probably corrected with recent versions of perl
Here are the packages that may be required if you are using my scripts:
- TimeDate, Image-Magick, Crypt-RC4, File-slurp, Log-Log4perl, Ed2k_link, Filesys-DfPortable, Net-IP, XML-TreeBuilder, Text-StripAccents, Data-Table, Text-Banner, Image-ExifTool, IO-CaptureOutput, IPC-Run3, IPC-Run-SafeHandles, PDF-API3, mp3-Tag, Text-Undiacritic, Tie-IxHash, Win32-Process-Info
The required following packages are now included in ActivePerl's ditribution : HTML-Tree, Archive-Zip.
This package has been replaced in the distribution: Config-ini. Uninstall the one 1.08 (copy the PM file is enough if you do not have nmake).
- Not required but usefull : Tk, Geo-Coordinates-Parser, perl-GPSData, Data-Table, Date-Manip, Win32-API
You should always install the version available on the ppm repository of your perl vendor. However, it happened to me one time that TimeDate for Win32 was not available in ActiveState's repository, so remember to keep a copy of all packages you use to ba able to reinstall without being fependant from the repository..
Note: for M$-Windows users, the recent releases of ActivePerl do not include the ImageMagick package anymore. You have to install ImageMagick as a separate package from http://www.imagemagick.org/www/perl.html (eg ImageMagick-6.0.2-Q16-windows-dll.exe).
I'ts usuall straightforward, but there was a bug in the version 6.3.9-9-Q16-dll for windows when installed on perl 5.10.0 on XP. Here is the procedure to workaround
- Install Image-Magick with perl-magick
- Go to the installation dir of Image magick then under PerlMagick
- Backup then modify Image-Magick.ppd to set <ARCHITECTURE NAME="MSWin32-x86-multi-thread-5.10" /> (instead of 5.1)
- Execute ppm install Image-Magick.ppd
- Good luck
Note to self: in January 2009, I tried to upgrade to ImageMagick-6.4.8-3 (ImageMagick-6.4.8-3-Q16-windows-dll.exe) and I was having error Can't load 'D:/Progra~1/perl/site/lib/auto/Image/Magick/Magick.dll' for module mage::Magick: load_file:Cette application n'a pas pu dÚmarrer car la configuraton de l'application est incorrecte. RÚinstaller l'application pourrait rÚsoudre ce problÞme at D:/Progra~1/perl/lib/DynaLoader.pm line 202.. Reinstall, and upgrade to the last version of ActivePerl could not solve it. I falled-back to imagemagick-6.3.9-9-q16 (imagemagick-6.3.9-9-q16-windows-dll.exe), the applied the above workaround, then I could again use PerlMagick, exept that it still cores with the file P-AD20071102-14h30m57s-abz.jpg.
This was probably caused by a incompatibility between ImageMagick and ActivePerl. When you check the box 'install perl-magick', please check that the perl verion indicated match your perl version.
You can also try to install vcredist_x86.exe (MS-Visual C++ 2008 redistributable setup), which I did, but I do not know if it is part of the resolve or not.
- On DOS and Windows platforms: activate the Command-line Wildcard Expansion. This is not mandatory but is recommanded. If not activated, some options that use wildcards (example: '*.txt') will not work.
The Command-line Wildcard Expansion activation is documented in section perlwin32 of ActivePerl documentation (find an extract here). Here is a short version:
- Install Wild.pm in your perl/lib directory
- set the following environment variable like this: "set PERL5OPT=-MWild" (example in the c:\autoexec.bat)
- You are done. You can execute the script: run it from a command line shell (a dos windows for example):
perl <script name> [options]
perl <script name> -h
- Annoyances
A part for the annoyances listed below, (PERL5OPT, HTTP_PROXY...), here are some that I also met.
- Error Bad protocol 'tcp' when tryin to connect to www.somewhere.com:80 with HTTP agent or ppm. I had it when executing perl from VB. Others have it when executing perl from CGY or ppm from windows.
This is a problem you will meet with XP when the perl process did not inherit properly some system environment variable. You can see it if you check the environment variables from your perl script. The workaround is to use a *.bat wrapper in which you set the variables before you call your scripts.
- The missing packages.
One day you download a package, and you use it as the cornerstone of your application. Two years later, you have to reinstall your machine, but the problem is that the package that you need is no longer available.
Follow my advice: download the packages as files when they are available and keep them safe, and be aware that if a package is not available by ppm when you reinstall, you can still manually install it if you have it as file.
- Build your own packages
Follow the gold rule : do reusable code. The modularity in perl is not easy to implement by calling scripts containing functions. You need to write packages. You can try, it's not so difficult.
If you do, I recommand you keep your scripts in a data folder, and your packages in a subfolder of it.
For that, you need to set your package folder in the PERL5LIB variable.
- With perl 5.10 for windows, I found that I have to set the perl/lib directory in the PERL5LIB variable.
- Failure to install DBD::mysql (missing cc). I had this error when running script accessing MySQL after alledgly succefull installation of DBI on Solaris 10. The DBD::mysql was missing. Manual installation of DBD::mysql alone failed during the make (cc not found). cc is a C compiler, that is not free, and is thus not installed by default. Using gcc as a substitute failed, in spite of my best effort to convert compile directive from cc syntax to gcc. I could not overcome this problem, so I decided to use Net::MySQL instead. Net::MySQL depends from Digest::SHA1 that also requires cc. However, for this one, you can adjust the makefile and compile Digest::SHA1 with gcc: in the makefile, replace cc by gcc and remove the following options: -KPIC -xO3 -xarch=v8 -xspace -xildoff. This page was a big help. At the end, Net::MySQL was not installed in the proper place, and the perldoc did not include it, but if I configure PERL5LIB properly, or insert use lib qw(/opt/csw/share/perl/site_perl); for CGI, and then it worked, I could access my database.
Author and license information
All these programms are copyright (c) Baptiste Marcel 2001, 2002 and later. All these programms are freeware, you can modify and/or distribute them under the term of the GNU General Public License version 2 or later. It comes with no warranty of any sort. Refer to www.gnu.org/copyleft/gpl.html for the full text of the GNU GPL.
Bug reports and feature requests should be sent to author (see page Contact).
Updates and last available version should be downloaded from http://www.dunwich.org/soft.
Refer to http://www.dunwich.org for more information about the author, and to http://www.dunwich.org/baptiste/addresse.html for contact information.
File created 27th December 2001, last update
11/11/2006 AD 22:30:05 by Baptiste MARCEL (voir page Contact), located in Asnières-sur-Seine (France). Feedback is welcomed.
If you enjoyed this page, please do not forget to visit my homepage and to request more information about this site.