NAME
Meta::Lang::Lily::InfoParser - parser for Lilypond general info.
COPYRIGHT
Copyright (C) 2001, 2002 Mark Veltzer; All rights reserved.
LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
DETAILS
MANIFEST: InfoParser.pm
PROJECT: meta
VERSION: 0.03
SYNOPSIS
package foo;
use Meta::Lang::Lily::InfoParser qw();
my($parser)=Meta::Lang::Lily::InfoParser->new();
my($res)=$parser->parse("autumn_leaves.ly");
if(!$res) {
die("bad bad file!!!");
}
my($composer)=$object->get_composer();
# composer should now be Joseph Kosma & Jacques Prévert
DESCRIPTION
This documentation assumes that you know what Lilypond is. If not then get to know it (http://www.lilypond.org).
This module takes lilypond files as input and extracts the header information out of them.
A Lilypond header looks like this:
\header{ filename="chega_de_saudae.ly" title="Chega De Saudade" subtitle="No More Blues" composer="Antonio Carlos Jobim" enteredby="Laurent Martelli" copyright="© 1962,1967 Editora Musical Arapua, Sao Paulo, Brazil" style="Jazz" source="laurent@bearteam.org" }
And the tags here are the only ones currently supported by this module.
To use this module all you need to do is create a parser and then call its parse method. After the method is over you can you the accessor methods to get the various tags. Any tag that wasn't found will have the default value of "" (nothing).
If you need any enhancements to this module please email me.
This module uses the excellect Parse::RecDescent module to do it's thing.
FUNCTIONS
BEGIN()
new($)
parse($$)
deslashify($)
handle_assignment()
TEST($)
FUNCTION DOCUMENTATION
- BEGIN()
-
This is an object initializer which sets up accessor methods for the following attributes: title : title of the piece. subtitle : sub title of the piece. composer : composer of the piece. enteredby : the author of the lilypond file. copyright : holder of copyright for the piece. style : style of the piece. source : source of the piece.
- new($)
-
A constructor for this object.
- parse($$)
-
This is the actual method which does the parsing. You need to give it a parser object and a file to parse.
- deslashify($)
-
This method removes slashes put in the lilypond values to protect certain characters.
- handle_assignment()
-
This method handles assignments to variables.
- TEST($)
-
Test suite for this module.
SUPER CLASSES
Parser::RecDescent(3)
BUGS
None.
AUTHOR
Name: Mark Veltzer
Email: mailto:veltzer@cpan.org
WWW: http://www.veltzer.org
CPAN id: VELTZER
HISTORY
0.00 MV web site development
0.01 MV web site automation
0.02 MV SEE ALSO section fix
0.03 MV md5 issues
SEE ALSO
Meta::Class::MethodMaker(3), Meta::Utils::File::File(3), Meta::Utils::Output(3), Parse::RecDescent(3), strict(3)
TODO
-add more parsing capabilities (midi, score etc...).
-make this module inherit from Parse::RecDescent. I had problems with it so I stopped trying and some of the code is still there commented out.
-this module is not threading safe. (because of the global var).
-the declaration of the values here do not allow for all special characters and so I added a few there but this is hardly satisfactory.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 191:
Non-ASCII character seen before =encoding in 'Prévert'. Assuming UTF-8