1. 首页
  2. IT资讯

最简练有效的catalyst的action总结

http://search.cpan.org/~zarquon/Catalyst-Manual-5.7013/lib/Catalyst/Manual/Tutorial/Authentication.pod

在上边的链接里边有对catalyst的action最简练有效的总结,如下:

Note: Catalyst provides a number of different types of actions, such as Local, Regex, Private and the new Path. You should refer to Catalyst::Manual::Intro for a more detailed explanation, but the following bullet points provide a quick introduction:

  • The majority of application have traditionally used Local actions for items that respond to user requests and Private actions for those that do not directly respond to user input.
  • Newer Catalyst applications tend to use Path actions and the Args attribute because of their power and flexibility. You can specify the path to match relative to the namespace of the current module as an argument to Path. For example Path(‘list’) in lib/MyApp/Controller/Books.pm would match on the URL http://localhost:3000/books/list but Path(‘/list’) would match on http://localhost:3000/list.
  • Automatic “chaining” of actions by the dispatcher is a powerful feature that allows multiple methods to handle a single URL. See Catalyst::DispatchType::Chained for more information on chained actions.
  • There are five types of build-in Private actions: begin, end, default, index, and auto.
  • With begin, end, default, index private actions, only the most specific action of each type will be called. For example, if you define a begin action in your controller it will override a begin action in your application/root controller — only the action in your controller will be called.
  • Unlike the other actions where only a single method is called for each request, every auto action along the chain of namespaces will be called. Each auto action will be called from the application/root controller down through the most specific class.

By placing the authentication enforcement code inside the auto method of lib/MyApp/Controller/Root.pm (or lib/MyApp.pm), it will be called for every request that is received by the entire application.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/82392/viewspace-467905/,如需转载,请注明出处,否则将追究法律责任。

主题测试文章,只做测试使用。发布者:布吉卡,转转请注明出处:http://www.cxybcw.com/195773.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code