When a user makes a request using the browser, Catalyst will look for the appropriate method that can handle the request within packages called Controllers. These Controller methods send back a response to the requesting agent like the browser.
We will discuss in detail later in this chapter how controller methods are mapped to URLs and vice versa. However, for now, let's stick to a basic format where the first argument in the URL is the name of the Controller, the second argument is the method within the Controller, and the rest of the arguments are arguments to the Controller method. For example, http://localhost:3000/hello/index
will match the hello
Controller (Hello.pm
) and index
will match the subroutine index
(sub index) within the hello
Controller (Hello.pm
).
If the Controller method is not mentioned, then the index method is taken as default.
Let's create a new Controller called "Hello" to check this (this should respond to the /hello
request):
perl script/myapp_create...