Affix

 view release on metacpan or  search on metacpan

eg/benchmark.pl  view on Meta::CPAN

        $version = $version ? qr[\.${version}] : qr/([\.\d]*)?/;
        if ( !defined $_lib_cache->{ $name . chr(0) . ( $version // '' ) } ) {
            if ( $OS eq 'MSWin32' ) {
                $name =~ s[\.dll$][];

                #return $name . '.dll'     if -f $name . '.dll';
                return File::Spec->canonpath( File::Spec->rel2abs( $name . '.dll' ) )
                    if -e $name . '.dll';
                require Win32;

# https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications
                my @dirs = grep {-d} (
                    dirname( File::Spec->rel2abs($^X) ),               # 1. exe dir
                    Win32::GetFolderPath( Win32::CSIDL_SYSTEM() ),     # 2. sys dir
                    Win32::GetFolderPath( Win32::CSIDL_WINDOWS() ),    # 4. win dir
                    File::Spec->rel2abs( File::Spec->curdir ),         # 5. cwd
                    File::Spec->path(),                                # 6. $ENV{PATH}

                    #'C:\Program Files'
                );
                warn $_ for sort { lc $a cmp lc $b } @dirs;

lib/Affix.pm  view on Meta::CPAN

        if ( !defined $_lib_cache->{ $name . ';' . ( $version // '' ) } ) {
            if ( $OS eq 'MSWin32' ) {
                my $p;
                $name =~ s[\.dll$][];
                if ( -e $name . '.dll' ) {
                    $p = rel2abs canonpath( $name . '.dll' );
                }
                else {
                    require Win32;

# https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#search-order-for-desktop-applications
                    my @dirs = grep {-d} (
                        dirname( rel2abs($^X) ),                                # 1. exe dir
                        Win32::GetFolderPath( Win32::CSIDL_SYSTEM() ),          # 2. sys dir
                        Win32::GetFolderPath( Win32::CSIDL_WINDOWS() ),         # 4. win dir
                        rel2abs(curdir),                                        # 5. cwd
                        path(),                                                 # 6. $ENV{PATH}
                        map { split /[:;]/, ( $ENV{$_} ) } grep { $ENV{$_} }    # X. User defined
                            qw[LD_LIBRARY_PATH DYLD_LIBRARY_PATH DYLD_FALLBACK_LIBRARY_PATH]
                    );
                    my @retval;



( run in 0.386 second using v1.01-cache-2.11-cpan-299005ec8e3 )