NAME
App::Open - Library to drive the 'openit' command line tool
USING
If you are just looking to use the `openit` command and learn how to configure it, please see App::Open::Using, which addresses this issue.
SYNOPSIS
See the `openit` script.
WARNING
While this probably can be re-used, it has a specific function to support a specific tool. Use this at your own risk and expect breakage on upgrades. Expect side-effects, even if the author himself detests them.
METHODS
- new( $config, $filename )
-
`$config` is a App::Open::Config object. `$filename` is a filename or URL which `openit` will attempt to locate a program to launch for it.
- filename
-
Produces the stored filename.
- config
-
Produces the App::Open::Config object
- is_url
-
Predicate to indicate whether the `filename` is a URL or not. This is a bit distracting as `file` URLs are not indicated by this method. I'll probably get to fixing this shortly after I become a Nobel Laureate.
- scheme
-
In the event the `filename` is a URL, return the URL scheme (http, ftp, etc)
- parse_filename
-
Figure out if the file is a local file or not. `file` URLs are massaged into filenames, see is_url().
- extensions
-
Build a list of extensions from the filename. Since it's possible that files may have multiple extensions (e.g., .tar.gz), we break this down into increasingly diminuitive portions. The idea is that we handle the "largest" extension first, for example, using tar to unpack .tar.gz files, and falling back to gunzip if we have to.
- backends
-
Return the backend list. Please note that these are objects, not merely package names.
- lookup_program
-
Locate the program to execute the file, searching the provided backends. If we have found a program and it has a template, it will replace '%s' with the filename in all occurrences. Otherwise, it will append it to the end of the command.
This method returns a list suitable for sending to system(). It makes no attempt to correct your potentially problematic shell quoting, but it does ensure that the filename, whether templated or appended, is fully intact and not split across list elements.
- execute_program
-
Execute the program against the filename supplied by the constructor.
In most cases, this is the only method you need to call; it does all the work for you.
LICENSE
This file and all portions of the original package are (C) 2008 Erik Hollensbe. Please see the file COPYING in the package for more information.
BUGS AND PATCHES
Probably a lot of them. Report them to <erik@hollensbe.org> if you're feeling kind. Report them to CPAN RT if you'd prefer they never get seen.