Win32::Unicode::Error - return error message.


Win32-Unicode documentation Contained in the Win32-Unicode distribution.

Index


Code Index:

NAME

Top

Win32::Unicode::Error - return error message.

SYNOPSIS

Top

  use Win32::Unicode;

  mkdirW($exists_dir) or dieW errorW

DESCRIPTION

Top

Wn32::Unicode::Error is return to Win32API error message.

FUNCTIONS

Top

errorW()

get last error message.

AUTHOR

Top

Yuji Shimada <xaicron@gmail.com>

SEE ALSO

Top

Win32::Unicode

Win32::Unicode::Dir

Win32::Unicode::File

LICENSE

Top

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Win32-Unicode documentation Contained in the Win32-Unicode distribution.

package Win32::Unicode::Error;

use strict;
use warnings;
use 5.008003;
use Carp ();
use Exporter 'import';

our $VERSION = '0.25';

use Errno qw/:POSIX/;

use Win32::Unicode::Constant;
use Win32::Unicode::Util;
use Win32::Unicode::XS;

# export subs
our @EXPORT    = qw/errorW/;
our @EXPORT_OK = qw/error/;
our %EXPORT_TAGS = ('all' => [@EXPORT, @EXPORT_OK]);

my %ERROR_TABLE = (
    &ERROR_FILE_EXISTS => EEXIST,
);

sub errorW {
    my $buff = foramt_message();
    $buff = utf16_to_utf8($buff);
    $buff =~ s/\r\n$//;
    return $buff;
}

sub _set_errno {
    my $errno = $_[0] ? set_last_error($_[0]) : get_last_error();
    $! = $ERROR_TABLE{$errno} || $errno;
    return;
}

*error = *errorW;

1;
__END__