Guest User

Untitled

a guest
Jul 21st, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.86 KB | None | 0 0
  1. diff --git a/Makefile.PL b/Makefile.PL
  2. index dd41d6f..c607b11 100644
  3. --- a/Makefile.PL
  4. +++ b/Makefile.PL
  5. @@ -48,8 +48,7 @@ requires 'Sub::Name' => '0.04';
  6. requires 'Data::Dumper::Concise' => '1.000';
  7.  
  8. my %replication_requires = (
  9. - 'Moose', => '0.87',
  10. - 'MooseX::AttributeHelpers' => '0.21',
  11. + 'Moose', => '0.90',
  12. 'MooseX::Types', => '0.16',
  13. 'namespace::clean' => '0.11',
  14. 'Hash::Merge', => '0.11',
  15. diff --git a/lib/DBIx/Class/Storage/DBI/Replicated.pm b/lib/DBIx/Class/Storage/DBI/Replicated.pm
  16. index 1589b5f..d8a5f6d 100644
  17. --- a/lib/DBIx/Class/Storage/DBI/Replicated.pm
  18. +++ b/lib/DBIx/Class/Storage/DBI/Replicated.pm
  19. @@ -7,8 +7,7 @@ BEGIN {
  20. ## use, so we explicitly test for these.
  21.  
  22. my %replication_required = (
  23. - 'Moose' => '0.87',
  24. - 'MooseX::AttributeHelpers' => '0.21',
  25. + 'Moose' => '0.90',
  26. 'MooseX::Types' => '0.16',
  27. 'namespace::clean' => '0.11',
  28. 'Hash::Merge' => '0.11'
  29. @@ -119,8 +118,7 @@ to force a query to run against Master when needed.
  30.  
  31. Replicated Storage has additional requirements not currently part of L<DBIx::Class>
  32.  
  33. - Moose => '0.87',
  34. - MooseX::AttributeHelpers => '0.20',
  35. + Moose => '0.90',
  36. MooseX::Types => '0.16',
  37. namespace::clean => '0.11',
  38. Hash::Merge => '0.11'
  39. diff --git a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
  40. index e5fa1a1..a7a1dfa 100644
  41. --- a/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
  42. +++ b/lib/DBIx/Class/Storage/DBI/Replicated/Pool.pm
  43. @@ -1,7 +1,6 @@
  44. package DBIx::Class::Storage::DBI::Replicated::Pool;
  45.  
  46. use Moose;
  47. -use MooseX::AttributeHelpers;
  48. use DBIx::Class::Storage::DBI::Replicated::Replicant;
  49. use List::Util 'sum';
  50. use Scalar::Util 'reftype';
  51. @@ -125,26 +124,31 @@ removes the replicant under $key from the pool
  52.  
  53. has 'replicants' => (
  54. is=>'rw',
  55. - metaclass => 'Collection::Hash',
  56. + traits => ['Hash'],
  57. isa=>HashRef['Object'],
  58. default=>sub {{}},
  59. - provides => {
  60. - 'set' => 'set_replicant',
  61. - 'get' => 'get_replicant',
  62. - 'empty' => 'has_replicants',
  63. - 'count' => 'num_replicants',
  64. - 'delete' => 'delete_replicant',
  65. - 'values' => 'all_replicant_storages',
  66. + handles => {
  67. + 'set_replicant' => 'set',
  68. + 'get_replicant' => 'get',
  69. + 'has_replicants' => 'is_empty',
  70. + 'num_replicants' => 'count',
  71. + 'delete_replicant' => 'delete',
  72. + 'all_replicant_storages' => 'values',
  73. },
  74. );
  75.  
  76. +around has_replicants => sub {
  77. + my ($orig, $self) = @_;
  78. + return !$self->$orig;
  79. +};
  80. +
  81. has next_unknown_replicant_id => (
  82. is => 'rw',
  83. - metaclass => 'Counter',
  84. + traits => ['Counter'],
  85. isa => Int,
  86. default => 1,
  87. - provides => {
  88. - inc => 'inc_unknown_replicant_id'
  89. + handles => {
  90. + 'inc_unknown_replicant_id' => 'inc',
  91. },
  92. );
Add Comment
Please, Sign In to add comment