Created
June 21, 2011 20:54
-
-
Save gnusosa/1038873 to your computer and use it in GitHub Desktop.
Suggestion for user manual update.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Text::Buffer; | |
#Add the following to Dancer::Script | |
sub upgrade { | |
my $self = shift; | |
my $file = catfile($self->{path},$self->{appname},'lib',$self->lib_path},$self->{lib_file}); | |
my $deprecated = $self->deprecated; | |
my $text = Text::Buffer->new(-file=>"$file"); | |
foreach (keys ${$deprecated}){ | |
my $linenum = $text->find("/$_/"); | |
$text->goto($linenum); | |
$text->append("# ${$deprecated}{$_}"); | |
} | |
$text->save("$file.new"); | |
# Write the file as lib.pm.new just like catalyst.pl | |
}; | |
sub deprecated { | |
my $self = shift; | |
return { | |
# List of deprecated functions and options for Dancer. | |
# They should be added manually. | |
'layout' => "Deprecated. Use set: set layout => 'user';", | |
'logger' => "Deprecated. Use set logger = 'console'; to change current logger engine.", | |
'mime_type' => "Deprecated. Please see 'mime' in Dancer's documentation.", | |
'render_with_layout' => "Deprecated. you should be using 'engine'.", | |
'set_cookie' => "Soon to be deprecated. See Dancer::Cookie.", | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment