|
NAME"DocSet::RunTime" - RunTime ConfigurationSYNOPSISuse DocSet::RunTime; # run time options DocSet::RunTime::set_opt(\%args); if (get_opts('verbose') { print "verbose mode"; } # hosting system capabilities testing DocSet::RunTime::has_storable_module(); DocSet::RunTime::can_create_ps(); DocSet::RunTime::can_create_pdf(); # source documents lookup DocSet::RunTime::scan_src_docs($base_path, \@search_paths, \@search_exts); my $full_src_path = find_src_doc($resource_rel_path); # rendering object singleton set_render_obj($obj); unset_render_obj(); $obj = get_render_obj(); DESCRIPTIONThis module is a part of the docset application, and it stores the run time arguments, caches results of expensive calls and provide Singleton-like service to the whole system.FUNCTIONSMETA: To be completed, see SYNOPSISRun Time OptionsOnly get_opts() method is exported by default.
Hosting System Capabilities TestingThese methods test the capability of the system and are a part of the runtime system to perform the checking only once.
Source Documents LookupA system for mapping L<> escapes to the located of the rendered files. This system scans once the @search_paths for files with @search_exts starting from $base_path using scan_src_docs(). The @search_paths and @search_exts are configured in the config.cfg file. For example:dir => { # search path for pods, etc. must put more specific paths first! search_paths => [qw( foo/bar foo . )], # what extensions to search for search_exts => [qw(pod pm html)], }, So for example if the base path is ~/myproject/src, the files with extensions .pod, .pm and .html will be searched in ~/myproject/src/foo/bar, ~/myproject/src/foo and ~/myproject/src. Notice that you must specify more specific paths first, since for optimization the seen paths are skipped. Therefore in our example the more explicit path foo/bar was listed before the more general foo. When the POD parser finds a L<> sequence it indentifies the resource part and passes it to the find_src_doc() which looks up for this file in the cache and returns its original (src) location, which can be then easily converted to the final location and optionally adjusting the extension, e.g. when the POD file is converted to HTML. As a special extension this function automatically assumes that "index.html" will be generated in each directory containing items of an interest. Therefore in find_src_doc() it'll automatically find things like: the guide, even though there was no source index.pod or index.html in first place. Only the find_src_doc() function is exported by default.
Rendering Object SingletonSince the rendering process may happen by a third party system, into which we provide hooks or overload some of its methods, it's quite possible that we won't be able to access the current document (or better rendering) object. One solution would be to have a global package variable, but that's very error-prone. Therefore the used solution is to provide a hook into a RunTime environment setting the current rendering object when the rendering of a single page starts via "set_render_obj($obj)" and unsetting it when it's finished via unset_render_obj(). Between these two moments the current rendering object can be retrieved with get_render_obj() method.Notice that this is all possible in the program which is not threaded, or/and only one rendering process exists at any given time from its start to its end. All three methods are exported by default.
AUTHORSStas Bekman <stas (at) stason.org>POD ERRORSHey! The above document had some coding errors, which are explained below:
Visit the GSP FreeBSD Man Page Interface. |