On Sun, Mar 29, 2009 at 6:03 AM, <[email protected]> wrote: > Author: barney > Date: Sun Mar 29 10:03:15 2009 > New Revision: 37810 > URL: https://trac.parrot.org/parrot/changeset/37810 > > Log: > [library] neater usage messages > > Modified: > trunk/runtime/parrot/library/dumper.pir > trunk/runtime/parrot/library/yaml_dumper.pir > > Modified: trunk/runtime/parrot/library/dumper.pir > ============================================================================== > --- trunk/runtime/parrot/library/dumper.pir Sun Mar 29 04:42:51 2009 > (r37809) > +++ trunk/runtime/parrot/library/dumper.pir Sun Mar 29 10:03:15 2009 > (r37810) > @@ -11,16 +11,13 @@ > > =head1 SYNOPSIS > > - ... > - # dump the P0 register > - _dumper( P0 ) > - > - # dump the P0 register, with "name" > - _dumper( P0, "name" ) > - ... > - > - END > .include "dumper.pir" > + > + # dump the $P0 register > + _dumper( $P0 ) > + > + # dump the $P0 register, with "name" > + _dumper( $P0, "name" ) > > > =head1 DESCRIPTION > @@ -30,13 +27,18 @@ > =cut > > # first method prints usage information > -.sub __library_dumper_onload > - print "usage:" > - print "\tload_bytecode \"Data/Dumper.pir\"\n" > - print "\t...\n" > - print "\tnew dumper, \"Data::Dumper\"\n" > - print "\tdumper.\"dumper\"( foo, \"foo\" )\n\n" > - end > +.sub __library_dumper_print_usage > + say "# usage:" > + say ".sub main" > + say " load_bytecode 'Data/Dumper.pir'" > + say '' > + say " .local pmc foo, dumper" > + say " foo = new 'ResizablePMCArray'" > + say " dumper = new 'Data::Dumper'" > + say '' > + say " dumper.'dumper'( foo, 'foo' )" > + say ".end" > + say '' > .end
Say trumps print, but what about a heredoc? > .include "errors.pasm" > > Modified: trunk/runtime/parrot/library/yaml_dumper.pir > ============================================================================== > --- trunk/runtime/parrot/library/yaml_dumper.pir Sun Mar 29 04:42:51 > 2009 (r37809) > +++ trunk/runtime/parrot/library/yaml_dumper.pir Sun Mar 29 10:03:15 > 2009 (r37810) > @@ -11,32 +11,34 @@ > > =head1 SYNOPSIS > > - ... > + .include "yaml_dumper.pir" > + > # dump the P0 register > - yaml( P0 ) > + yaml( $P0 ) > > # dump the P0 register, with "name" > - yaml( P0, "name" ) > - ... > - > - END > - .include "yaml_dumper.pir" > + yaml( $P0, "name" ) > > > =head1 DESCRIPTION > > - PIR implementation of Perl 5's Data::Dumper module to dump YAML format. > +PIR implementation of Perl 5's Data::Dumper module to dump YAML format. > > =cut > > # first method prints usage information > -.sub __library_dumper_onload > - print "usage:" > - print "\tload_bytecode \"YAML/Dumper.pir\"\n" > - print "\t...\n" > - print "\tnew yaml, \"YAML::Dumper\"\n" > - print "\tyaml.\"yaml\"( foo, \"foo\" )\n\n" > - end > +.sub __library_yaml_dumper_print_usage > + say "# usage:" > + say ".sub main" > + say " load_bytecode 'YAML/Dumper.pir'" > + say '' > + say " .local pmc foo, yaml_dumper" > + say " foo = new 'ResizablePMCArray'" > + say " yaml_dumper = new 'YAML::Dumper'" > + say '' > + say " yaml_dumper.'yaml'( foo, 'foo' )" > + say ".end" > + say '' > .end > > .include "errors.pasm" > _______________________________________________ > http://lists.parrot.org/mailman/listinfo/parrot-commits > -- Will "Coke" Coleda _______________________________________________ http://lists.parrot.org/mailman/listinfo/parrot-dev
