NAME
Win32::Unicode::InternetShortcut - Perl extension for Windows Unicode Internet Shortcut interface
SYNOPSIS
use Win32::Unicode::InternetShortcut;
use File::Spec;
use charnames ':full';
use Encode;
use Carp;
our $utf16le = find_encoding('UTF-16LE') || croak "Failed to load UTF16-LE encoding\n";
BEGIN { Win32::Unicode::InternetShortcut->CoInitialize(); }
my $self = Win32::Unicode::InternetShortcut->new;
my $url = "http://www.example.com/?WonSign=\N{WON SIGN}";
my $path = File::Spec->catfile(File::Spec->tmpdir, "TEST, last char is Hebrew Letter Alef, \N{HEBREW LETTER ALEF}.url");
$self->save($path, $url);
$self->load($path);
($self->{url} eq $url) || die "Not the same url\n";
END { Win32::Unicode::InternetShortcut->CoUninitialize(); }
DESCRIPTION
This is the Unicode version of Win32::InternetShortcut. This module exposes all methods of Win32::InternetShortcut, plus the initialisation layer which is application specific. So the whole documentation of Win32::Unicode::InternetShortcut consists of: the documentation of Win32::InternetShortcut that the reader should read first, and the Methods section below.
Any bug in Win32::Unicode::InternetShortcut should be nevertheless send to me via RT of course -;
Methods
- Win32::Unicode::InternetShortcut->CoInitialize([CROAK_ON_FAILURE])
-
Unless your application has already initialized the COM layer, via Win32::OLE or Win32::API for example, you will have to do so.
- Win32::Unicode::InternetShortcut->CoInitializeEx(COINIT_CONSTANT[, CROAK_ON_FAILURE])
-
You can have fine-grained granularity on the threading model, using CoInitializeEx. The COINIT_CONSTANT must be of one COINIT_APARTMENTTHREADED, COINIT_MULTITHREADED, COINIT_DISABLE_OLE1DDE or COINIT_SPEED_OVER_MEMORY. Apparently, COINIT_APARTMENTTHREADED is required to get the interface working in a multi-threaded environment.
EXPORT
None by default.
NOTES
If the variable $Win32::Unicode::InternetShortcut::CROAK_ON_ERROR is setted to a true value, then the module will croak at any Windows API call error, with a meaningful message. For example doing a Load without an COM application initialisation will look like the following:
C:\>perl -e "use Win32::Unicode::InternetShortcut; $Win32::Unicode::InternetShortcut::CROAK_ON_ERROR = 1; $L = new Win32::Unicode::InternetShortcut;" CoCreateInstance, CoInitialize has not been called
It is advisable to set this variable before the initialisation, and to reset it after, or to use the optional parameter of the initialisation functions to get it temporarly on during their execution.
None by default.
SEE ALSO
Win32::InternetShortcut Understanding and Using COM Threading Models at http://msdn.microsoft.com/en-us/library/ms809971.aspx Win32::OLE
AUTHOR
Jean-Damien Durand, <jeandamiendurand@free.fr>
COPYRIGHT AND LICENSE
Copyright (C) 2012 by Jean-Damien Durand
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.