Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Journal of ambs (3914)

Thursday February 11, 2010
11:57 AM

What is the status of $@?

Accordingly with the perlvar manpage, $@ is used for error messages produced by eval.

I would like to use it as a more general variable for error messages. When a function returns a string, there isn't much that can be done to return a error string. Probably returning a list, setting an object, nothing clean and simple as real perl code :)

What I want is to use $@. The function will return undef and set $@ to the error message. This is clean enough and should work.

But I have some doubts: is there any problem on using this approach? In the function I probably need to clean up $@ and assign undef to it?

06:02 AM

What's up with use.perl main articles?

What is happening with use.perl main articles? Lack of time to moderate them?

Wednesday January 20, 2010
09:20 AM

Deep recursion on subroutine

Perl is complaining about a deep recursion on a subroutine. That is natural, as I have deep recursion :). But that recursion is being controled and therefore I know that will not be a problem.

Now the question is: can I silence Perl on these warnings?

Saturday January 09, 2010
02:38 PM

Encode and CGI::Session... again?

In my last post I was complaining about 'use encoding'. As suggested, I changed. Now, I am using just 'Encode' module, 'encode' function. But that is not working correctly as well.

Basically, I continue to get errors with calls to renew and renewed method. Curiously, they are not deterministic. Sometimes nothing gives error. Some other times, it gives error when creating the CGI::Session object: Can't locate object method "renewed" via package "Encode::utf8" at /usr/lib/perl5/core_perl/ line 26

I really would like to know if this problem might be from Encode and CGI::Session working together (I just got the bug when adding sessions to the website) or if it is about mod_perl working with both of them.

No idea. But this is giving me pain...

Sunday January 03, 2010
12:10 PM

Using encoding and CGI Sessions/Cookies

I am trying to use CGI::Session (and of course, CGI::Cookie) together with 'use encoding "utf-8"', but things seems not to work.

The error is 'Can't locate object method "renewed" via package "Encode::utf8" at /usr/share/perl5/site_perl/5.10.0/' that seems to be common to other modules. For example, a google search shown similar problems with Safe.

I am not sure yet about who is responsbible for the bug, Encode, CGI::Session or CGI::Cookie. But if this kind of problem was detected previously probably somebody knows where is the problem and can point me to the correct place, so I can try to correct this bug.

Thursday December 31, 2009
01:41 PM

Modules versioning

For some time that Perl modules are numbered with a major version, a minor version, and sometimes, a alpha/beta numbering.

Lately some modules adopted the usage of a serialized date. One of the latest was Regexp::Common. Do not stress, Abigail, nothing against it.

Now, the question are: is it useful? Should it be used just for old and stable modules like Regexp::Common or should we use it from the beginning?

I think it might gets useful. Normally it is hard to know in what direction to number distributions. Especially when you get to .99 and do not want to change the major version in the next version.

But then, probably we should not use that numbering scheme for new modules. Just because you never know if you will need to change drastically the interface. And then, a major number version change might get useful.

Any thought?

Monday August 10, 2009
06:51 AM

TPF 2009Q3 Grant Proposals

After three extenuating days at YAPC::EU::2009, and after some rest time, finally had the time to prepare the list of grant proposals for the third quarter of 2009.

We have seven proposals, that can be read in TPF blog:

These proposals are open for public/community discussion. Please comment each post with your thoughts of the proposal. Please make sure you sign your comments, and also that your comment is something more than just one "I would like it" or "It sucks", or it will be moderated.

Voting will take place in 23th August, and results should be posted shortly after.

Thursday July 02, 2009
04:31 PM

Understanding Perl and Encodings

I still did not get the grip on Encodings and Perl. I have an UTF8 file that I want to process. This process calls a module that I know uses a bidirectional pipe with an latin1 process. But that should be hidden...

So, I am reading with <> operator, and printing with print. If I do not say a thing, I get output correct (UTF8) but the module does not work. If I put 'use encoding utf8', I get input and output correct, but the module does not work. If I put 'use open utf8' I get the module working, but no correct output. If I add the binmode for the STDOUT, it works. And finally, if I remove 'use open' and add a binmode for STDIN, it does not work, as <> is not affected by that.

Finally, I was hopping that 'use open utf8' would work for it all. Unfortunately it doesn't. Perl 5.10.0, btw.

Ideas, suggestions, corrections, are welcome.

Monday June 29, 2009
04:24 PM

You know you are doing too complex SQL queries...

You know you are doing too complex SQL queries... when DBI/DBD::SQLite refuses to parse the SQL statement.

The statement is simple: select a field, where it is one of a set of words:

SELECT word FROM dict WHERE word='aaaaa' OR word='bbbbb' OR word='ccccc' OR...

The first error was: parser depth of 1000 was reached.

No problem. Decided to construct a binary tree of ORs:

SELECT ... WHERE ((word = a or word = b) or (word = c or word = d))

Now, DBD::SQLite::db prepare failed: parser stack overflow.

I think the solution is to slipt this thing in more than one query. Damn!

Thursday May 28, 2009
03:15 PM


Anybody with experiments on Zefyr? ( I would like to buy one, but I can't find this in Europe. Any idea where to find one?