Dist::Zilla and custom Makefiles

I’m trying to configure a module to release to CPAN, the repository for the Perl programming language (hi Tiobe). In trying to be up to date about things I asked on reddit what would be a good build tool to use. The majority of votes were for Dist::Zilla, so I thought I’d look into it.

It seems relatively simple for most modules, but my module uses XS and needs to link to libssl. To do this I needed to pass INC and LIB params in the Makefile.PL, but you can’t do that with Dist::Zilla‘s default Makefile plugin.

There are some options for having custom Makefile.PL‘s. I tried MakeMaker::Custom, but that required an entire Makefile.PL template just for 2 extra lines. Instead I opted for MakeMaker::Awesome, but that requires a module to be placed in “inc”…

Still, in both cases there is one minor issue that took a little while to solve, conflicting builds of Makefile.Pl by MakeMaker and MakeMaker::Custom. This is answered in the documentation, but only when you know what to look for.

Essentially the issue is this. You are probably going to have dist.ini include:

[@Basic]

The @ indicates a plugin bundle, thus it loads Dist::Zilla::PluginBundle::Basic. That loads [MakeMaker] and that conflicts with [MakeMaker::*].

The solution to handling this is the plugin bundle

[@Filter]

This is a fake bundle which wraps around another plugin bundle and removes from it any plugins that you don’t want to load. Thus you can still load @Basic, but not load MakeMaker simply by adding this:

[@Filter]
-bundle = @Basic
-remove = MakeMaker

Fix for: cannot restore segment prot after reloc: Permission denied

Just got this:


thebes# apachectl configtest
httpd: Syntax error on line 62 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

This is an SELinux issue. As you can see the security context “type” is set to usr_t:


thebes# ls -lZ /usr/local/apache2/modules/libphp5.so
-rwxr-xr-x root root user_u:object_r:usr_t /usr/local/apache2/modules/libphp5.so

Change it to textrel_shlib_t with:


chcon -u system_u -r object_r -t textrel_shlib_t /usr/local/apache2/modules/libphp5.so

And it works fine:


thebes# apachectl configtest
Syntax OK

snmpd error on subcontainer ‘ia_addr’ insert (-1)

Found that the log files on two separate Centos 6.3 boxes where filling up with the error

error on subcontainer 'ia_addr' insert (-1)

This was being written with each connect. It seems that this is a harmless debugging message and the fix appears to be to change the OPTIONS setting in “/etc/sysconfig/snmpd” from

-LSd

Which means log to syslog under the daemon facility, to

-LS6d

Which means log only LOG_INFO level messages and above to the syslog using the “daemon” facility.

This is annoying since I was using -Lf, but adding the “6” there for the log level causes net-snmpd to create the file as a socket instead of a regular file. It seems that there is no method to filter the debugging notices when logging to a file.

Installing uglyfi-js and node on Ubuntu 12.10

The e-Classifieds ® Corporate edition uses lots of JavaScript code, so to help speed things up we compress the code. Previously this has been done using JavaScript::Minifier::XS from CPAN, but all the cool kids are using UglifyJS. So I thought I would see how it compared.

Read more of this post

AIDE constantly reporting prelink errors

We added a couple of new boxes running CentOS 6 here at Hagen Hosting. They generally work really nicely, but I’ve been having this on going fight with AIDE and prelink.

Prelink seems like a good idea because it reduces the chance of an exploit working, but the honest truth is that it is annoying, potentially troublesome in terms of legal issues and security. More over, from what I read, prelink doesn’t add much extra security.

I find it particularly annoying when prelink runs each week and I’m confronted with the output from AIDE saying a bunch of files have changed. It would take hours to compare them all to see if they had changed because of an intrusion so I have to assume that they have changed because of prelink because they are listed in the prelink logs and timestamps match. But, you know, it just doesn’t feel secure.

More over prelink has become very annoying because for some reason that I have yet to work out, each night it keeps prelinking the same set of files. A few are compiled-from-source programs (like Apache), but some are standard libs.

To get it to stop I had to run prelink on those files manually and keep re-running it until it stopped saying that some of the files needed prelinking.

However after a valient attempt I’ve realised that prelink is just causing too many headaches and so I took the ultimate step — to disable it.

To disable prelink edit

/etc/sysconfig/prelink.conf

/etc/sysconfig/prelink

and change

PRELINKING=yes

to

PRELINKING=no

Sometime in the next few days it will run prelink -ua to undo the pre-linking on all files then I’ll be done with it and the only changes to the system will be updates (or bad stuff :-)

Edit: 2014-05-22T13:25:56+00:00

I just had this error message coming up on a box after updating a library. prelinking is disabled but I would still get this same error message from AIDE.

Running

prelink -ua

did not stop the error messages because running this command checks the value of PRELINKING and so it doesn’t run – at least I think so. The error occurs because AIDE detects that the library has changed and so runs prelink directly on those files:

