Sunday, December 26, 2010

Tuesday, August 24, 2010

Padre again

Been using it for a week every day, and it feels great.

There are a few issues, but it has crashed on me only once, syntax highlighting in css is great, knows when it's editing html without filename hints and does not balk at Mason ... besides having perltidy and perlcritic only one keyboard shortcut away.

Monday, August 16, 2010

Catalyst unicode-related error

Caught exception in engine "Wide character in syswrite at
/usr/local/share/perl/5.8.8/Catalyst/Engine.pm line 675."


the solution is to add the Unicode plugin to the application:


use Catalyst qw/
# ... some other plugins
Unicode
/;

Thursday, July 1, 2010

"amusing" @INC trouble

got into a bit of panic today:


$ perl -e 'use LWP'
Global symbol "%Config" requires explicit package name at ...


This happened when running anything that used perl, and this error I have not seen before.

Asking around and googling resulted in one conclusion: core Config.pm is busted, Perl is damaged, must reinstall. Lucky for me I realized there was a Config.pm in the folder I was in at the time, and './' was in pole position in my @INC.

Friday, June 11, 2010

tried Ubuntu 10.04

... not bad, though I won't switch: shivering at the thought of moving all the configs, instant messenger logs, mail accounts and setting and other useful junk accumulated during 5 years of updating a Debian in-place.

Thursday, May 27, 2010

strange apache error


apache failed to start with an error:


[Thu May 27 13:41:29 2010] [crit] (28)No space left on device: mod_rewrite: could not create rewrite_log_lock
Configuration Failed




Carlos Rivero has a solution using perl.




Here is what I used, as somebody suggested in the comments to the post linked above:


ipcs -s | grep emilper | awk ' { print $2 } ' | xargs ipcrm sem


then restarted the server

Monday, May 24, 2010

installing padre 0.62 on debian sid

Got an unexpected "bank holiday", so I am playing.



Padre installs nicely on Debian Sid when using CPAN on 2010-05-24 ... I wonder if I am doing something wrong :P ... or maybe Padre is getting closer to being ready for prime-time.



Plugins that installed cleanly:


  • Padre::Plugin::PAR

  • Padre::Plugin::XS

  • Padre::Plugin::Encrypt

  • Acme::Padre::PlayCode

  • Padre::Plugin::Nopaste

  • Padre::Plugin::DataWalker

  • Padre::Plugin::HTML

  • Padre::Plugin::HTMLExport

  • Padre::Plugin::JavaScript

  • Padre::Plugin::Kate

  • Padre::Plugin::CSS

  • Padre::Plugin::Ecliptic

  • Padre::Plugin::SpellCheck

  • Padre::Plugin::PHP

  • Padre::Plugin::ViewInBrowser

  • Padre::Plugin::PerlCritic

  • Padre::Plugin::Debugger

  • Padre::Plugin::Encode

  • Padre::Plugin::Alarm

  • Padre::Plugin::Swarm

  • Padre::Plugin::ClassSniff




Plugins that fail tests:


  • Padre::Plugin::Shell::Base

  • Padre::Plugin::CommandLine

  • Padre::Plugin::InstallPARDist

  • Padre::Plugin::Vi

  • Padre::Plugin::Template

  • Padre::Plugin::Filter


perl editors

Eclipse

When using subclipse with Aptana Studio or Eclipse, it will complain about missing "libsvnjavahl-1". On Debian, the package libsvn-java needs to be installed. After that /usr/share/java/svn-javahl.jar needs to be added as "external jar" to the JRE in use.

EPIC should install with no trouble.

In Eclipse I am giving a try to QuantumDB Eclipse Plugin for database browsing: it can be installed easily from the Aptana plugin manager.

Eclipse is a pain when working on remote files (even with ssfs) if the link is not lightning fast, so other editors I use are Komodo Edit (kind of an unofficial standard at work), Emacs (at home, always come back to it after exploring alternatives), or Kate.

Monday, May 17, 2010

daemontools install on centos 5.4

after getting this error:

/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in envdir.o 


need to edit
src/conf-cc


add this:


-include /usr/include/errno.h


... via Installing Bernstein’s daemontools on CentOS 5

Thursday, February 25, 2010

tested CPAN last night

If you want to test CPAN works as advertised, install MojoMojo. I did it last night, and it worked, even though there are hundreds (or so it seems :) ) dependencies. I installed it in my home, so this evening I'll delete the ~/perl5 directory and start again, this time taking notes: once a few of those dependencies, some from CPAN and some *-dev packages, are installed, the whole "cpan MojoMojo" should work nicely, and you'll have only to watch from time to time for prompts from tests.

Thursday, January 28, 2010

use Devel::NYTProf with CGI and apache

put these lines in the apache virtualhost config file:



SetEnv NYTPROF "file=/tmp/nytprof.out"
SetEnv PERL5OPT "-d:NYTProf"



the output from Devel::NYTProf will go to /tmp/nytprof.out

Saturday, January 23, 2010

undefined symbol: apreq_handle_apache2

solution from here

symbol lookup error: /usr/lib/perl5/auto/APR/Request/Apache2/Apache2.so: undefined symbol: apreq_handle_apache2

Make sure you load the apreq module in your apache2 config file:

LoadModule apreq_module /usr/lib/apache2/modules/mod_apreq2.so

In debian there is a file in /etc/apache2/mods-available called
apreq.load. Just link that to your
/etc/apache2/mods-enabled directory and restart apache2

HTML::Mason and apache issues

this was copied from somebody else, but I did not keep the reference ...

===
while atempting to upload files in html::mason the response is only "End of file found":

solution: add this to the vhost configuration file

PerlSetVar MasonArgsMethod mod_perl

explanation: it seems HTML::Mason is using CGI to deal with post/get by default, and when CGI is done with post/get, there is nothing left for apreq to work with; the line tells HTML::Mason to use mod_perl to deal with the args

I18N for HTML::Mason

in the folder where I keep the virtual host data:

locale/ro/LC_MESSAGES/ is where the messages.mo file goes


drwxrwxr-x 1 emilper www-data 4096 2010-01-22 04:53 apache_conf
drwxrwxr-x 1 emilper www-data 4096 2010-01-22 05:48 htdocs
drwxrwxr-x 1 emilper www-data 4096 2008-07-16 18:37 lib
drwxr-xr-x 1 emilper emilper 4096 2010-01-22 02:33 locale
drwxrwxr-x 1 emilper www-data 4096 2008-07-19 02:13 log
drwxrwxr-x 1 emilper www-data 4096 2010-01-22 04:54 mason


in my Apache VirtualHost config:

PerlSetVar GettextLocalesDir /home/www/mysite/locale/
PerlSetVar GettextDomain messages


in my Mason request class (MasonRequestClass set in apache conf) :


$self->{'i18n'} = Locale::gettext->domain($self->apache_req->dir_config('GettextDomain'));
$self->{'i18n'}->dir($self->apache_req->dir_config('GettextLocalesDir'));


and


sub _t {
my ($self, $string) = @_;
return $self->{'i18n'}->get($string);
}


in my code:


$page_title = $m->_t("String to translate");


As of now, I have difficulties persuading xgettext to extract the strings from autohandlers, .mas files, and .html files. Until I write my own extractor, I add the strings by hand to a "messages.po" file, which I compile to a "messages.mo" file that can be used by gettext with:


msgfmt messages.po