From 9508574dcb8c37ff1cb8211e2fe845b2703d9141 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 10 Jun 2012 15:38:56 +0200 Subject: A more modular prompt. --- lib/Fripost/Tests.pm | 80 ---------------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100755 lib/Fripost/Tests.pm (limited to 'lib/Fripost/Tests.pm') diff --git a/lib/Fripost/Tests.pm b/lib/Fripost/Tests.pm deleted file mode 100755 index cfdfa47..0000000 --- a/lib/Fripost/Tests.pm +++ /dev/null @@ -1,80 +0,0 @@ -package Fripost::Tests; - -use 5.010_000; -use strict; -use warnings; -use utf8; - -=head1 NAME - -Tests.pm - -=cut - -our @EXPORT = qw/build_alias_graph search_path/; -our @ISA = qw(Exporter); - -use FindBin qw($Bin); -use lib "$Bin/lib"; - -use Fripost::Schema; - -sub build_alias_graph { - my $graph; - foreach (@_) { - my $to = $_->{goto}; - foreach my $from (@{$_->{address}}) { - push @{$graph->{$from}}, $to; - } - } - - return $graph; -} - - -sub search_path { - my ($graph, $from, $to) = @_; - - my @stack; - push @stack, [$from]; - - while (@stack) { - my $path = pop @stack; - my $last = @{$path}[$#$path]; - return @$path if $last eq $to; - - foreach (@{$graph->{$last}}) { - push @stack, [@$path,$_]; - } - } -} - - - - -=head1 AUTHOR - -Stefan Kangas C<< >> - -Guilhem Moulin C<< >> - -=head1 COPYRIGHT - -Copyright 2010,2011 Stefan Kangas. - -Copyright 2012 Guilhem Moulin. - -=head1 LICENSE - -This program is free software; you can redistribute it and/or modify it -under the same terms as perl itself. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -=cut - -1; # End of Tests.pm - -__END__ -- cgit v1.2.3