App::Open - Library to drive the 'openit' command line tool
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.
See the `openit` script.
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.
`$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.
Produces the stored filename.
Produces the App::Open::Config object
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.
In the event the `filename` is a URL, return the URL scheme (http, ftp, etc)
Figure out if the file is a local file or not. `file` URLs are massaged into filenames, see is_url().
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.
Return the backend list. Please note that these are objects, not merely package names.
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 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.
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.
Probably a lot of them. Report them to <firstname.lastname@example.org> if you're feeling kind. Report them to CPAN RT if you'd prefer they never get seen.