Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Post History

72%
+6 −1
Q&A How do I choose the correct Perl module from these variations?

Perl modules sometimes have different implementations. The ::PP suffix means it's a "Pure Perl" implementation, where portability is the goal. The ::XS suffix is for the C-based implementation, whe...

posted 3y ago by ghost-in-the-zsh‭  ·  edited 3y ago by ghost-in-the-zsh‭

Answer
#2: Post edited by user avatar ghost-in-the-zsh‭ · 2020-12-01T05:34:14Z (over 3 years ago)
Add version updates note
  • Perl modules sometimes have different implementations. The `::PP` suffix means it's a "Pure Perl" implementation, where *portability* is the goal. The `::XS` suffix is for the C-based implementation, where *speed* is the goal. Finally, `JSON` is just the top-level module itself, i.e. the one you actually use.
  • [This site](http://shadow.cat/blog/matt-s-trout/mstpan-7) has a good description of their differences, but to quote:
  • > ### JSON
  • >
  • > JSON.pm is a wrapper around `JSON::PP` and `JSON::XS` - it also does a bunch of moderately crazy things for compatibility reasons, including extra shim code for very old perls [...]
  • >
  • > ### JSON::PP
  • >
  • > This is the standard pure perl implementation, and if you're not performance dependent, there's nothing wrong with using it directly [...]
  • >
  • > ### JSON::XS
  • >
  • > Ridiculously fast JSON implementation in C. Absolutely wonderful [...]
  • Just installing the top-level `JSON` module should work. The part about compatibility just means that both do the same thing, i.e. you should get the same output from both.
  • I installed the Perl `JSON` module a few years ago on a RHEL server I managed and it was a really straightforward process: just install (or build) the module from [CPAN](http://search.cpan.org/~makamaka/JSON-2.90/lib/JSON.pm) and done.
  • Installing should be a simple case of either using the OS package manager (if in GNU+Linux), using the `cpan` utility, or building from source. The OS package manager is recommended because it helps keep things updated automatically.
  • To verify that it's installed, just try the following command from the terminal (assuming GNU+Linux):
  • ```bash
  • $ perl -e 'use JSON;'
  • ```
  • If it doesn't complain, then you should be good to go. If you get errors, then you should get ready to go in an adventure.
  • Perl modules sometimes have different implementations. The `::PP` suffix means it's a "Pure Perl" implementation, where *portability* is the goal. The `::XS` suffix is for the C-based implementation, where *speed* is the goal. Finally, `JSON` is just the top-level module itself, i.e. the one you actually use.
  • [This site](http://shadow.cat/blog/matt-s-trout/mstpan-7) has a good description of their differences, but to quote:
  • > ### JSON
  • >
  • > JSON.pm is a wrapper around `JSON::PP` and `JSON::XS` - it also does a bunch of moderately crazy things for compatibility reasons, including extra shim code for very old perls [...]
  • >
  • > ### JSON::PP
  • >
  • > This is the standard pure perl implementation, and if you're not performance dependent, there's nothing wrong with using it directly [...]
  • >
  • > ### JSON::XS
  • >
  • > Ridiculously fast JSON implementation in C. Absolutely wonderful [...]
  • Just installing the top-level `JSON` module should work. The part about compatibility just means that both do the same thing, i.e. you should get the same output from both.
  • I installed the Perl `JSON` module a few years ago on a RHEL server I managed and it was a really straightforward process: just install (or build) the module from [CPAN](http://search.cpan.org/~makamaka/JSON-2.90/lib/JSON.pm) and done. (Note that this is just an example and you may want to look for more recent versions.)
  • Installing should be a simple case of either using the OS package manager (if in GNU+Linux), using the `cpan` utility, or building from source. The OS package manager is recommended because it helps keep things updated automatically.
  • To verify that it's installed, just try the following command from the terminal (assuming GNU+Linux):
  • ```bash
  • $ perl -e 'use JSON;'
  • ```
  • If it doesn't complain, then you should be good to go. If you get errors, then you should get ready to go in an adventure.
#1: Initial revision by user avatar ghost-in-the-zsh‭ · 2020-12-01T05:29:50Z (over 3 years ago)
Perl modules sometimes have different implementations. The `::PP` suffix means it's a "Pure Perl" implementation, where *portability* is the goal. The `::XS` suffix is for the C-based implementation, where *speed* is the goal. Finally, `JSON` is just the top-level module itself, i.e. the one you actually use.

[This site](http://shadow.cat/blog/matt-s-trout/mstpan-7) has a good description of their differences, but to quote:

> ### JSON
> 
> JSON.pm is a wrapper around `JSON::PP` and `JSON::XS` - it also does a bunch of moderately crazy things for compatibility reasons, including extra shim code for very old perls [...]
>
> ### JSON::PP
>
> This is the standard pure perl implementation, and if you're not performance dependent, there's nothing wrong with using it directly [...]
>
> ### JSON::XS
>
> Ridiculously fast JSON implementation in C. Absolutely wonderful [...]

Just installing the top-level `JSON` module should work. The part about compatibility just means that both do the same thing, i.e. you should get the same output from both.

I installed the Perl `JSON` module a few years ago on a RHEL server I managed and it was a really straightforward process: just install (or build) the module from [CPAN](http://search.cpan.org/~makamaka/JSON-2.90/lib/JSON.pm) and done.

Installing should be a simple case of either using the OS package manager (if in GNU+Linux), using the `cpan` utility, or building from source. The OS package manager is recommended because it helps keep things updated automatically.

To verify that it's installed, just try the following command from the terminal (assuming GNU+Linux):

```bash
$ perl -e 'use JSON;'
```

If it doesn't complain, then you should be good to go. If you get errors, then you should get ready to go in an adventure.