[Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense

Rob Brown rob at intelcompute.com
Wed Oct 31 12:00:07 GMT 2012


Craig,

Seriously, come and talk to us on irc...

http://chat.mibbit.com/#catalyst@irc.perl.org

It's much easier/faster to get answers in real-time.

Cheers,
Robsco



On 10/31/2012 11:42 AM, Craig Chant wrote:
> Sorry, I'm getting confused the way this mailing list works as it is all fragmented with the replies, the last one I saw was a request for the server start-up output.
>
> Any chance the Catalyst community could setup a proper forum, vBulletin or such like, it's much easier and user friendly!
>
> However, I've come to the conclusion Catalyst doesn’t work properly over IIS7&  Active-State Perl.
>
> This is what I have in MyApp.pm , HTML.pm&  the Root.pm
>
> MyApp.pm
>
> package HLP_Members;
> use Moose;
> use namespace::autoclean;
>
> use Catalyst::Runtime 5.80;
>
> # Set flags and add plugins for the application.
> #
> # Note that ORDERING IS IMPORTANT here as plugins are initialized in order,
> # therefore you almost certainly want to keep ConfigLoader at the head of the
> # list if you're using it.
> #
> #         -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
>      StackTrace
>      Session
>      Session::Store::FastMmap
>      Session::State::Cookie
> /;
>
> extends 'Catalyst';
>
> our $VERSION = '0.01';
>
>
>
> # Configure the application.
> #
> # Note that settings in hlp_members.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 =>  'HLP_Members',
>      # Disable deprecated behavior needed by old applications
>      disable_component_resolution_regex_fallback =>  1,
>      enable_catalyst_header =>  1, # Send X-Catalyst header
>      'Plugin::Static::Simple'  =>  {dirs =>  ['static', qr/^(images|css)/,]},
>      use_request_uri_for_path =>  1,
>     );
>
> __PACKAGE__->config(
>      # Configure the view
>      'View::HTML' =>  {
>          #Set the location for TT files
>          INCLUDE_PATH =>  [
>              __PACKAGE__->path_to( 'root', 'src' ),
>          ],
>      },
> );
>
> # Start the application
> __PACKAGE__->setup();
>
>
> 1;
>
> HTML.pm
>
> package HLP_Members::View::HTML;
>
> use strict;
> use base 'Catalyst::View::HTML::Template';
>
> __PACKAGE__->config(
>      # Change default TT extension
>      TEMPLATE_EXTENSION =>  '.tp',
>      render_die =>  1,
> );
>
> 1;
>
>
> Root.pm
>
> package HLP_Members::Controller::Root;
> use Moose;
> use namespace::autoclean;
>
> BEGIN { extends 'Catalyst::Controller' }
>
> #
> # Sets the actions in this controller to be registered with no prefix
> # so they function identically to actions created in MyApp.pm
> #
> __PACKAGE__->config(namespace =>  '');
>
> sub index :Path :Args(0) {
>
>      my ( $self, $c ) = @_;
>
>      # Hello World
>      $c->response->body( $c->welcome_message );
>
> }
>
> # always runs first!
> sub begin :Private {
>
>      my ( $self, $c ) = @_;
>
>      # Authenticate
>      $self->AuthenticateUser($c);
>      return 1;
>
> }
>
> sub default :Path {
>
>      my ( $self, $c ) = @_;
>      $c->response->body( 'Page not found' );
>      $c->response->status(404);
>
> }
>
> sub AuthenticateUser {
>
>      my ( $self, $c ) = @_;
>      $c->session;
>      if(!defined $c->session->{user} || !$c->model('Members')->LogCheck($c)){
>          #$c->forward('/login/login');
>      }
>
> }
>
>
> sub end : ActionClass('RenderView') {}
>
>
> __PACKAGE__->meta->make_immutable;
>
> 1;
>
> Here is a link to a screen shot, clearly showing that the same app behaves differently between the devel server and IIS7.
>
> http://www.homeloanpartnership.com/catalyst.gif
>
> The app doesn't display changed content when viewed over IIS7 and IE, I've turned off caching on IIS7 under 'Output Caching' options, it makes no difference, and I've never had a caching issue before whether it’s PHP, ASP or CGI Perl?
>
> Something is being cached somewhere by something otherwise why would the same application on the same server using the same browser show different output for the same application, the only difference is one is being served by the devel server and the other is via IIS7?
>
> This is why I've had problems understanding what works, because I make a change and nothing happens, so how can I develop and test from a front end user perspective when changes are not reflected when the browser is refreshed?
>
> What's odd is the screen updates because the hash numbers change on the debug output to the browser each time I click refresh instead of actually showing me the changed content. How is this possible? How can it be showing me an old error, with new hash references, for output that doesn't exist anymore in the application?
>
> On top of this, the path config for templates isn't working either, even though I've now added the two separate ->config code segments (shown above) as per the tutorial to MyApp.pm and when I put the template in the root, it falls over from what appears to me to be moaning about the line in the HTML.pm View "use base 'Catalyst::View::HTML::Template';", which was auto generated when the HTML::Template View was created with the helper script.
>
> Is anyone else out there in the Catalyst community running over IIS7 on Windows Server 2008 R2 and ActiveState Perl?  If so , did you have these problems? Did you resolve them?
>
> Anyway, here is the debug from the devel server, because IIS7 still won't show the change when I refresh the browser ?
>
> Caught exception in HLP_Members::View::HTML->process "HTML::Template : Attempt to set nonexistent parameter 'base' - this parameter name doesn't match any declarations in the template file : (die_on_bad_params =>  1) at C:/Perl/site/lib/Catalyst/View/HTML/Template.pm line 99"
>
> Stack Trace
>
>
>
>
> Package
>
> Line
>
> File
>
>
>
> Request
>
> do {
>    require Symbol;
>    my $a = bless({
>      _log             =>  bless({
>                            _body =>  "[info] *** Request 6 (0.014/s) [3224] [Wed Oct 31 10:58:09 2012] ***\n[debug] Path is \"login/login\"\n[debug] \"GET\" request for \"login/login\" from \"127.0.0.1\"\n[debug] Found sessionid \"4993316017fd62789a4f17103e2e492dc4e2c464\" in cookie\n[debug] Restored session \"4993316017fd62789a4f17103e2e492dc4e2c464\"\n[debug] Rendering template \"login/login.tp\"\n[error] Caught exception in HLP_Members::View::HTML->process \"HTML::Template : Attempt to set nonexistent parameter 'base' - this parameter name doesn't match any declarations in the template file : (die_on_bad_params =>  1) at C:/Perl/site/lib/Catalyst/View/HTML/Template.pm line 99\"\n",
>                            abort =>  undef,
>                            level =>  31,
>                          }, "Catalyst::Log"),
>      _path            =>  "login/login",
>      _read_length     =>  0,
>      _read_position   =>  0,
>      action           =>  "login/login",
>      address          =>  "127.0.0.1",
>      arguments        =>  [],
>      base             =>  bless(do{\(my $o = "http://localhost:3000/")}, "URI::http"),
>      body_parameters  =>  {},
>      captures         =>  [],
>      cookies          =>  {
>                            hlp_members_session =>  bless({
>                              name  =>  "hlp_members_session",
>                              path  =>  "/",
>                              value =>  ["4993316017fd62789a4f17103e2e492dc4e2c464"],
>                            }, "CGI::Simple::Cookie"),
>                          },
>      env              =>  {
>                            "HTTP_ACCEPT"          =>  "text/html, application/xhtml+xml, */*",
>                            "HTTP_ACCEPT_ENCODING" =>  "gzip, deflate",
>                            "HTTP_ACCEPT_LANGUAGE" =>  "en-GB",
>                            "HTTP_CONNECTION"      =>  "Keep-Alive",
>                            "HTTP_COOKIE"          =>  "hlp_members_session=4993316017fd62789a4f17103e2e492dc4e2c464",
>                            "HTTP_HOST"            =>  "localhost:3000",
>                            "HTTP_USER_AGENT"      =>  "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)",
>                            "PATH_INFO"            =>  "/login/login",
>                            "psgi.errors"          =>  *main::STDERR,
>                            "psgi.input"           =>  \*HTTP::Server::PSGI::$input,
>                            "psgi.multiprocess"    =>  "",
>                            "psgi.multithread"     =>  "",
>                            "psgi.nonblocking"     =>  "",
>                            "psgi.run_once"        =>  "",
>                            "psgi.streaming"       =>  1,
>                            "psgi.url_scheme"      =>  "http",
>                            "psgi.version"         =>  [1, 1],
>                            "psgix.harakiri"       =>  1,
>                            "psgix.input.buffered" =>  1,
>                            "psgix.io"             =>  bless(Symbol::gensym(), "IO::Socket::INET"),
>                            "QUERY_STRING"         =>  "",
>                            "REMOTE_ADDR"          =>  "127.0.0.1",
>                            "REMOTE_PORT"          =>  61705,
>                            "REQUEST_METHOD"       =>  "GET",
>                            "REQUEST_URI"          =>  "/login/login",
>                            "SCRIPT_NAME"          =>  "",
>                            "SERVER_NAME"          =>  0,
>                            "SERVER_PORT"          =>  3000,
>                            "SERVER_PROTOCOL"      =>  "HTTP/1.1",
>                          },
>      headers          =>  bless({
>                            "accept" =>  "text/html, application/xhtml+xml, */*",
>                            "accept-encoding" =>  "gzip, deflate",
>                            "accept-language" =>  "en-GB",
>                            "connection" =>  "Keep-Alive",
>                            "cookie" =>  "hlp_members_session=4993316017fd62789a4f17103e2e492dc4e2c464",
>                            "host" =>  "localhost:3000",
>                            "user-agent" =>  "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)",
>                          }, "HTTP::Headers"),
>      match            =>  "login/login",
>      method           =>  "GET",
>      parameters       =>  {},
>      protocol         =>  "HTTP/1.1",
>      query_keywords   =>  "",
>      query_parameters =>  {},
>      remote_user      =>  undef,
>      secure           =>  0,
>      uploads          =>  {},
>      uri              =>  bless(do{\(my $o = "http://localhost:3000/login/login")}, "URI::http"),
>    }, "Catalyst::Request");
>    *{$a->{env}{"psgix.io"}} = {
>      io_socket_peername =>  "\2\0\xF1\t\x7F\0\0\1\0\0\0\0\0\0\0\0",
>      io_socket_timeout  =>  undef,
>    };
>    $a;
> }
> Response
>
> bless({
>    _log =>  bless({
>      _body =>  "[info] *** Request 6 (0.014/s) [3224] [Wed Oct 31 10:58:09 2012] ***\n[debug] Path is \"login/login\"\n[debug] \"GET\" request for \"login/login\" from \"127.0.0.1\"\n[debug] Found sessionid \"4993316017fd62789a4f17103e2e492dc4e2c464\" in cookie\n[debug] Restored session \"4993316017fd62789a4f17103e2e492dc4e2c464\"\n[debug] Rendering template \"login/login.tp\"\n[error] Caught exception in HLP_Members::View::HTML->process \"HTML::Template : Attempt to set nonexistent parameter 'base' - this parameter name doesn't match any declarations in the template file : (die_on_bad_params =>  1) at C:/Perl/site/lib/Catalyst/View/HTML/Template.pm line 99\"\n",
>      abort =>  undef,
>      level =>  31,
>    }, "Catalyst::Log"),
>    _response_cb =>  sub { ... },
>    body =>  undef,
>    cookies =>  {},
>    finalized_headers =>  0,
>    headers =>  bless({
>      "content-type" =>  "text/html; charset=utf-8",
>      "x-catalyst"   =>  "5.90015",
>    }, "HTTP::Headers"),
>    status =>  200,
> }, "Catalyst::Response")
> Stash
>
> { template =>  "login/login.tp" }
> Config
>
> do {
>    my $a = {
>      "Action::RenderView"                          =>  {
>                                                         ignore_classes =>  [
>                                                                             "DBIx::Class::ResultSource::Table",
>                                                                             "DBIx::Class::ResultSourceHandle",
>                                                                             "DateTime",
>                                                                           ],
>                                                         scrubber_func  =>  sub { ... },
>                                                       },
>      "disable_component_resolution_regex_fallback" =>  1,
>      "enable_catalyst_header"                      =>  1,
>      "home"                                        =>  "C:\\Websites\\hlp_members",
>      "name"                                        =>  "HLP_Members",
>      "Plugin::ConfigLoader"                        =>  {},
>      "Plugin::Session"                             =>  {
>                                                         cookie_name =>  "hlp_members_session",
>                                                         expires =>  7200,
>                                                         storage =>  "C:\\Users\\hlpadmin\\AppData\\Local\\Temp\\1\\hlp_members\\session_data",
>                                                         verify_address =>  0,
>                                                         verify_user_agent =>  0,
>                                                       },
>      "Plugin::Static::Simple"                      =>  {
>                                                         debug =>  1,
>                                                         dirs =>  ["static", qr/^(images|css)/],
>                                                         ignore_dirs =>  [],
>                                                         ignore_extensions =>  ["tmpl", "tt", "tt2", "html", "xhtml"],
>                                                         include_path =>  [
>                                                           bless({
>                                                             dirs =>  ["", "Websites", "hlp_members", "root"],
>                                                             file_spec_class =>  undef,
>                                                             volume =>  "C:",
>                                                           }, "Path::Class::Dir"),
>                                                         ],
>                                                         mime_types =>  {},
>                                                         mime_types_obj =>  bless({}, "MIME::Types"),
>                                                         no_logs =>  1,
>                                                       },
>      "root"                                        =>  'fix',
>      "stacktrace"                                  =>  { context =>  3, verbose =>  0 },
>      "static"                                      =>  'fix',
>      "use_request_uri_for_path"                    =>  1,
>      "View::HTML"                                  =>  {
>                                                         INCLUDE_PATH =>  [
>                                                           bless({
>                                                             dir =>  bless({
>                                                               dirs =>  ["", "Websites", "hlp_members", "root"],
>                                                               file_spec_class =>  undef,
>                                                               volume =>  "C:",
>                                                             }, "Path::Class::Dir"),
>                                                             file =>  "src",
>                                                             file_spec_class =>  undef,
>                                                           }, "Path::Class::File"),
>                                                         ],
>                                                       },
>    };
>    $a->{"root"} = $a->{"Plugin::Static::Simple"}{include_path}[0];
>    $a->{"static"} = $a->{"Plugin::Static::Simple"};
>    $a;
> }
> Session ID
>
> "4993316017fd62789a4f17103e2e492dc4e2c464"
> Session
>
> { __created =>  1351678589, __updated =>  1351680670 }
>
> HLP_Members on Catalyst 5.90015
>
>
>
>
>
> -----Original Message-----
> From: David Schmidt [mailto:davewood at gmx.at]
> Sent: 31 October 2012 10:23
> To: The elegant MVC web framework
> Subject: Re: [Catalyst] I'm loosing the plot here? - Controller behaviour that makes no sense
>
> Tomas asked for the debug output of the failing response.
> You pasted only the server startup debug output.
>
> On 31 October 2012 10:46, Craig Chant<craig at homeloanpartnership.com>  wrote:
>> Sorry IRC?
>>
>> I did post the debug and output , has this email not been received?
>>
>> -----Original Message-----
>> From: Tomas Doran [mailto:bobtfish at bobtfish.net]
>> Sent: 30 October 2012 22:26
>> To: The elegant MVC web framework
>> Subject: Re: [Catalyst] I'm loosing the plot here? - Controller
>> behaviour that makes no sense
>>
>>
>> On 30 Oct 2012, at 20:08, Craig Chant wrote:
>>
>>> The path/controller/action is resolving correctly now, but any response->body change I make in the 'index :Path' action, isn't showing  when i refresh my browser?
>>
>> You're not showing us the debug output of the failing request, so it's very hard to help debug that request.
>>
>> If you want this form of interactive help, you'd be much better off dropping into irc for interactive help, rather than the mailing list, which by it's nature is more asynchronous.
>>
>> Hope to see you in irc!
>>
>> Cheers
>> t0m
>>
>>
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/ This Email and any attachments
>> contain confidential information and is intended solely for the individual to whom it is addressed. If this Email has been misdirected, please notify the author as soon as possible. If you are not the intended recipient you must not disclose, distribute, copy, print or rely on any of the information contained, and all copies must be deleted immediately. Whilst we take reasonable steps to try to identify any software viruses, any attachments to this e-mail may nevertheless contain viruses, which our anti-virus software has failed to identify. You should therefore carry out your own anti-virus checks before opening any documents. HomeLoan Partnership will not accept any liability for damage caused by computer viruses emanating from any attachment or other document supplied with this e-mail. HomeLoan Partnership reserves the right to monitor and archive all e-mail communications through its network. No representative or employee of HomeLoan Partnership has the authority to en
ter into any contract on behalf of HomeLoan Partnership by email. HomeLoan Partnership is a trading name of H L Partnership Limited, registered in England and Wales with Registration Number 5011722. Registered office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by the Financial Services Authority.
>>
>> _______________________________________________
>> List: Catalyst at lists.scsys.co.uk
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
>> Dev site: http://dev.catalyst.perl.org/
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
> This Email and any attachments contain confidential information and is intended solely for the individual to whom it is addressed. If this Email has been misdirected, please notify the author as soon as possible. If you are not the intended recipient you must not disclose, distribute, copy, print or rely on any of the information contained, and all copies must be deleted immediately. Whilst we take reasonable steps to try to identify any software viruses, any attachments to this e-mail may nevertheless contain viruses, which our anti-virus software has failed to identify. You should therefore carry out your own anti-virus checks before opening any documents. HomeLoan Partnership will not accept any liability for damage caused by computer viruses emanating from any attachment or other document supplied with this e-mail. HomeLoan Partnership reserves the right to monitor and archive all e-mail communications through its network. No representative or employee of HomeLoan Partn
ership has the authority to enter into any contract on behalf of HomeLoan Partnership by email. HomeLoan Partnership is a trading name of H L Partnership Limited, registered in England and Wales with Registration Number 5011722. Registered office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by the Financial Services Authority.
>
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/

-- 
IntelCompute
Web Design & Online Marketing Experts

http://www.intelcompute.com



More information about the Catalyst mailing list