in reply to Re^2: Logging to web page with Mojolicious and strict
in thread Logging to web page with Mojolicious and strict
Thanks for sharing your code.
Does it still work when you add use strict; use warnings; ?
From my point I see 2 problems in this line {$LogLine = '', $app = shift}; (and similar lines further on). Inserting key/values to a hash is done via the => operator (known as fat comma) or just a plain comma. You use assignment operator =. You escaped a "compilation" error because you use perl-variables as your keys. So the line my $self = {$LogLine = '', $app = shift}; assigns the empty string to $LogLine but does not insert a key named $LogLine into the hash. Perhaps you wanted this?: my $self = {'LogLine' => '', 'app' => shift}; and access it using: $self->{'LogLine'}. The single quotes are superfluous but I am using it just to make a point and to show you that using them will allow you to have a key literally named '$LogLine' but I suspect this is not what you want. So, first use use strict; use warnings; in your package and then I guess you want to replace all $LogLine with 'LogLine' or just LogLine
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Logging to web page with Mojolicious and strict
by TieUpYourCamel (Scribe) on Sep 16, 2019 at 12:19 UTC | |
|
Re^4: Logging to web page with Mojolicious and strict
by TieUpYourCamel (Scribe) on Sep 16, 2019 at 15:36 UTC |