Hi Chris,

On Tuesday, November 26, 2002, at 04:04  PM, Chris Mungall wrote:
=head1 NAME

  XML::Stag - Structured Tags datastructures

=head1 SYNOPSIS

  # PROCEDURAL USAGE
  use XML::Stag qw(:all);
  $doc = stag_parse($file);
  @persons = stag_findnode($doc, "person");
  map {
    printf "%s, %s phone: %s\n",
      stag_sget($_, "family_name"),
      stag_sget($_, "given_name"),
      stag_sget($_, "phone_no"),
    ;
  } @persons

  # OO USAGE
  use XML::Stag;
  $doc = XML::Stag->new->parse($file);
  @persons = $doc->findnode("person");
  map {
    printf "%s, %s phone:%s\n",
      $_->sget("family_name"),
      $_->sget("given_name"),
      $_->sget("phone_no"),
    ;
  } @persons
I can't comment too much on the XML aspects of this module (my impression is that people would probably find it useful), but I do want to suggest that you change those map() calls to 'foreach' loops. See perlfaq6: "What's wrong with using grep or map in a void context?" for the reason.

Usually I don't care too much, but a SYNOPSIS section encourages other people to do things a certain way, so that's why I make this suggestion.

-Ken

Reply via email to