This file is indexed.

/usr/share/perl5/File/ShareDir/ProjectDistDir.pm is in libfile-sharedir-projectdistdir-perl 1.000004-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
use 5.008;
use strict;
use warnings;
use utf8;

package File::ShareDir::ProjectDistDir;

our $VERSION = '1.000004';

# ABSTRACT: Simple set-and-forget using of a '/share' directory in your projects root

our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY











use Path::IsDev qw();
use Path::FindDev qw(find_dev);
use Sub::Exporter qw(build_exporter);
use File::ShareDir qw();

my ($exporter) = build_exporter(
  {
    exports => [ dist_dir => \&build_dist_dir, dist_file => \&build_dist_file ],
    groups  => {
      all       => [qw( dist_dir dist_file )],
      'default' => [qw( dist_dir dist_file )],
    },
    collectors => [ 'defaults', ],
  },
);
my $env_key = 'FILE_SHAREDIR_PROJECTDISTDIR_DEBUG';

## no critic (Subroutines::ProhibitSubroutinePrototypes)
sub _debug($) { }
## use critic

if ( $ENV{$env_key} ) {
  ## no critic (ProtectPrivateVars,TestingAndDebugging::ProhibitNoWarnings)
  no warnings 'redefine';
  *File::ShareDir::ProjectDistDir::_debug = sub ($) {
    *STDERR->printf( qq{[ProjectDistDir] %s\n}, $_[0] );
  };
  $Path::IsDev::DEBUG   = 1;
  $Path::FindDev::DEBUG = 1;
}

## no critic (RequireArgUnpacking)
sub _croak { require Carp; goto &Carp::croak }
sub _carp  { require Carp; goto &Carp::carp }

sub _path { require Path::Tiny; goto &Path::Tiny::path }

sub _need_pathclass {
  for my $package ( q[], q[::File], q[::Dir] ) {
    ## no critic (Variables::RequireInitializationForLocalVars)
    local $@ = undef;
    my $code = sprintf 'require %s%s;1', 'Path::Class', $package;
    ## no critic (BuiltinFunctions::ProhibitStringyEval,Lax::ProhibitStringyEval::ExceptForRequire)
    next if eval $code;
    my $err = $@;
    _carp('Path::Class is not installed.');
    ## no critic (RequireCarping, ErrorHandling::RequireUseOfExceptions)
    die $err;
  }
  return 1;
}
































































































































sub import {
  my ( $class, @args ) = @_;

  my ( undef, $xfilename, undef ) = caller;

  my $defaults = {
    filename   => $xfilename,
    projectdir => 'share',
    pathclass  => undef,
    strict     => undef,
  };

  if ( not @args ) {
    @_ = ( $class, ':all', defaults => $defaults );
    goto $exporter;
  }

  for ( 0 .. $#args - 1 ) {
    my ( $key, $value );
    next unless $key = $args[$_] and $value = $args[ $_ + 1 ];

    if ( 'defaults' eq $key ) {
      $defaults = $value;
      undef $args[$_];
      undef $args[ $_ + 1 ];
      next;
    }
    for my $setting (qw( projectdir filename distname pathclass pathtiny strict )) {
      if ( $key eq $setting and not ref $value ) {
        $defaults->{$setting} = $value;
        undef $args[$_];
        undef $args[ $_ + 1 ];
        last;
      }
    }
  }

  $defaults->{filename}   = $xfilename if not defined $defaults->{filename};
  $defaults->{projectdir} = 'share'    if not defined $defaults->{projectdir};

  if ( defined $defaults->{pathclass} ) {
    _carp( 'Path::Class support depecated and will be removed from a future release.' . ' see Documentation for details' );
    _need_pathclass();
  }

  @_ = ( $class, ( grep { defined } @args ), 'defaults' => $defaults );

  goto $exporter;
}
















































sub _get_defaults {
  my ( $field, $arg, $col ) = @_;
  my $result;
  $result = $col->{defaults}->{$field} if $col->{defaults}->{$field};
  $result = $arg->{$field}             if $arg->{$field};
  return $result;
}

sub _wrap_return {
  my ( $type, $value ) = @_;
  if ( not $type ) {
    return $value unless ref $value;
    return "$value";
  }
  if ( 'pathtiny' eq $type ) {
    return $value if 'Path::Tiny' eq ref $value;
    return _path($value);
  }
  if ( 'pathclassdir' eq $type ) {
    return $value if 'Path::Class::Dir' eq ref $value;
    _need_pathclass;
    return Path::Class::Dir->new("$value");
  }
  if ( 'pathclassfile' eq $type ) {
    return $value if 'Path::Class::File' eq ref $value;
    _need_pathclass;
    return Path::Class::File->new("$value");
  }
  return _croak("Unknown return type $type");
}