4574 [pid 12916] execve("/usr/sbin/prelink", ["/usr/sbin/prelink", "--verify", "/usr/local/apache2/modules/libph"...], [/* 44 vars */]) = 0

Since I have PRELINKING=no defined, but I was getting this error message, it would appear that if you specify a filename to prelink then it runs as it normally would, regardless of this global setting. It makes sense, I suppose.

The answer therefore was to use this knowledge that prelink still works on specific files, but not globally, and “un-prelink” the library in question. In otherwords run;

prelink -ua <file>

Doing this caused AIDE to no longer run prelink.

Ubuntu resets /etc/hosts [SOLVED]

Due to a hardware problem on the computers at home I had to assemble an Ubuntu box from an old box. (actually Kubuntu because I just find KDE easier to work with). I had a minor issue that the drive had died, but thanks to a USB stick and a DVD I was able to get Kubuntu installed pretty quickly.

I did learn that while 12.10 is nicer than 12.04, 13.04 daily is far from ready for daily use. Things just wouldn’t install properly, but fortunately re-installing from 13.04 to 12.10 was fast.

I dislike advertisments and being tracked so I use the MVPS hosts file. It is super easy to install:

wget -O - http://winhelp2002.mvps.org/hosts.txt | sudo cat - >> /etc/hosts

However I found that everytime I rebooted my ubuntu box it reset the hosts file.

After some Googling it was variously reported that this could be an error, but also related to the fact that when using DHCP, the client updates /etc/hosts with entries for 127.0.0.1. The solution therefore is to use:

127.1.1.1

Which you can add in-line:

sudo sh -c 'wget -O - http://winhelp2002.mvps.org/hosts.txt | sed 's/^127\.0\.0\./127.1.1./' >> /etc/hosts'

Thanks for everyone that pointed out that it needed to change network.

aide.conf syntax errors contain junk line information

The latest servers that we added to run our e-Classifieds (r) platform use CentOS 6. I definitely like the boxes but Prelink and AIDE have been a pain.

After trying to stop AIDE checking some folders I started getting this report:

271:syntax error: <junk>
271:Error while reading configuration: <junk>

It turns out that this really was a syntax error. It really was on line 271 because rather daftly I had been thinking in terms of RegExps and added the line as

!^/usr/local/....

The ^ generates the syntax error. But apparently AIDE has a free/malloc/pointer bug in this error message as it prints random junk after the error message. Initally made me think that the error that was being reported was that the aide.conf file contained those characters and I couldn’t see then and therefore oooh filesystem/disk corruption… I was relieved to find that it was a bug in AIDE’s error message.

It is always these idiots with massive Data::Dumper struts ….

*laugh*

Just found this in the source for PPI:

175 if ( $self->{source_bytes} > 1048576 ) {
176 # Dammit! It’s ALWAYS the “Perl” modules larger than a
177 # meg that seems to blow up the Tokenizer/Lexer.
178 # Nobody actually writes real programs larger than a meg
179 # Perl::Tidy (the largest) is only 800k.
180 # It is always these idiots with massive Data::Dumper
181 # structs or huge RecDescent parser.
182 PPI::Exception::ParserRejection->throw(“File is too large”);

PPI/Tokenizer.pm

Yeah. It’s your fault! :-)

Not actually sure why trying to use Test::Perl::Critic::Progressive results in this since I don’t have any files that are that big, but it made me laugh when I discovered the source of the message.

Please Stop Including the Kitchen Sink

I needed to install Business::OnlinePayment::WorldPay @ $work today. I had been using the module in my own perlbrew name space so as to not pollute the server with unnecessary modules, but as the code went live I needed to install it server side.

Little did I know that it triggers once of those dependency cascades that includes the kitchen sink.

Read more of this post

Its Stuff Like This, perlblogs

I feel pretty much useless sitting here on WordPress.com trying to add something to the Perl community and not getting any traffic. So I was seriously debating signing up on blogs.perl.org tonight. That didn’t work out too well…

Read more of this post

Dancer v2 is coming

Perl Dancer one of the crop of new Perl web-app frameworks, and one that is related in style to Ruby’s successful Sinatra framework, is announcing the development of Dancer 2.

Read more of this post

What does that module do? aliased.pm

In my first post in this series I explained how Task::Kensho provided a nice list of modules to install to give a good basis for many common actions.

When installing some of those modules I had one of those “I wonder what that does” moments when cpanm showed that it was installing “aliased.pm”. Generally all lower case module names are reserved for pragmas and modules that provide pragma like support, so I was curious to know what this module did.

Read more of this post

What does that module do? Task::Kensho.pm

Whenever I look at CPAN I am always amazed at the number of Perl modules that are available. Over 101,000 as of today. It just blows me away that that much time and effort has been put into coding these modules, by all of those people, and for free.

