Guest User

Untitled

a guest
Sep 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. my $git = Import::Git->new( dryrun => $dryrun );
  2.  
  3. around BUILDARGS => sub {
  4. my $orig = shift;
  5. my $class = shift;
  6.  
  7. my %args = ( @_ == 1 ? %{ $_[ 0 ] } : @_ );
  8.  
  9. if ( !%args || $args{ 'dryrun' } != 1 ) {
  10. return $class->$orig( @_ );
  11. }
  12. else {
  13. return Import::Git::dryrun->$orig( @_ );
  14. }
  15. };
  16.  
  17. DB<1> x Import::Git->new( dryrun => 1 )
  18. 0 Import::Git=HASH(0x2fd9210)
  19. 'dryrun' => 1
  20. DB<2> x Import::Git->new()
  21. 0 Import::Git=HASH(0x301dbb8)
  22. 'dryrun' => 0
  23. DB<3>
  24.  
  25. # change this:
  26. return Import::Git::dryrun->$orig( @_ );
  27. # to this
  28. return Import::Git::dryrun->new( @_ );
Add Comment
Please, Sign In to add comment