にある Catalyst 内部サーバーを実行するとscripts/MyApp_server.pm
、次のエラーが表示されます。この点で私を助けることができる人はいますか?私は、catalyst.pl によって作成されたファイルを変更していません。Catalyst.pl MyApp を実行してから、scripts/MyApp_server.pl -r を実行して、Catalyst が機能するかどうかをテストしました。これは私がやったことだけです!yum と cpan のいずれかを使用して、Catalyst とその依存モジュールを数回再インストールしました。しかし、それは再び機能しません。
ありがとう!
エラーメッセージ:
Can't use an undefined value as a HASH reference at /usr/local/share/perl5/Catalyst.pm line 2681.
BEGIN failed--compilation aborted at /home/Ali/Lab/WEB/catalyst/MyApp3/script/../lib/MyApp3.pm line 20.
Compilation failed in require at /usr/local/lib/perl5/Class/MOP/Method/Wrapped.pm line 50
/usr/local/share/perl5/Catalyst.pm の 2681 行付近のコードは次のとおりです。
sub setup_home {
my ( $class, $home ) = @_;
if ( my $env = Catalyst::Utils::env_value( $class, 'HOME' ) ) {
$home = $env;
}
$home ||= Catalyst::Utils::home($class);
if ($home) {
#I remember recently being scolded for assigning config values like this
$class->config->{home} ||= $home; # THIS IS LINE 2681
$class->config->{root} ||= Path::Class::Dir->new($home)->subdir('root');
}
}
lib/MyApp.pm の内容は次のとおりです。
package MyApp;
use Moose;
use namespace::autoclean;
use Catalyst::Runtime 5.80;
# Set flags and add plugins for the application
#
# -Debug: activates the debug mode for very useful log messages
# ConfigLoader: will load the configuration from a Config::General file in the
# application's home directory
# Static::Simple: will serve static files from the application's root
# directory
use Catalyst qw/
-Debug
ConfigLoader
Static::Simple
/;
extends 'Catalyst';
our $VERSION = '0.01';
$VERSION = eval $VERSION;
# Configure the application.
#
# Note that settings in myapp.conf (or other external
# configuration file that you set up manually) take precedence
# over this when using ConfigLoader. Thus configuration
# details given here can function as a default configuration,
# with an external configuration file acting as an override for
# local deployment.
__PACKAGE__->config(
name => 'MyApp',
# Disable deprecated behavior needed by old applications
disable_component_resolution_regex_fallback => 1,
);
# Start the application
__PACKAGE__->setup();
=head1 NAME
MyApp - Catalyst based application
=head1 SYNOPSIS
script/myapp_server.pl
=head1 DESCRIPTION
[enter your description here]
=head1 SEE ALSO
L<MyApp::Controller::Root>, L<Catalyst>
=head1 AUTHOR
Ali Basirat
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
1;