But at the same time I can’t help but think how can anyone possibly find the time to know what they all do? How do you find out what modules are relevant or helpful for your daily programming? More over when you are installing a module and it pulls in other modules don’t you want to know why? Perhaps some of those other modules could be useful to you too.

Read more of this post

Three DOA Dell Scorpio Blue Drives

I have a Win 7 laptop at home. It was originally a donation from the family and it is now used for IE testing and Skype’ing. The HDD died on it a week after the 3 year extended warranty ran out (of course!) so I contacted Dell to get a replacement.

I have to say that I will probably never buy a Scoripo Blue 320gb drive from Dell again after a really annoying experience where the first and then both replacement drives all turned up DOA.

Read more of this post

Liking the First CentOS 6 Server at $work

Installed first box at $work with CentOS 6 the other day and so far I like it.

I will say that the installer is no where near as slick as Ubuntu’s installer. I’m not really sure quite why it doesn’t feel as easy, but clearly someone at Canonical worked hard to make their installer slick, but still, CentOS 6 installed smoothly.

Read more of this post

Strong Growth in Perl Jobs market

According to eWeek the number of Perl jobs grew by 26% since 2009.

Read more of this post

Using cpanminus

If you haven’t already tried cpanminus (cpanm) then you definitely should do.

cpanm is a replacement/supplement for cpan that provides much less functionality and therefore faster and simpler.

Read more of this post

Perl’s Resurgence

It has been a long time since I posted on this blog.

I haven’t posted due to being busy with work and life, but it seems that I stopped trying to write about Perl at exactly the wrong time because in the past two years Perl has flourished again.

Read more of this post

ShadowCat’s “Enlightened Perl Iron Man Competition”

Bingo!

ShadowCat Systems, an open-source development company from the UK posted an entry on their blog today which hits the nail on the head. Perl needs marketing and it needs it within the realms that the rest of the world moves.

We, the collective Perl consciousness, do not really like all this modern internet stuff. We don’t appear to like blogging, we don’t appear to like forums and pretty web 2.0 stuff? That’s right out. As Matt so correctly described it

Perl people hang out on mailing lists. We bottom post, carefully interleaved, with 76 character lines. We have signatures that meet the McQ standard for acceptable size. We hang out on IRC servers and bitch, moan, interact and collaborate with the aid of an 80×25 xterm with irssi, BitchX or IrcII in it[3]. Sometimes we sit at home with a beer and do one or more of the above. Forums? Meh. Those are the things the PHPtards like because they can’t figure out how to work a mailing list, right? Blogs? That’s not even a fucking word!

I hate to quote so much at once, but this paragraph captures the issue completely. The reason for all of the “Perl is fading” nonsense is almost entirely because we don’t seem to like to talk about Perl in any format which is post-1997.

But it seems that we have finally started to realize that this is a problem and have, to paraphrase, “become the change that we want to see” because we’re actually seeing blogs about Perl which if not exactly web 2.0 are at least not from 1997.

The most popular “new” site of course is Perl Buzz, but it isn’t the only site. There are many small blogs where people post infrequent articles about Perl, but finding them can be tricky. To help address this issue Shadowcat’s Matt Trought has decided to start handing out awards to people for frequent postings on Perl through his Enlightened Perl Iron Man Competition.

If you haven’t already read the article then you should do. Really. Matt expresses his frustrations with what can only be described as proper English enthusiasm – yeah, that does mean with lots of swearing. And frankly he’s right. Every word of it is true.

Indeed I can remember posting a similar rant on starting to post at perladmin.oreally.co.uk blog. Sadly the server behind it was a freebie server hosted by a friend and it needed to be ditched and, as yet, I’ve not seen the data since to resurrect the blog else where. My irritations were something similar – although I also went on to criticize the fact that for years we’ve been told that Perl 6 will be better and “is coming”. For my efforts I got a couple of snarky comments telling me that I shouldn’t criticize Perl 6 , that I was only adding to the problems by doing so, and one note saying that “I did go on..”.

Well that was my rant, and Matt has posted his. But Matt has also gone on to proposed a solution, his “Perl Iron Man Competition“. To paraphrase a commonly used term about the current economy, perhaps we are seeing Perl’s green shoots of recovery?

I hope so. Rock on Matt!

Fix for SVN::Web and ‘subversion/libsvn_ra/deprecated.c’ line 289: assertion failed (*path != ‘/’)

Updated: April 22nd 2009:
This issue is actually SVN::Web Bug 37388. I didn’t see that because I that bug was filed using the error messages for SVN v1.5.0 and the function svn_ra_get_log() that is called is in a totally different library in v1.6.0 so searches for the v1.6.0 error do not find that bug report or the patches. Thanks to commenter Alexandr for drawing this to my attention.

Read more of this post