|
NAMEText::Tags::Parser - parses "folksonomy" space-separated tagsSYNOPSISuse Text::Tags::Parser; my @tags = Text::Tags::Parser->new->parse_tags(q{ foo bar "baz bap" jenny's 'beep beep' }); my $line = Text::Tags::Parser->new->join_tags('foo', 'bar', 'baz bap', "jenny's", 'beep beep'); DESCRIPTIONParses "folksonomies", which are simple space-or-comma-separated-but-optionally-quoted tag lists.Specifically, tags can be any string, as long as they don't contain both a single and a double quote. Hopefully, this is a pretty obscure restriction. In addition, all whitespace inside tags is normalized to a single space (with no leading or trailing whitespace). In a tag list string, tags can optionally be quoted with either single or double quotes. There is no escaping of either kind of quote, although you can include one type of quote inside a string quoted with the other. Quotes can also just be included inside tags, as long as they aren't at the beginning; thus a tag like "joe's" can just be entered without any extra quoting. Tags are separated by whitespace and/or commas, though quoted tags can run into each other without whitespace. Empty tags (put in explicitly with "" or '') are ignored. (Note that commas are not normalized with whitespace, and can be included in a tag if you quote them.) Why did the previous paragraph need to be so detailed? Because Text::Tags::Parser always successfully parses every line. That is, every single tags line converts into a list of tags, without any error conditions. For general use, you can just understand the rules as being separate tags with spaces or commas, and put either kind of quotes around tags that need to have spaces. METHODS
DEPENDENCIESNone.BUGS AND LIMITATIONSThe rules are kind of complicated, but at least they are well-defined.Please report any bugs or feature requests to "bug-text-tags@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. SEE ALSOText::Folksonomies, a module with similar functionality but has much more simplistic quote handling. (Specifically, it doesn't allow you to put any type of quote into a tag.) But if you don't care about that sort of support, it seems to work fine.AUTHORDavid Glasser "<glasser@bestpractical.com>"LICENCE AND COPYRIGHTCopyright (c) 2005, Best Practical Solutions, LLC. All rights reserved.This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic. DISCLAIMER OF WARRANTYBECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Visit the GSP FreeBSD Man Page Interface. |