Next Tricks of the Wizards 179

State Machines For NNTP

        %machine = (        
          START => { DEFAULT=> [ \&say_hello, MAIN, ],
                   },
          MAIN  => { group =>  [ \&cmd_group, MAIN],
                     quit  =>  [ \&cmd_quit,  MAIN],
                     post  =>  [ \&cmd_post,  HEADER],
                     ...
                   },
          HEADER =>{ BLANK =>  [ \&article_save_header, BODY],
                     DOT   =>  [ undef,                 ARTICLE_FINISH ],
                     DEFAULT=> [ \&store_line,          HEADER ],
          ...
        );


Next Copyright © 2003 M. J. Dominus