Guest User

Untitled

a guest
Jun 13th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #!perl
  2.  
  3. use strict;
  4. use warnings;
  5. use Test::More 'no_plan';
  6.  
  7. use MojoX::Routes;
  8. use MojoX::Routes::AsGraph;
  9.  
  10. ### The top level container
  11. my $r = MojoX::Routes->new;
  12.  
  13. ### A couple of simple paths
  14. $r->route('/')->to( controller => 'site', action => 'homepage' );
  15. $r->route('/about')->to( controller => 'site', action => 'about' );
  16.  
  17. my $g = MojoX::Routes::AsGraph->new({ routes => $r });
  18. ok($g);
  19.  
  20. my $graph = $g->graph($r);
  21. print $graph->as_ascii;
  22.  
  23. +---------+ +----------+
  24. | <empty> | --> | * /about |
  25. +---------+ +----------+
  26. |
  27. |
  28. v
  29. +---------+
  30. | * / |
  31. +---------+
Add Comment
Please, Sign In to add comment