our %DIST_DIR_CACHE;

sub _get_cached_dist_dir_result {
  my ( undef, $filename, $projectdir, $distname, $strict ) = @_;
  if ( defined $DIST_DIR_CACHE{$distname} ) {
    return $DIST_DIR_CACHE{$distname};
  }
  _debug( 'Working on: ' . $filename );
  my $dev = find_dev( _path($filename)->parent );

  if ( not defined $dev ) {
    ## no critic (Variables::ProhibitPackageVars)
    local $Carp::CarpLevel = $Carp::CarpLevel + 1;
    return File::ShareDir::dist_dir($distname);
  }

  my $devel_share_dir = $dev->child($projectdir);

  if ($strict) {
    $devel_share_dir = $devel_share_dir->child( 'dist', $distname );
  }
  if ( -d $devel_share_dir ) {
    _debug( 'ISDEV : exists : <devroot>/' . $devel_share_dir->relative($dev) );
    return ( $DIST_DIR_CACHE{$distname} = $devel_share_dir );
  }
  _debug( 'ISPROD: does not exist : <devroot>/' . $devel_share_dir->relative($dev) );
  ## no critic (Variables::ProhibitPackageVars)
  local $Carp::CarpLevel = $Carp::CarpLevel + 1;
  return File::ShareDir::dist_dir($distname);
}

sub build_dist_dir {
  my ( $class, undef, $arg, $col ) = @_;

  my $projectdir = _get_defaults( projectdir => $arg, $col );
  my $pathclass  = _get_defaults( pathclass  => $arg, $col );
  my $pathtiny   = _get_defaults( pathtiny   => $arg, $col );
  my $strict     = _get_defaults( strict     => $arg, $col );
  my $filename   = _get_defaults( filename   => $arg, $col );

  my $wrap_return_type;

  if ($pathclass) { $wrap_return_type = 'pathclassdir' }
  if ($pathtiny)  { $wrap_return_type = 'pathtiny' }

  my $distname = _get_defaults( distname => $arg, $col );

  if ( not $distname ) {
    return sub {
      my ($udistname) = @_;
      my $distdir = $class->_get_cached_dist_dir_result( $filename, $projectdir, $udistname, $strict );
      return _wrap_return( $wrap_return_type, $distdir );
    };
  }
  return sub {
    my $distdir = $class->_get_cached_dist_dir_result( $filename, $projectdir, $distname, $strict );
    return _wrap_return( $wrap_return_type, $distdir );
  };
}
















































sub build_dist_file {
  my ( $class, undef, $arg, $col ) = @_;

  my $projectdir = _get_defaults( projectdir => $arg, $col );
  my $pathclass  = _get_defaults( pathclass  => $arg, $col );
  my $pathtiny   = _get_defaults( pathtiny   => $arg, $col );

  my $strict   = _get_defaults( strict   => $arg, $col );
  my $filename = _get_defaults( filename => $arg, $col );

  my $distname = _get_defaults( distname => $arg, $col );

  my $wrap_return_type;

  if ($pathclass) { $wrap_return_type = 'pathclassfile' }
  if ($pathtiny)  { $wrap_return_type = 'pathtiny' }

  my $check_file = sub {
    my ( $distdir, $wanted_file ) = @_;
    my $child = _path($distdir)->child($wanted_file);
    return unless -e $child;
    if ( -d $child ) {
      return _croak("Found dist_file '$child', but is a dir");
    }
    if ( not -r $child ) {
      return _croak("File '$child', no read permissions");
    }
    return _wrap_return( $wrap_return_type, $child );
  };
  if ( not $distname ) {
    return sub {
      my ( $udistname, $wanted_file ) = @_;
      my $distdir = $class->_get_cached_dist_dir_result( $filename, $projectdir, $udistname, $strict );
      return $check_file->( $distdir, $wanted_file );
    };
  }
  return sub {
    my ($wanted_file) = @_;
    my $distdir = $class->_get_cached_dist_dir_result( $filename, $projectdir, $distname, $strict );
    return $check_file->( $distdir, $wanted_file );
  };
}

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

File::ShareDir::ProjectDistDir - Simple set-and-forget using of a '/share' directory in your projects root

=head1 VERSION

version 1.000004

=head1 SYNOPSIS

  package An::Example::Package;

  use File::ShareDir::ProjectDistDir;

  # during development, $dir will be $projectroot/share
  # but once installed, it will be wherever File::Sharedir thinks it is.
  my $dir = dist_dir('An-Example')

Project layout requirements:

  $project/
  $project/lib/An/Example/Package.pm
  $project/share/   # files for package 'An-Example' go here.

You can use a directory name other than 'share' ( Assuming you make sure when
you install that, you specify the different directory there also ) as follows:

  use File::ShareDir::ProjectDistDir ':all', defaults => {
    projectdir => 'templates',
  };

=head1 METHODS

=head2 import

    use File::ShareDir::ProjectDistDir (@args);

This uses L<< C<Sub::Exporter>|Sub::Exporter >> to do the heavy lifting, so most usage of this module can be maximized by
understanding that first.

=over 4

=item * B<C<:all>>

    ->import( ':all' , .... )

Import both C<dist_dir> and C<dist_file>

=item * B<C<dist_dir>>

    ->import('dist_dir' , .... )

Import the dist_dir method

=item * B<C<dist_file>>

    ->import('dist_file' , .... )

Import the dist_file method

=item * B<C<projectdir>>

    ->import( .... , projectdir => 'share' )

Specify what the project directory is as a path relative to the base of your distributions source,
and this directory will be used as a C<ShareDir> simulation path for the exported methods I<During development>.

If not specified, the default value 'share' is used.

=item * B<C<filename>>

    ->import( .... , filename => 'some/path/to/foo.pm' );

Generally you don't want to set this, as its worked out by caller() to work out the name of
the file its being called from. This file's path is walked up to find the 'lib' element with a sibling
of the name of your C<projectdir>.

=item * B<C<distname>>

    ->import( .... , distname => 'somedistname' );

Specifying this argument changes the way the functions are emitted at I<installed C<runtime>>, so that instead of
taking the standard arguments File::ShareDir does, the specification of the C<distname> in those functions is eliminated.

i.e:

    # without this flag
    use File::ShareDir::ProjectDistDir qw( :all );

    my $dir = dist_dir('example');
    my $file = dist_file('example', 'path/to/file.pm' );

    # with this flag
    use File::ShareDir::ProjectDistDir ( qw( :all ), distname => 'example' );

    my $dir = dist_dir();
    my $file = dist_file('path/to/file.pm' );

=item * B<C<strict>>

    ->import( ... , strict => 1 );

This parameter specifies that all C<dist> C<sharedirs> will occur within the C<projectdir> directory using the following layout:

    <root>/<projectdir>/dist/<DISTNAME>/

As opposed to

    <root>/<projectdir>

This means if Heuristics misfire and accidentally find another distributions C<share> directory, it will not pick up on it
unless that C<share> directory also has that layout, and will instead revert to the C<installdir> path in C<@INC>

B<This parameter may become the default option in the future>

Specifying this parameter also mandates you B<MUST> declare the C<DISTNAME> value in your file somewhere. Doing otherwise is
considered insanity anyway.

=item * B<C<defaults>>

    ->import( ... , defaults => {
        filename => ....,
        projectdir => ....,
    });

This is mostly an alternative syntax for specifying C<filename> and C<projectdir>,
which is mostly used internally, and their corresponding other values are packed into this one.

=back

=head3 Sub::Exporter tricks of note.

=head4 Make your own sharedir util

    package Foo::Util;

    sub import {
        my ($caller_class, $caller_file, $caller_line )  = caller();
        if ( grep { /share/ } @_ ) {
            require File::ShareDir::ProjectDistDir;
            File::ShareDir::ProjectDistDir->import(
                filename => $caller_file,
                dist_dir => { distname => 'myproject' , -as => 'share' },
                dist_dir => { distname => 'otherproject' , -as => 'other_share' , projectdir => 'share2' },
                -into => $caller_class,
            );
        }
    }

    ....

    package Foo;
    use Foo::Util qw( share );

    my $dir = share();
    my $other_dir => other_share();

=head2 build_dist_dir

    use File::ShareDir::ProjectDirDir ( : all );

    #  this calls
    my $coderef = File::ShareDir::ProjectDistDir->build_dist_dir(
      'dist_dir' => {},
      { defaults => { filename => 'path/to/yourcallingfile.pm', projectdir => 'share' } }
    );

    use File::ShareDir::ProjectDirDir ( qw( :all ), distname => 'example-dist' );

    #  this calls
    my $coderef = File::ShareDir::ProjectDistDir->build_dist_dir(
      'dist_dir' => {},
      { distname => 'example-dist', defaults => { filename => 'path/to/yourcallingfile.pm', projectdir => 'share' } }
    );

    use File::ShareDir::ProjectDirDir
      dist_dir => { distname => 'example-dist', -as => 'mydistdir' },
      dist_dir => { distname => 'other-dist',   -as => 'otherdistdir' };

    # This calls
    my $coderef = File::ShareDir::ProjectDistDir->build_dist_dir(
      'dist_dir',
      { distname => 'example-dist' },
      { defaults => { filename => 'path/to/yourcallingfile.pm', projectdir => 'share' } },
    );
    my $othercoderef = File::ShareDir::ProjectDistDir->build_dist_dir(
      'dist_dir',
      { distname => 'other-dist' },
      { defaults => { filename => 'path/to/yourcallingfile.pm', projectdir => 'share' } },
    );

    # And leverages Sub::Exporter to create 2 subs in your package.

Generates the exported 'dist_dir' method. In development environments, the generated method will return a path to the
development directories 'share' directory. In non-development environments, this simply returns C<File::ShareDir::dist_dir>.

As a result of this, specifying the Distribution name is not required during development ( unless in C<strict> mode ), however,
it will start to matter once it is installed. This is a potential avenues for bugs if you happen to name it wrong.

In C<strict> mode, the distribution name is B<ALWAYS REQUIRED>, either at least at C<import> or C<dist_dir()> time.

=head2 build_dist_file

    use File::ShareDir::ProjectDirDir ( : all );

    #  this calls
    my $coderef = File::ShareDir::ProjectDistDir->build_dist_file(
      'dist_file' => {},
      { defaults => { filename => 'path/to/yourcallingfile.pm', projectdir => 'share' } }
    );

    use File::ShareDir::ProjectDirDir ( qw( :all ), distname => 'example-dist' );

    #  this calls
    my $coderef = File::ShareDir::ProjectDistDir->build_dist_file(
      'dist_file' => {},
      { distname => 'example-dist', defaults => { filename => 'path/to/yourcallingfile.pm', projectdir => 'share' } }
    );

    use File::ShareDir::ProjectDirDir
      dist_file => { distname => 'example-dist', -as => 'mydistfile' },
      dist_file => { distname => 'other-dist',   -as => 'otherdistfile' };

    # This calls
    my $coderef = File::ShareDir::ProjectDistDir->build_dist_file(
      'dist_file',
      { distname => 'example-dist' },
      { defaults => { filename => 'path/to/yourcallingfile.pm', projectdir => 'share' } },
    );
    my $othercoderef = File::ShareDir::ProjectDistDir->build_dist_file(
      'dist_file',
      { distname => 'other-dist' },
      { defaults => { filename => 'path/to/yourcallingfile.pm', projectdir => 'share' } },
    );

    # And leverages Sub::Exporter to create 2 subs in your package.

Generates the 'dist_file' method.

In development environments, the generated method will return
a path to the development directories 'share' directory. In non-development environments, this simply returns
C<File::ShareDir::dist_file>.

Caveats as a result of package-name as stated in L</build_dist_dir> also apply to this method.

=begin MetaPOD::JSON v1.0.0

{
    "namespace":"File::ShareDir::ProjectDistDir"
}


=end MetaPOD::JSON

=head1 SIGNIFICANT CHANGES

=head2 1.000000

=head3 Strict Mode.

=head4 Using Strict Mode

    use File::ShareDir::ProjectDistDir ':all', strict => 1;
    use File::ShareDir::ProjectDistDir 'dist_dir' => { defaults => { strict => 1 }};

=head4 Why you should use strict mode

Starting with C<1.000000>, there is a parameter C<strict> that changes
how C<sharedir> resolution performs.

Without strict:

    lib/...
    share/...

With strict

    lib/...
    share/dist/Dist-Name-Here/...

This technique greatly builds resilience to the long standing problem
with "develop" vs "install" heuristic ambiguity.

Here at least,

    dist_dir('Dist-Name')

Will instead fall back to

    @INC/auto/share/dist/Dist-Name

When

    share/dist/Dist-Name

Does not exist.

This means if you have a layout like this:

    <DEVROOT>/inc/<a local::lib path here>
    <DEVROOT>/lib/<development files here>

Then when C<Foo-Bar-Baz> is installed as:

    <DEVROOT>/inc/lib/Foo/Bar/Baz.pm
    <DEVROOT>/inc/lib/auto/share/dist/Foo-Bar-Baz

Then C<Baz.pm> will not see the C<DEVROOT> and assume "Hey, this is development" and then proceed to try finding files in
C<DEVROOT/share>

