Congratulations, you've found another bug in CGI.pm's html generation subroutines, hooray, you should report it :)
#!/usr/bin/perl -- use strict; use warnings; use CGI::Pretty; my %labels = ( 'eenie' => 'your first choice', 'meenie' => 'your second choice', 'minie' => 'your third choice' ); print "\n------ broken (the example in the docs), unsurprising, its un +tested ----------\n"; print CGI::Pretty->checkbox_group( 'group_name', [ 'eenie', 'meenie', 'minie', 'moe' ], [ 'eenie', 'moe' ], 'true', \%labels, { 'moe' => { 'class' => 'red' }, 'eenie' => { 'class' => 'yo' }, } ); print "\n----- works (also documented but untested) -----------\n"; print CGI::Pretty->checkbox_group( -name => 'group_name', -values => [ 'eenie', 'meenie', 'minie', 'moe' ], -default => [ 'eenie', 'moe' ], -linebreak => 'true', -labels => \%labels, -attributes => { 'moe' => { 'class' => 'red' }, 'eenie' => { 'class' => 'yo' }, } ); __END__ ------ broken (the example in the docs), unsurprising, its untested -- +-------- <label eenie="HASH(0xa7d7a4)" moe="HASH(0xa7d6b4)"> <input type="checkbox" name="group_name" value="eenie" checked +="checked" />your first choice </label> <br /><label eenie="HASH(0xa7d7a4)" moe="HASH(0xa7d6b4)"> <input type="checkbox" name="group_name" value="meenie" />your + second choice </label> <br /><label eenie="HASH(0xa7d7a4)" moe="HASH(0xa7d6b4)"> <input type="checkbox" name="group_name" value="minie" />your +third choice </label> <br /><label eenie="HASH(0xa7d7a4)" moe="HASH(0xa7d6b4)"> <input type="checkbox" name="group_name" value="moe" checked=" +checked" />moe </label> <br /> ----- works (also documented but untested) ----------- <label> <input type="checkbox" name="group_name" value="eenie" checke +d="checked" class="yo"/>your first choice </label> <br /><label> <input type="checkbox" name="group_name" value="meenie" />you +r second choice </label> <br /><label> <input type="checkbox" name="group_name" value="minie" />your + third choice </label> <br /><label> <input type="checkbox" name="group_name" value="moe" checked= +"checked" class="red"/>moe </label> <br />

In reply to Re: Using labelattributes with CGI's checkbox_group by Anonymous Monk
in thread Using labelattributes with CGI's checkbox_group by richardwfrancis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.