Archive for the 'CPAN' Category

02
Nov

New WebService::MusicBrainz Releases – 0.90, 0.91, and 0.92

0.90 Tue Oct 13th 2009
	- RT Bug 48661 - Chris Key
		- Integrated supplied patch
		- Added ISRC support
	- RT Bug 50054 - Peter Oliver
		- Integrated supplied patch
		- Fixed UTF8 support
	- Made compliant with MMD 1.4 schema
	- Rewrote test cases (still more to do)
	- Added support for direct Lucene queries (suggest: Dave Hodgkinson)

0.91 Mon Oct 19th 2009
	- RT Bug 50581 - Andreas Koenig
		- Added prereq for Test::More 0.88

0.92 Sat Nov 1st 2009
	- Fixed failing test in Release.t
CPAN Link
03
Feb

New Release of WebService::MusicBrainz

0.21 Mon Feb 2nd 2009
	- RT Bug 42482 - orivej
            - Changed URI creation for multiple INC params
	- RT Bug 42534 - Chris Key
	    - Applied patch to fix tag and alias parsing
	- fixed failing test in Artist.t
        - Added documentation about multiple INC params
        - Added test case to Artist.t for multiple INC params

Link
06
Jan

New CPAN release of WebService::MusicBrainz

0.20 Mon Jan 5th 2009
    - RT Bug 40597 - Slaven
         - Updated Build.PL perl version
    - RT Bug 42169 - pbryan
         - Fixed PUID object creation
         - Added test cases for PUID objects to Track.t

LINK
13
Aug

YUI and parsing JSON

Am I missing something here?  I started a web app using YUI.  The server can generate XML or JSON as a response.  I started with XML but I found the parsing rather limited.  I switched to JSON using the XML::XML2JSON module on CPAN.  This produces JSON following a convention set up by Google.  It seems that YUI can not parse data in this format.

{"encoding":"UTF-8","version":"1.0",
 "metadata":{
    "artist-list":{
        "artist":{
           "life-span":{"@begin":"1992-02-14"},
           "sort-name":{"$t":"Weezer"},
           "name":{"$t":"Weezer"},
           "@id":"6fe07aa5-fec0-4eca-a456-f29bff451b04",
           "@ext:score":"100",
           "@type":"Group"
         },
     "@count":"1","@offset":"0"
   }}}

I found that I can get around the invalid “$t” and “-” in the name string by using a different syntax for JSON location code which includes using brackets and single quotes instead of periods.

mySearchDataSource.responseSchema = {
          resultsList: "['metadata']['artist-list']['artist']",
          fields: ["['sort-name']['$t']", "['@type']", "['@ext:score']"],
                 metaFields: {
                    totalRecords: "['metadata']['artist-list']['@count']"
                 }
             };

But YUI still does not like the “@” in the front of names and the “:” in the middle of a name.

I guess I have these choices:

  1. Switch server response to XML.  Write custom parseXMLData method for YUI DataSource.
  2. Write my own parseJSONData method for YUI DataSource.
  3. Write my own XML -> JSON conversion which constucts JSON data that YUI is happy with.
  4. Server side hack to “clean” JSON data of any offending characters.

Now I’m off to do some more research on this…

15
May

WebService::MusicBrainz 0.18

Change log:

0.18 Wed May 14th 2008
- Update test in Release.t (Stefan)

WebService::MusicBrainz

03
Mar

New CPAN Release of WebService::MusicBrainz

Change log:

0.17 Sat Mar 2 2008
- Added URI escaping to URL (Edward Allen)
- Added support for label, catno, and barcode in release events
- Changed how first object returned from collection (was shift, now ->[0])
- Added delays in test scripts to help not exceed webservice request threshold
- Updated test cases

WebService::MusicBrainz

12
Feb

XML::Twig and mixed content

Trying to rush and write a quick script to update some XML files, I forgot how XML parsers deal with mixed content.

Example XML:

 	<para>Some TEXT to display with a <link xlink:href="DOC1">link to DOC1</link>, followed by some more TEXT.</para>

Say I wanted to update the string “TEXT” to “text” so the sentence reads better. Originally, I thought the code would look like this.

foreach my $xPara ($xRoot->get_xpath(’.//para’)) {

my $text_content = $xPara->text();

$text_content =~ s/TEXT/text/s;

$xPara->set_text($text_content);

}

It turns out this is incorrect because it blows away the <link> tag but leaves it’s PCDATA content.The thing to remember here is that there are 3 children to the <para> tag. they are the first PCDATA node (the text before the link node), the <link> node, and the second PCDATA node (after the link node).

Here is some code that updates the XML correctly.

foreach my $xPara ($xRoot->get_xpath(’.//para’)) {

foreach my $xChild ($xPara->children()) {

if($xChild->is_text()) {

my $text_content = $xChild->text();

$text_content =~ s/TEXT/text/s;

$xChild->set_text($text_content);

}

}

}

03
Dec

New CPAN Releases of WebService::MusicBrainz

Change log:

0.14 Mon Dec 3 2007
- Fixed test count in Release.t

0.15 Mon Dec 3 2007
- Added “URI” to required modules in Build.PL

Here is the link: WebService::MusicBrainz

02
Dec

New CPAN Release of WebService::MusicBrainz

Change log:

0.13 Sun Dec 2 2007
- Fixed failing tests in Release.t

Here is the link: WebService::MusicBrainz

16
Nov

New CPAN Release of WebService::MusicBrainz

Change log:

0.12 Thu Nov 15 2007
- More compliant with 1.2 MMD Schema
- Added “label” support and test cases
- Fixed test case count in Release.t

Enjoy