Dir-Self-0.11/0000755000175000001440000000000012211445637012066 5ustar maukeusersDir-Self-0.11/lib/0000755000175000001440000000000012211445637012634 5ustar maukeusersDir-Self-0.11/lib/Dir/0000755000175000001440000000000012211445637013352 5ustar maukeusersDir-Self-0.11/lib/Dir/Self.pm0000644000175000001440000000401612211445513014573 0ustar maukeuserspackage Dir::Self; $VERSION = '0.11'; use 5.005; use strict; use File::Spec (); sub __DIR__ () { my $level = shift || 0; my $file = (caller $level)[1]; File::Spec->rel2abs(join '', (File::Spec->splitpath($file))[0, 1]) } sub _const { my $value = shift; sub () { $value } } sub import { my $class = shift; my $caller = caller; @_ or @_ = '__DIR__'; for my $item (@_) { if ($item eq '__DIR__') { no strict 'refs'; *{$caller . '::__DIR__'} = \&__DIR__; } elsif ($item eq ':static') { no strict 'refs'; *{$caller . '::__DIR__'} = _const &__DIR__(1); } else { require Carp; Carp::croak(qq{"$item" is not exported by the $class module}); } } } 1 __END__ =head1 NAME Dir::Self - a __DIR__ constant for the directory your source file is in =head1 SYNOPSIS use Dir::Self; use lib __DIR__ . "/lib"; my $conffile = __DIR__ . "/config"; =head1 DESCRIPTION Perl has two pseudo-constants describing the current location in your source code, C<__FILE__> and C<__LINE__>. This module adds C<__DIR__>, which expands to the directory your source file is in, as an absolute pathname. This is useful if your code wants to access files in the same directory, like helper modules or configuration data. This is a bit like L except it's not limited to the main program, i.e. you can also use it in modules. And it actually works. As of version 0.10 each use of C<__DIR__> recomputes the directory name; this ensures that files in different directories that share the same package name get correct results. If you don't want this, C will create a true C<__DIR__> constant in your package that contains the directory name at the point of C. =head1 AUTHOR Lukas Mai El.mai @web.deE =head1 COPYRIGHT AND LICENSE Copyright (C) 2007, 2008, 2013 by Lukas Mai This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. =cut Dir-Self-0.11/META.yml0000644000175000001440000000104112211445637013333 0ustar maukeusers--- abstract: 'a __DIR__ constant for the directory your source file is in' author: - 'Lukas Mai ' build_requires: Test::More: 0 lib: 0 dynamic_config: 1 generated_by: 'ExtUtils::MakeMaker version 6.74, CPAN::Meta::Converter version 2.132140' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Dir-Self no_index: directory: - t - inc requires: Carp: 0 File::Spec: 0 strict: 0 resources: repository: git://github.com/mauke/Dir-Self.git version: 0.11 Dir-Self-0.11/Makefile.PL0000644000175000001440000000301412211444143014025 0ustar maukeusersuse 5.005; use strict; use ExtUtils::MakeMaker; sub merge_key_into { my ($href, $target, $source) = @_; %{$href->{$target}} = (%{$href->{$target}}, %{delete $href->{$source}}); } my %opt = ( NAME => 'Dir::Self', AUTHOR => q{Lukas Mai }, VERSION_FROM => 'lib/Dir/Self.pm', ABSTRACT_FROM => 'lib/Dir/Self.pm', LICENSE => 'perl', PL_FILES => {}, CONFIGURE_REQUIRES => { 'strict' => 0, 'ExtUtils::MakeMaker' => '6.48', }, BUILD_REQUIRES => {}, TEST_REQUIRES => { 'Test::More' => 0, 'lib' => 0, }, PREREQ_PM => { 'Carp' => 0, 'File::Spec' => 0, 'strict' => 0, }, dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', }, clean => { FILES => 'Dir-Self-*' }, META_MERGE => { 'meta-spec' => { version => 2 }, 'resources' => { repository => { url => 'git://github.com/mauke/Dir-Self.git', web => 'https://github.com/mauke/Dir-Self', type => 'git', }, }, }, ); (my $mm_version = ExtUtils::MakeMaker->VERSION($opt{CONFIGURE_REQUIRES}{'ExtUtils::MakeMaker'})) =~ tr/_//d; if ($mm_version < 6.67_04) { # Why? For the glory of satan, of course! *ExtUtils::MM_Any::_add_requirements_to_meta_v1_4 = \&ExtUtils::MM_Any::_add_requirements_to_meta_v2; } if ($mm_version < 6.63_03) { merge_key_into \%opt, 'BUILD_REQUIRES', 'TEST_REQUIRES'; } if ($mm_version < 6.55_01) { merge_key_into \%opt, 'CONFIGURE_REQUIRES', 'BUILD_REQUIRES'; } if ($mm_version < 6.51_03) { merge_key_into \%opt, 'PREREQ_PM', 'CONFIGURE_REQUIRES'; } WriteMakefile %opt; Dir-Self-0.11/t/0000755000175000001440000000000012211445637012331 5ustar maukeusersDir-Self-0.11/t/zerlegungsgleichheit/0000755000175000001440000000000012211445637016544 5ustar maukeusersDir-Self-0.11/t/zerlegungsgleichheit/d.t0000644000175000001440000000004311011565466017151 0ustar maukeusersuse strict; sub zd { __DIR__ } 1 Dir-Self-0.11/t/Dir-Self.t0000644000175000001440000000060211011565556014121 0ustar maukeusers#!perl -w use strict; use Test::More tests => 3; use Dir::Self; ok 1, 'use Dir::Self'; ######################### # Insert your test code below, the Test::More module is use()ed here so read # its man page ( perldoc Test::More ) for help writing this test script. like __DIR__, '/\bt$/'; use lib __DIR__; require "zerlegungsgleichheit/d.t"; like zd(), '/\bzerlegungsgleichheit$/'; Dir-Self-0.11/MANIFEST.SKIP0000644000175000001440000000024312211443243013752 0ustar maukeusers\.tar\.gz$ ^Build$ ^Dir-Self- ^GNUmakefile$ ^MANIFEST\.(?!SKIP$) ^MYMETA\. ^Makefile$ ^Makefile\.old$ ^\. ^_build ^blib ^cover_db$ ^pm_to_blib ^remote$ ^untracked Dir-Self-0.11/MANIFEST0000644000175000001440000000042212211445637013215 0ustar maukeusersChanges MANIFEST MANIFEST.SKIP Makefile.PL README lib/Dir/Self.pm t/Dir-Self.t t/zerlegungsgleichheit/d.t META.yml Module YAML meta-data (added by MakeMaker) META.json Module JSON meta-data (added by MakeMaker) Dir-Self-0.11/META.json0000644000175000001440000000211412211445637013505 0ustar maukeusers{ "abstract" : "a __DIR__ constant for the directory your source file is in", "author" : [ "Lukas Mai " ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.74, CPAN::Meta::Converter version 2.132140", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Dir-Self", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : {} }, "runtime" : { "requires" : { "Carp" : "0", "File::Spec" : "0", "strict" : "0" } }, "test" : { "requires" : { "Test::More" : "0", "lib" : "0" } } }, "release_status" : "stable", "resources" : { "repository" : { "type" : "git", "url" : "git://github.com/mauke/Dir-Self.git", "web" : "https://github.com/mauke/Dir-Self" } }, "version" : "0.11" } Dir-Self-0.11/Changes0000644000175000001440000000054112211445506013354 0ustar maukeusersRevision history for Dir-Self 0.11 2013-09-03 Clean up distribution; no user visible changes. 0.10 2008-05-11 Make dynamic recomputation the default and provide ':static'. 0.03 2008-01-30 Include the volume name on platforms with volumes. 0.02 2007-08-13 First version, released on an unsuspecting world. Dir-Self-0.11/README0000644000175000001440000000105612211445566012751 0ustar maukeusersDir-Self ======== Provides a __DIR__ pseudo-constant expanding to the full path to the surrounding source file. Useful for access to files "in the same directory". INSTALLATION To install this module type the following: perl Makefile.PL make make test make install COPYRIGHT AND LICENCE Copyright (C) 2007, 2008, 2013 by Lukas Mai This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.