Instead, C<DEVROOT> must have C<DEVROOT/share/dist/Foo-Bar-Baz> too, otherwise it reverts
to C<DEVROOT/inc/lib/auto...>

=head3 C<Path::Class> interfaces deprecated and dependency dropped.

If you have any dependence on this function, now is the time to get yourself off it.

=head4 Minimum Changes to stay with C<Path::Class> short term.

As the dependency has been dropped on C<Path::Class>, if you have C<CPAN>
modules relying on C<Path::Class> interface, you should now at a very minimum
start declaring

    { requires => "Path::Class" }

This will keep your dist working, but will not be future proof against further changes.

=head4 Staying with C<Path::Class> long term.

Recommended approach if you want to stay using the C<Path::Class> interface:

    use File::ShareDir::... etc
    use Path::Class qw( dir file );

    my $dir = dir( dist_dir('Dist-Name') );

This should future-proof you against anything File::ShareDir may do in the future.

=head3 C<Versioning Scheme arbitrary converted to float>

This change is a superficial one, and should have no bearing on how significant you think this release is.

It is a significant release, but the primary reason for the version change is simply to avoid compatibility issues in
I<versions themselves>.

However, outside that, C<x.y.z> semantics are still intended to be semi-meaningful, just with less C<.> and more C<0> ☺

=head3 C<dev> path determination now deferred to call time instead of C<use>

This was essentially a required change to make C<strict> mode plausible, because strict mode _requires_ the C<distname> to be
known, even in the development environment.

This should not have any user visible effects, but please, if you have any problems, file a bug.

=head3 C<file> component determination wrested from C<File::ShareDir>.

    dist_file('foo','bar')

Is now simply sugar syntax for

    path(dist_dir('foo'))->child('bar')

This should have no side effects in your code, but please file any bugs you experience.

( return value is still C<undef> if the file does not exist, and still C<croak>'s if the file is not a file, or unreadable, but
these may both be subject to change )

=head2 0.5.0 - Heuristics and Return type changes

=head3 New C<devdir> heuristic

Starting with 0.5.0, instead of using our simple C<lib/../share> pattern heuristic, a more
advanced heuristic is used from the new L<< C<Path::FindDev>|Path::FindDev >> and L<< C<Path::IsDev>|Path::IsDev >>.

This relies on a more "concrete" marker somewhere at the top of your development tree, and more importantly, checks for the
existence of specific files that are not likely to occur outside a project root.

C<lib> and C<share> based heuristics were a little fragile, for a few reasons:

=over 4

=item * C<lib> can, and does appear all over UNIX file systems, for purposes B<other> than development project roots.

For instance, have a look in C</usr/>

    /usr/bin
    /usr/lib
    /usr/share  ## UHOH.

This would have the very bad side effect of anything installed in C</usr/lib> thinking its "in development".

Fortunately, nobody seems to have hit this specific bug, which I suspect is due only to C</usr/lib> being a symbolic link on most
x86_64 systems.

=item * C<lib> is also reasonably common within C<CPAN> package names.

For instance:

    lib::abs

Which means you'll have a hierarchy like:

    $PREFIX/lib/lib/abs

All you need for something to go horribly wrong would be for somebody to install a C<CPAN> module named:

    share::mystuff

Or similar, and instantly, you have:

    $PREFIX/lib/lib/
    $PREFIX/lib/share/

Which would mean any module calling itself C<lib::*> would be unable to use this module.

=back

So instead, as of C<0.5.0>, the heuristic revolves around certain specific files being in the C<dev> directory.

Which is hopefully a more fault resilient mechanism.

=head3 New Return Types

Starting with 0.5.0, the internals are now based on L<< C<Path::Tiny>|Path::Tiny >> instead of L<< C<Path::Class>|Path::Class >>,
and as a result, there may be a few glitches in transition.

Also, previously you could get a C<Path::Class::*> object back from C<dist_dir> and C<dist_file> by importing it as such:

    use File::ShareDir::ProjectDistDir
        qw( dist_dir dist_file ),
        defaults => { pathclass => 1 };

Now you can also get C<Path::Tiny> objects back, by passing:

    use File::ShareDir::ProjectDistDir
        qw( dist_dir dist_file ),
        defaults => { pathtiny => 1 };

B<< For the time being, you can still get Path::Class objects back, it is deprecated since 1.000000 >>

( In fact, I may even make 2 specific sub-classes of C<PDD> for people who want objects back, as it will make the C<API> and the
code much cleaner )

=head1 AUTHOR

Kent Fredric <kentnl@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Kent Fredric <kentnl@cpan.org>.

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

=cut