1Catalyst::Utils(3) User Contributed Perl Documentation Catalyst::Utils(3)
2
3
4
6 Catalyst::Utils - The Catalyst Utils
7
9 See Catalyst.
10
12 Catalyst Utilities.
13
15 appprefix($class)
16 MyApp::Foo becomes myapp_foo
17
18 class2appclass($class);
19 MyApp::Controller::Foo::Bar becomes MyApp
20 My::App::Controller::Foo::Bar becomes My::App
21
22 class2classprefix($class);
23 MyApp::Controller::Foo::Bar becomes MyApp::Controller
24 My::App::Controller::Foo::Bar becomes My::App::Controller
25
26 class2classsuffix($class);
27 MyApp::Controller::Foo::Bar becomes Controller::Foo::Bar
28
29 class2env($class);
30 Returns the environment name for class.
31
32 MyApp becomes MYAPP
33 My::App becomes MY_APP
34
35 class2prefix( $class, $case );
36 Returns the uri prefix for a class. If case is false the prefix is
37 converted to lowercase.
38
39 My::App::Controller::Foo::Bar becomes foo/bar
40
41 class2tempdir( $class [, $create ] );
42 Returns a tempdir for a class. If create is true it will try to create
43 the path.
44
45 My::App becomes /tmp/my/app
46 My::App::Controller::Foo::Bar becomes /tmp/my/app/c/foo/bar
47
48 home($class)
49 Returns home directory for given class.
50
51 prefix($class, $name);
52 Returns a prefixed action.
53
54 MyApp::Controller::Foo::Bar, yada becomes foo/bar/yada
55
56 request($uri)
57 Returns an HTTP::Request object for a uri.
58
59 ensure_class_loaded($class_name, \%opts)
60 Loads the class unless it already has been loaded.
61
62 If $opts{ignore_loaded} is true always tries the require whether the
63 package already exists or not. Only pass this if you're either (a) sure
64 you know the file exists on disk or (b) have code to catch the file not
65 found exception that will result if it doesn't.
66
67 merge_hashes($hashref, $hashref)
68 Base code to recursively merge two hashes together with right-hand
69 precedence.
70
71 env_value($class, $key)
72 Checks for and returns an environment value. For instance, if $key is
73 'home', then this method will check for and return the first value it
74 finds, looking at $ENV{MYAPP_HOME} and $ENV{CATALYST_HOME}.
75
76 term_width
77 Try to guess terminal width to use with formatting of debug output
78
79 All you need to get this work, is:
80
81 1) Install Term::Size::Any, or
82
83 2) Export $COLUMNS from your shell.
84
85 (Warning to bash users: 'echo $COLUMNS' may be showing you the bash
86 variable, not $ENV{COLUMNS}. 'export COLUMNS=$COLUMNS' and you should
87 see that 'env' now lists COLUMNS.)
88
89 As last resort, default value of 80 chars will be used.
90
91 resolve_namespace
92 Method which adds the namespace for plugins and actions.
93
94 __PACKAGE__->setup(qw(MyPlugin));
95
96 # will load Catalyst::Plugin::MyPlugin
97
99 Catalyst Contributors, see Catalyst.pm
100
102 This library is free software. You can redistribute it and/or modify it
103 under the same terms as Perl itself.
104
105
106
107perl v5.12.1 2009-11-22 Catalyst::Utils(3)