Treex::Core::Resource - Access to shared resources
version 2.20160629
use Treex::Core::Resource qw(require_file_from_share); my $path = require_file_from_share('relative/path/to/file/within/Treex/Share'); open my $MODEL, '<', $path or log_fatal($!);
# or my $path = require_file_from_share('./relative/path/from/the/current/directory'); my $path = require_file_from_share('/absolute/path');
This module provides access to shared resources (e.g. models). First it tries to locate it on local computer. If not found, download from server (http://ufallab.ms.mff.cuni.cz/). If the path starts with "." or "/" it is searched in the local file system (and not in Treex Share).
Try to locate file in local resource paths, if not found, try to download it and stores it to first writable path. Obtains paths from Treex::Core::Config->resource_path() Returns path to file.
If $make_executable is true, execute rights are set on the downloaded file.
$make_executable
If $skip_download is true, automatic download is skipped and only the path tho the file or the first writable path is returned. The caller block must check the existence of the file and handle the download itself (useful for downloading and unpacking of larger archives).
$skip_download
Zdeněk Žabokrtský <zabokrtsky@ufal.mff.cuni.cz>
Tomáš Kraut <kraut@ufal.mff.cuni.cz>
Martin Popel <popel@ufal.mff.cuni.cz>
Copyright © 2011,2015 by Institute of Formal and Applied Linguistics, Charles University in Prague
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Treex::Core, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Treex::Core
CPAN shell
perl -MCPAN -e shell install Treex::Core
For more information on module installation, please visit the detailed CPAN module installation guide.