1HTML::Mason::Tools(3) User Contributed Perl DocumentationHTML::Mason::Tools(3)
2
3
4
6 HTML::Mason::Tools - Function library used internally in Mason
7
9 This module contains exportable functions that are intended to be used
10 by other Mason modules.
11
12 The documentation here is primarily intended to be used by Mason core
13 developers.
14
15 Others who choose to use these functions do so at their own risk, as
16 they may change from release to release. You have been warned.
17
19 read_file
20 This function takes a file name and an optional argument indicating
21 whether or not to open the final in binary mode. It will return
22 the entire contents of the file as a scalar.
23
24 paths_eq
25 Given to paths, this function indicates whether they represent the
26 same location on the filesystem. It does not account for symlinks.
27
28 compress_path
29 This turns a component path into a filesystem-friendly path by
30 escaping potentially meaningful characters.
31
32 absolute_comp_path
33 Given a component path and a directory path, this function returns
34 the absolute component path, prepending the directory path if
35 needed.
36
37 mason_canonpath
38 This function cleans up a component path and returns its canonical
39 version. It is largely the same as File::Spec::Unix::canonpath,
40 with a few additional cleanups.
41
42 pkg_installed
43 Given a module name, this function returns true or false to
44 indicate whether or not a corresponding .pm file exists.
45
46 pkg_loaded
47 Given a module name, this function returns true or false to
48 indicate whether or not the module has been loaded into memory.
49
50 load_pkg
51 Given a module name, this function attempts to load it. It takes
52 an additional boolean parameter indicating whether or not to throw
53 an exception if the module cannot be found. By default, if the
54 module cannot be found, this function simply returns false.
55
56 All errors generate exceptions no matter what.
57
58 If the module is loaded successfully, this function returns true.
59
60 taint_is_on
61 Returns a boolean value indicating whether taint mode is on or not.
62
63 coerce_to_array
64 Given a scalar, which may be a reference, this function attempts to
65 return an array. It throws an HTML::Mason::Exception::Params
66 exception if this can't be done.
67
68 This function is called from the generated component code as part
69 of a component's argument handling.
70
71 coerce_to_hash
72 Given a scalar, which may be a reference, this function attempts to
73 return a hash. It throws an HTML::Mason::Exception::Params
74 exception if this can't be done.
75
76 This function is called from the generated component code as part
77 of a component's argument handling.
78
79 checksum
80 Computes a simple checksum of a string. Used for
81 Compiler::object_id.
82
83
84
85perl v5.36.0 2023-01-20 HTML::Mason::Tools(3)