Cygwin, Parrot

Parrot: build parrot on cygwin

Building parrot on cygwin is not as straightforward as on other platforms. You have to add path of libparrot.dll into PATH environment variable. For example,

PATH=/path/to/parrot/blib/lib:$PATH

It’s better to add this line into your .bashrc file so that you do not need to run it every time you start a console.

After that, you can follow basic building steps to build parrot.

$ perl Configure.PL
$ make

To test parrot, write a hello.pir

.sub main
    print "Hello world!\n"
.end

And then run it

$ parrot hello.pir

If everything is ok, you should get a string as output.

Standard
Makefile

Makefile: whitespace in path

I hates whitespace in path. I wrote a Perl script which uses a resource file and several template files. So I created a makefile to copy them to user’s HOME directory. It looks like:

$(HOME)/a: a
      cp -f $< $@

Unfortunately, it doesn’t work when there are whitespaces in $(HOME) string, such as /abc/d e/. That happens on Cygwin default installation.

You can double-qoute path, but there are whitespaces in target and target can not be double-qouted. Finally, I find a workaround after diving into `make' info page for a long time. Here is the trick.

nullstring :=
space := $(nullstring) # a space at the end
QUOTED_HOME=$(subst $(space),\ ,$(HOME))
$(QUOTED_HOME)/a:a
      cp -f $< $(subst $(space),\ ,$@)

Standard
Emacs

Emacs: Do what I mean when commenting

I should know this command earlier. It’s so convenient.

M-x comment-dwim

I always run M-x comment-region and M-x uncomment-region manually except when using C Mode since I can use C-c C-c when commenting.

Don’t do it that way any more. And even fortunately, M-x comment-dwim is bound to M-; by default.

According to help, this command runs different commenting command on different situation. For example, if you mark a region, this command comments code in the region. If you mark comments, this command uncomments them. Read more on help, and read now.

Standard
Cygwin, Perl

Upgrade cygwin perl to 5.8.8-4

Cygwin perl is broken after I upgrate to version 5.8.8-4. Let’s fix it!

You have to remove Compress::Zlib first. Otherwise, cpan wouldn’t work.

$ rm -fr `find /usr/lib/perl5/ | grep Compress | grep Zlib`

Then, you have to recompile Scalar::Util yourself because weaken is not supported by default.

cpan[1]> force install Scalar::Util

Now, it’s time to upgrade CPAN.

cpan[2]> install CPAN

If you want Compress::Zlib back, remove IO::Uncompress::Inflate first. There is a circular dependence between IO::Compress::Bzip2 and IO::Uncompress::Inflate. Unless you remove this inconsistency, Compress::Zlib can’t be installed.

$ rm -fr `find /usr/lib/perl5/ | grep Uncompress | grep '\bInflate'`

Finally, I recommend you reinstall Bundle::CPAN and Bundle::Test.

Standard
Emacs

Emacs is not an island

Emacs is not an island. It can communicate with other programs smoothly, with a little tweak.

Tip 1: to enable copy-and paste between emacs and other X Window programs, put the following line into your .emacs file.

(setq x-select-enable-clipboard t)

Tip 2: install firefox extension, It’s All Text!, to edit textareas using external editor, including emacs.

Standard