WebShortcutUtil::Write - Utilities for writing web shortcut files
use WebShortcutUtil::Write qw( create_desktop_shortcut_filename create_url_shortcut_filename create_webloc_shortcut_filename write_desktop_shortcut_file write_url_shortcut_file write_webloc_binary_shortcut_file write_webloc_xml_shortcut_file); # Helpers to create a file name (with bad characters removed). my $filename = create_desktop_shortcut_filename("Shortcut: Name"); my $filename = create_url_shortcut_filename("Shortcut: Name"); my $filename = create_webloc_shortcut_filename("Shortcut: Name"); # Write shortcuts write_desktop_shortcut_file("myshortcut.desktop", "myname", "http://myurl.com/"); write_url_shortcut_file("myshortcut.url", "myname", "http://myurl.com/"); write_webloc_binary_shortcut_file("myshortcut_binary.webloc", "myname", "http://myurl.com/"); write_webloc_xml_shortcut_file("myshortcut_xml.webloc", "myname", "http://myurl.com/");
The following subroutines are provided:
Creates a file name based on the specified shortcut name. The goal is to allow the file to be stored on a wide variety of filesystems without issues. The following rules are used:
The following references discuss file name restrictions:
http://en.wikipedia.org/wiki/Filename
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
http://support.grouplogic.com/?p=1607
https://www.dropbox.com/help/145/en
These routines write shortcut files of the specified type. The shortcut will contain the specified name/title and URL. Note that some shortcuts do not contain a name inside the file, in which case the name parameter is ignored.
If your URL contains unicode characters, it is recommended that you convert it to an ASCII-only URL (see http://en.wikipedia.org/wiki/Internationalized_domain_name ). That being said, write_desktop_shortcut_file and write_url_shortcut_file will write unicode URLs. The webloc writers should as well, although this functionality requires more testing.
Note: The Mac::PropertyList module (http://search.cpan.org/~bdfoy/Mac-PropertyList/) must be installed in order to write ".webloc" files.
http://search.cpan.org/~beckus/WebShortcutUtil/lib/WebShortcutUtil.pm
Copyright (C) 2013 by Andre Beckus
This library is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.
To install WebShortcutUtil, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebShortcutUtil
CPAN shell
perl -MCPAN -e shell install WebShortcutUtil
For more information on module installation, please visit the detailed CPAN module installation guide.