Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

By the numbers reports

by frankus (Priest)
on Aug 07, 2002 at 14:26 UTC ( #188323=CUFP: print w/replies, xml ) Need Help??

In several jobs now, I've realised the importance of numbering sections in test scripts and specifications and stuff to clear up misunderstandings.
But it sure is a pain having to alter text files when someone adds an extra step or section or item...

So I made this. It took about 30 mins to write and test and it reminded me of all the fun you can have with formats.

Write a text file like this:

  • The firstline is the title of the whole thing.
  • a line starting S: is a section header
  • a line starting T: is a sub-heading
  • plain lines are items with a tick box

Of course it's simple, I am ;)

Example use for script
S:Easy to write
T:takes little time
I tied a file suffix in vim
Add a few macros
It's a doddle
T:I hate using word
I hate Microsoft
It sucks, for one
Okay this isn't great but
Did I ever say it was?

S:Easy to deploy
T:Just wanted to show
Several sections in action
Yeah it won't stretch over several lines yet :(

And cat it through the script like this:
cat example | ./checklist > output.txt

Feel free to hack it, ransack or ignore it ;)

#!/usr/bin/perl -w use strict; $==shift || 60;# Set lines per page $^='H';# Set header format %_=map{$_,0}('S'..'U'); # Make a list formats my $title=<>; # Set title to first line of input doc # Header format format H= + Page: @>>>> + $% @>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>>>>>>>>>>>>>> + `date` @||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +||||||||||||||||||||||||||||| $title @||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +||||||||||||||||||||||||||||| '=' x (length($title)-1) # that or chomp $ti +tle . # Section format format S= SECTION @# : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $_{S}, $_ ====================================================================== +============================ + Use box indicate outcome. . # Test section format format T= @>>>>>>>>>>>>> @#.@# : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<<<<<<<<<<<<<<<<<<<< 'TEST',$_{S},$_{T}, $_ . # Item section format format U= @>>>>>>>>>>>>>>>>>>>> @#.@#.@# : @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +<<<<<<<<<<<<<<<<<<<<<<<<<[ ] 'STEP',$_{S},$_{T},$_{U}, $_ . for(<>){ # until EOF chomp; # strip newline ($_,$~)=/:/?($',$`):($_,'U'); # choose format and output line. /\w/ or next; # if it's empty, move on. $_{$~=~/S/?'T':'U'}=0 if $~!~/U/; # Reset the next section counte +r in order $_{$~}++; # increment section counter write; # output template }


Brother Frankus.


Replies are listed 'Best First'.
Re: By the numbers reports
by tbone1 (Monsignor) on Aug 08, 2002 at 13:11 UTC
    Brother Frankus, my boss was talking about something vaguely like this the other day, throwing out words like 'streamline', 'standardize', 'flexibility' (not seeing these last two as the contradiction they can be), etc. I was more or less charged with doing something about it. This isn't precisely what we need, but you have saved me a good amount of drudgery and show leather. May your god (if any) bless you!

    As God is my witness, I thought turkeys could fly.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://188323]
Approved by graff
Front-paged by jarich
[Discipulus]: or a spanish one: ' qui mucho se despide no quiere despedirse'
shmem slides into the envelope
[shmem]: Discipulus *quien*
[Discipulus]: quien ..
[Discipulus]: me too, i need a Dumas time, see you
[shmem]: que descanses bien, aprendiz
shmem wuff & wech
[shmem]: erm. wrong link. wrong link!
[shmem]: que descanses bien, aprendiz
[Discipulus]: bravo!

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2017-04-29 22:59 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (534 votes). Check out past polls.