DEV Community

Discussion on: Auto-generate a Database Schema Diagram

Collapse
 
mitchjacksontech profile image
Mitch Jackson

These function attributes are particular to the Catalyst MVC Framework.

You would include this function in a Catalyst::Controller package. In this case, you may choose YourApp::Controller::Debug as the controller name.

Catalyst will map this dbdiagram action to an application URL, as specified by these function attributes.

With :Local, this action URL part will be the function name, relative to the controller name. http://yourapp/debug/dbdiagram

A Catalyst action can receive function arguments as parts of the request URL. :Args(0) specifies this action will receive 0 arguments this way. This makes Pretty URL's easy. dbdiagram might accept a database name, and table name as arguments. This action would respond to the URL: http://yourapp/debug/dbdiagram/database_name/table_name.

sub dbdiagram :Local :Args(2) {
    my ($self, $c, $db_name, $table_name) = @_;

    # ...
}