Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling


by PERLscienceman (Curate)
on Feb 23, 2004 at 03:30 UTC ( #331013=modulereview: print w/replies, xml ) Need Help??

Item Description:

Review Synopsis: Package to convert between ASCII text and MORSE alphabet.

CPAN LINK: Convert::Morse
CPAN ABSTRACT: Package to convert between ASCII text and MORSE alphabet.
This module caught my eye as yet another 'Cool Use For Perl', appealing to both the avid Perl Programmer and Amateur Radio Hobbyist inside me.
In a nutshell, Convert::Morse converts an ascii string to equivalent International Morse Code dots and dashs and visa-versa. In addition, the module contains a function to check and see if a particular ascii string "is morsable", convertable to a valid morse code string.
Demo Code:

#!/usr/bin/perl use strict; use Convert::Morse qw(as_ascii as_morse is_morsable); print as_ascii('.... . .-.. .-.. --- -- --- .-. ... .'),"\n"; # 'Hell +o Morse' print as_morse('Perl?'),"\n"; # '.--. . .-. .-.. ..--.. +' print "Yes!\n" if is_morsable('Hello Perl.'); # print "Yes!"
Bug(s) Found:
None immediately found with preliminary testing.
Module Author Noted Limitation:
Can not yet do Japanese code nor German Umlaute.

Final Thoughts:
With further tinkering I found this module to be quite useful in converting English text to valid dot-dash-spaces International Morse Code; indeed another Cool Use For Perl for both die-hard those who are both Die-Hard Perl Programmers and Radio Enthusiasts alike.
UPDATE:There is indeed only one International Morse Code recognized by International Treaty that does not include japanese or umlaute character sets; Thanks to theorbtwo for pointing that out.

Replies are listed 'Best First'.
Re: Convert::Morse
by theorbtwo (Prior) on Feb 23, 2004 at 07:48 UTC

    Uh, there is only one true morse code, and it doesn't include japanese, umlaute, or even an exlemation point.

    And I say not that because of standards-worship, but because morse code is what it is by international treaty, and (at least as I understand it), if you don't know that, you can't use the approprate bands. IOW, if you send "überrhacking" in morse over a frequency where morse or voice is allowed, you're in violation of the treaty, since that isn't morse. Similarly, if, on your code test, you are asked to encode "übergeschloss", the correct answer is "it can't be done in morse", or morse("uebergeschloss").

    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Re: Convert::Morse
by Mr. Muskrat (Canon) on Feb 23, 2004 at 03:40 UTC
      Drats! I dragged this module out of it's coma (from 2001!) a few weeks ago to fix a bug with ")" and "(" in morse, only to forget about "@" :-( Oh well. About International Morse Code: Quite a few people obviously use their own encoding for their characters, like the Japanese, or the German Umlaute. (Convert Morse also does contain more than the regular characters). This dilemma could be solved with a "strict" mode. Maybe the module should finally be made OO. Tels Btw: The link to the "@" is dead.
Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: modulereview [id://331013]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2023-12-07 14:31 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (32 votes). Check out past polls.