b0VIM 5.7;(dodgergc~dodger/cpan/Lister/HTML/Lister/Lister.pm3210#"! Utpk OpFYadkhZ8_< x K y :  _   ~ r [ 9 + p T 0 bI{J n0nPO@)xmW5mQ- _Fit encounters a referenc my ($class,$type) = $refval =~ /^(.*)\=(.*)\(.*\)$/; my $refval = sprintf '%s', $val; !$ref) { $ref eq 'LVALUE' or $ref eq 'GLOB' or $ref eq 'REF' or $ref eq 'CODE' or $ref eq 'HASH' or $ref eq 'ARRAY' or unless ($ref eq 'SCALAR' or my $ref = ref $val; my $val = shift @stuff; push @list, sprintf "
%s
", shift(@stuff); while (@stuff) { undef; " $hashparams": $hashparams ? push @list, sprintf "
%s", @stuff = @_;} else { push @stuff, $k, $v;}} while (my ($k,$v) = each %{$_[0]}) { if (ref $_[0] eq 'HASH') { my @stuff; my @list; my $caller = $class->{'caller'}; my $class = shift;sub hashList { return join "\n", @list;} push @list, ''; "
  • $val
  • ";} $ref, $val : sprintf "
  • %s
  • (%s)", $class->hashList(%$val) : $ref eq 'HASH' ? $class->List(@$val) : $ref eq 'ARRAY' ? sprintf "
  • %s
  • ", $$val : $ref eq 'SCALAR' ? $ref ? push @list, sprintf "%s", $ref = $type;} my ($class,$type) = $refval =~ /^(.*)\=(.*)\(.*\)$/; my $refval = sprintf '%s', $val; !$ref) { $ref eq 'LVALUE' or $ref eq 'GLOB' or $ref eq 'REF' or $ref eq 'CODE' or $ref eq 'HASH' or $ref eq 'ARRAY' or unless ($ref eq 'SCALAR' or my $ref = ref $val; my $val = shift; while (@_) { undef; " $aryparams": $aryparams ? push @list, sprintf "", my @list; $class->{'caller'} = 'oList'; my $class = shift;sub oList { return join "\n", @list;} push @list, ''; "
  • $val
  • ";} $ref, $val : sprintf "
  • %s
  • (%s)", $class->hashList(%$val) : $ref eq 'HASH' ? $class->List(@$val) : $ref eq 'ARRAY' ? sprintf "
  • %s
  • ", $$val : $ref eq 'SCALAR' ? $ref ? push @list, sprintf "%s", $ref = $type;} my ($class,$type) = $refval =~ /^(.*)\=(.*)\(.*\)$/; my $refval = sprintf '%s', $val; !$ref) { $ref eq 'LVALUE' or $ref eq 'GLOB' or $ref eq 'REF' or $ref eq 'CODE' or $ref eq 'HASH' or $ref eq 'ARRAY' or unless ($ref eq 'SCALAR' or my $ref = ref $val; my $val = shift; while (@_) { undef; " $aryparams": $aryparams ? push @list, sprintf "", my @list; $class->{'caller'} = 'List'; my $class = shift;sub List {my $hashparams = '';my $aryparams = '';$VERSION = '0.01';package HTML::Lister;adEqF'a   / k Q P  b  } P &   : !^]'wvq=cutperl(1), CGI(3)=head1 SEE ALSOAll rights reserved, all rites reversed.This module is implicitly and explicitly distributed under the Perl Artistic Licence.not a lwayer.Umm, call it the Artistic Licence. I hate the legal crap part. Dammit, Jim, I'm a programmer,=head1 LICENCEContact me if you want to help or patch anything on the TO DO list.Dodger (Sean Cannon) dodger@dodger.org=head1 AUTHORFigure out how to properly pluralise an inherently possessive proper noun.Figure out why all the Denny'ses are closing down.Figure out that blasted blessed hashList issue. And remember the answer later.easy way to list all the associated entities of a glob ref.references, like displaying the first 160 characters of code in a PRE tag for a coderef, or someI'd love it if someone would help me find an easy way to get at the actual stuff of other types ofthe sub-entity parametres as well (the DT, DD, and LI items).I should also give some thought to a better approach to setting up tag parametres, and supportingapproach. This way it could be wrapped into CGI.pm and thus be much more widely used.sure how that would work since some parts, like remembering what called it, is implicitly OO inIt would be nice if I could get some help building a non-OO version of this, too. However, I'm not=head1 TO DO LIST=backThese default to '', so the list entities default to being a plain tag ('
      ,
      ,
        ')
        and your HTML entity will look like this:$HTML::Lister::hashparams = ' class="purdy"'For instance, to set a CSS class on your definition lists, you might do this:will want to start anything you put here with a space.Whatever is in these variables will appear in the entity's tag, right after the *l -- thus you$HTML::Lister::hashparams directly to set up additional paramatres for the HTML code created.I'll admit this is badly kludged in. You can access the variables $HTML::Lister::aryparams and=item CSS support and additional tag parametresyou can't do everything).now (no offense to that wonderful module that I use all the time or it's writers or maintainers --point. Nevertheless, this is a far cry better than the listing functions built into CGI.pm rightbut you will simply get GLOB(0x80f1098) or CODE(0x80fd9d8) or whatever. It can't see past thatNone of these methods are intended for use with other kinds of references. They won't break it,=item notes on all methodson a number of occassions, but I never remember when the Sudafed and NyQuil wear off.on this one. I'm sure there's a perfectly rational explanation, and I think I have come up with itor hand it off through List, which will do the job for you. Honestly, I'm still scratching my headDo not hand hashList a blessed hashref... it won't work. Dereference it first (i.e. hashList(%$cgi)(bulleted lists).and calls the appropriate method on it. If it is called explicitly, sub-lists will be UL entitiesad9 f> `-  Z A # "   ;: ] \ ~ } n m e d C B n    E ~ j i iML:T5*hAs with the other two methods, hashList() recognises when it encounters a reference, dereferences it,become DDs.case of handing it an array or list, the even-indexed items become DTs and the odd-indexed itemsdefinition list (DL entity). The keys become DT entities and the values become DD entities. In thean arrayref or listref almost definitely will *not* do what you want. hashList creates an HTMLif you want, and hand it an array or list, too, and it may give you what you expect. Handing itThe hashList() method takes a hash or hashref as an argument. You can use it in a utility fashion,=item hashList()lists all the way in. This is to be considered cool.will get numbered lists all the way in. If you start with bulleted lists, you will get bulletedcame from and call oList again, not List. In other words, if you start with numbered lists, youfinds a hashref, and that hash contains an arrayref, the object will in fact remember where itIt should be noted somewhere (and here seems like a good place) that if you call oList, and oListdepending on their nestedness).HTML OL entities -- that is, ordered lists. That means they're numbered (or lettered, or whatever,The oList() method works just like the List() method, except that the lists it creates are=item oList()method sees it anyway, which is also why handing it a hash won't work).Oh, yeah -- a plain list or listref works nicely, too. (It's an array -- @_ -- by the time theworks, but handing it a real hash won't -- the keys and values end up as @_ as an array.call hashList. If it's an array, it will call itself. That's also why just handing it a hashrefappropriate method on that item if it dereferences to an array or hash. If it's a hashref, it willIf List() encounters a reference in any of its argument list, it will dereference it and call thescalarref handed off to List() will return a list of one item.An array or arrayref handed to List will create a proper bulleted unordered list. A scalar orhashList() instead.debugging purposes, which is Lister's main utilisation. If you want to avoid this, hand it off toside effect of indenting any lone hashref it's handed, but it will still work and doesn't matter forlist with no LI entities, but with a definition list inside it. This has the potentially annoyingIf it receives a hashref, it calls hashList on the dereferences hashref, making an unorderedit gets.(though the latter is admittedly pointless) and makes an unordered list (UL entity) out of whatList() is the primary method of Lister. It takes any array, arrayref, hashref, or scalar value=item List()This is just the typical constructor method. It currently takes no arguments and provides no options.=item new() (constructor method)=over 4=head1 METHODSPut then again, that's where Perl itsel1||'Happy Happy, Joy Joy'; # 1s are so boring return bless {}, ref $class || $class; } my $class = shift;sub new { return join "\n", @list;} push @list, '
        '; $val;} $ref, $val : sprintf "%s(%s)", $class->hashList(%$val) : $ref eq 'HASH' ? $class->List(@$val) : $class->oList(@$val) : $caller eq 'oList' ? $ref eq 'ARRAY' ? $$val : $ref eq 'SCALAR' ? $ref ? push @list, sprintf "
        %s
        ", $ref = $type;}adOjC!L n " ! K J = < } t s  O z ; : u\F&%don]\:vjiAs AAAAs with the other two methods, hashList() recognises when it encounters a reference, dereferences it,become DDs.case of handing it an array or list, the even-indexed items become DTs and the odd-indexed itemsdefinition list (DL entity). The keys become DT entities and the values become DD entities. In thean arrayref or listref almost definitely will *not* do what you want. hashList creates an HTMLif you want, and hand it an array or list, too, and it may give you what you expect. Handing itThe hashList() method takes a hash or hashref as an argument. You can use it in a utility fashion,=item hashList()lists all the way in. This is to be considered cool.will get numbered lists all the way in. If you start with bulleted lists, you will get bulletedcame from and call oList again, not List. In other words, if you start with numbered lists, youfinds a hashref, and that hash contains an arrayref, the object will in fact remember where itIt should be noted somewhere (and here seems like a good place) that if you call oList, and oListdepending on their nestedness).HTML OL entities -- that is, ordered lists. That means they're numbered (or lettered, or whatever,The oList() method works just like the List() method, except that the lists it creates are=item oList()method sees it anyway, which is also why handing it a hash won't work).Oh, yeah -- a plain list or listref works nicely, too. (It's an array -- @_ -- by the time theworks, but handing it a real hash won't -- the keys and values end up as @_ as an array.call hashList. If it's an array, it will call itself. That's also why just handing it a hashrefappropriate method on that item if it dereferences to an array or hash. If it's a hashref, it willIf List() encounters a reference in any of its argument list, it will dereference it and call thescalarref handed off to List() will return a list of one item.An array or arrayref handed to List will create a proper bulleted unordered list. A scalar orhashList() instead.debugging purposes, which is Lister's main utilisation. If you want to avoid this, hand it off toside effect of indenting any lone hashref it's handed, but it will still work and doesn't matter forlist with no LI entities, but with a definition list inside it. This has the potentially annoyingIf it receives a hashref, it calls hashList on the dereferences hashref, making an unorderedit gets.(though the latter is admittedly pointless) and makes an unordered list (UL entity) out of whatList() is the primary method of Lister. It takes any array, arrayref, hashref, or scalar value=item List()This is just the typical constructor method. It currently takes no arguments and provides no options.=item new() (constructor method)=over 4=head1 METHODSPut then again, that's where Perl itself came from!on a regular basis, debugging CGI scripts live through a browser and so on.Honestly, I hacked this thing together quickly out of need, but it's becomes somehting I useHTML list entity from the contents.unaddressed -- it handles multidimensional objects, calling itself recursively to create anHTML::Lister is a small HTML utility that addresses a built-in function that CGI.pm has left=head1 DESCRIPTION print $lister->List($hashref); print $lister->hashList(%hash); print $lister->oList(@array); print $lister->List($arrayref); print "Content-type: text/html\n\n"; my $lister = new HTML::Lister; use HTML::Lister;=head1 SYNOPSISHTML::Lister - Multidimensional Structure to HTML List Converter=head1 NAME