# Muttprofile and Perl 5.8.0

Muttprofile was developed using Perl version 5.005 and it also runs nicely with Perl 5.6.0 and Perl 5.6.1. However, I got some bug reports that muttprofile does not work with Perl 5.8.0. So, I investigated the problem and here's what I found and how to fix it. Please note that the problem is now history: muttprofile works fine with Perl 5.8.1!

### Symptons

The symptons are that muttprofile gives a nasty looking error message (similar to the one below) and messes up the terminal by loosing the line breaks.

    /bin/stty: invalid argument `2d00:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:ff:12:f:17:16:ff:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
                                                                             '
                                                                              Try `/bin/stty --help' for more information.

It turned out that the problem was related to Perl-module Term::Complete which comes with all Perl5 distributions. Muttprofile uses this module for taking care of the interactive selection of profiles. However, muttprofile actually works despite the error!

### Solution

I managed to find the bug in Term::Complete and, luckily, it was easy to fix. I contacted the Perl maintainers with a fixed version and it was included in the Perl development tree. Fixed version is now available with perl 5.8.1 and later.

### How can I get it to work?

You have at least three options for making muttprofile work with Perl 5.8.0:

Option 1:
Look for Perl 5.8.1 and install it. It includes a new version of the Term::Complete module which does not have the stty-problem anymore.

Option 2:
If you're stuck with 5.8.0 for some reason, you may use the following quick-and-dirty workaround:

In your macro for calling muttprofile, add the command 'stty -raw echo' after the muttprofile command. This will get the line breaks back. If you want to get rid of the stty error too, redirect stderr to /dev/null when calling muttprofile. In other words use macro defition such as this:

    macro   index   <F9>     "<enter-command>set wait_key\n!~/bin/muttprofile 2> /dev/null;stty -raw echo\n:source ~/.mutt/profile.active\n<enter-command>unset wait_key\n" "Call muttprofile without stty error"

Option 3:
Upgrade the Term::Complete-module manually. The fixed version is available here. Remember to make a backup of the original version, just in case.

I have tested these solutions with Debian but I see no reason why they wouldn't work on RedHat 8 or other unix systems with perl 5.8.0.

## Acknowledgments

Thanks to Marco Fioretti of the RULE Project for informing me about the problem and noticing the typo on my quick'n'dirty fix :-)

Jarkko Hietaniemi deserves credit for helping out with the fix as well as his huge contributions to the Perl community.

## Back to muttprofile

URL: http://www.iki.fi/martti.rahkila/mutt/muttprofile_perl580.html
Last update: 2003-11-20
Author: Martti Rahkila