-
-
Save hesco/962635a0acf16e1bf158 to your computer and use it in GitHub Desktop.
I'm wondering (1) how to resolve "Global symbol "$result" requires explicit package name" and (2) how to get my log messages to the log.
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
I'm getting 500 responses to this: | |
http://localhost:9000/v1/book/006-0-51218-7/ | |
My restart script sets -- | |
export MOJO_LOG_LEVEL=debug | |
export MOJO_MODE=dev | |
logs report -- | |
[Sun May 4 19:53:08 2014] [error] Global symbol "$result" requires explicit package name at template books/isbn_exists.html.ep line 4. | |
1: % layout 'default'; | |
2: % title 'Book exists?'; | |
3: <h2><%= $isbn %></h2> | |
4: <p><%= $result %></p> | |
[Sun May 4 19:53:08 2014] [debug] Template "exception.dev.html.ep" not found. | |
[Sun May 4 19:53:08 2014] [debug] Template "exception.html.ep" not found. | |
[Sun May 4 19:53:08 2014] [debug] Rendering inline template "07b75e59cb799a91ec864231fe5902c8". | |
[Sun May 4 19:53:08 2014] [debug] 500 Internal Server Error (0.177316s, 5.640/s). | |
relevant method -- | |
sub isbn_exists { | |
my $self = shift; | |
my $isbn = $self->stash('isbn'); | |
$isbn =~ s/\D//; | |
my $isbn_obj = Business::ISBN->new( $isbn ); | |
return $self->render unless $isbn_obj->is_valid; | |
my $isbn_as_text = $isbn_obj->as_isbn13->{'common_data'}; | |
$self->app->log->debug( 'ISBN, ready for database search is: ' . Dumper $isbn_as_text ); | |
my $title = $self->get_book_title( $isbn_as_text ); | |
my $result; | |
if( defined( $title ) ){ | |
$result = "Book Exists, ISBN# $isbn_as_text, Title: $title"; | |
} else { | |
$result = "No book with ISBN#: $isbn_as_text exists in database."; | |
} | |
$self->stash( result => $result ); | |
$self->render(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment