return uc($class);
}
-=head2 class2prefix( $class, $case );
+=head2 class2prefix( $class );
-Returns the uri prefix for a class. If case is false the prefix is converted to lowercase.
+Returns the uri prefix for a class. The prefix is converted to lowercase.
My::App::Controller::Foo::Bar becomes foo/bar
sub class2prefix {
my $class = shift || '';
- my $case = shift || 0;
my $prefix;
if ( $class =~ /^.+?::([MVC]|Model|View|Controller)::(.+)$/ ) {
- $prefix = $case ? $2 : lc $2;
+ $prefix = lc $2;
$prefix =~ s{::}{/}g;
}
return $prefix;
Returns a tempdir for a class. If create is true it will try to create the path.
My::App becomes /tmp/my/app
- My::App::C::Foo::Bar becomes /tmp/my/app/c/foo/bar
+ My::App::Controller::Foo::Bar becomes /tmp/my/app/c/foo/bar
=cut
# pop off /lib and /blib if they're there
$home = $home->parent while $home =~ /b?lib$/;
- # only return the dir if it has a Makefile.PL or Build.PL
- if (-f $home->file("Makefile.PL") or -f $home->file("Build.PL")) {
+ # only return the dir if it has a Makefile.PL or Build.PL or dist.ini
+ if (-f $home->file("Makefile.PL") or -f $home->file("Build.PL")
+ or -f $home->file("dist.ini")) {
# clean up relative path:
# MyApp/script/.. -> MyApp