Closed akzhan closed 7 years ago
I don't think this is doable. How will you fetch data from the web? The footprint need to be tiny, and using something like LWP will increase the footprint, compared to just using Mojolicious.
What does "was LOL" mean? And what's the problem with depending on Mojolicious?
How would you replace Mojo::JSON::Pointer with JSON::Pointer without breaking the interface?
Just code piece (it passes all Mojo::JSON::Pointer
tests):
package Panda::JSON::Pointer;
=head1 NAME
Panda::JSON::Pointer
=head1 DESCRIPTION
L<Mojo::JSON::Pointer> API compatible implementation
without L</Mojolicious> dependency.
=cut
use Panda::Perl;
use JSON::Pointer ();
sub new {
my ( $class, $data ) = @_;
$class = ref($class) if ref $class;
my $self = bless( { data => $data }, $class );
return $self;
}
sub data {
my $self = shift;
return $self->{data} unless scalar(@_);
$self->{data} = $_[0];
return $self;
}
{
no strict 'refs';
for my $method ( qw( get contains add remove replace set copy move test ) ) {
*{$method} = sub {
my $self = shift;
return JSON::Pointer->$method( $self->{data}, @_ );
};
}
}
1;
What does "was LOL" mean? And what's the problem with depending on Mojolicious?
Mojolicious is all-in-one framework. When I need only fetch/parse some data it's very strange to bundle Mojolicious with Catalyst/Dancer/Raisin etc.
I would like your answer on my questions above.
FYI: this request have been closed before: https://github.com/jhthorsen/json-validator/issues/17
Proposal: Allow to use JSON::Validator
with injection points like JSON::Validator::URI, JSON::Validator::JSON, JSON::Validator::JSON::Pointer etc.
By default these implementations should be aliased to Mojo ones.
That's not going to happen. I'm not adding extensive polyfill to JSON::Validator. Reason: Maintenance cost.
OK
I was bundled JSON::Validator into our Catalyst application but was LOL due to Mojolicious dependency.
Can I provide pull request with some updates like
etc.?
May need some extension/dependency injection points?