NAME

Net::API::CPAN::Diff - Meta CPAN API Diff Class

SYNOPSIS

use Net::API::CPAN::Diff;
my $obj = Net::API::CPAN::Diff->new( {
  source => "MOMOTARO/Folklore-Japan-v1.2.2",
  statistics => [
    {
      deletions => 0,
      diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CHANGES b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CHANGES\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CHANGES\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CHANGES\n\@\@ -2,5 +3,5 \@\@\n v0.1.1 2023-08-19T13:10:37+0900\n    - Updated name returned\n",
      insertions => 1,
      source => "MOMOTARO/Folklore-Japan-v1.2.2/CHANGES",
      target => "MOMOTARO/Folklore-Japan-v1.2.3/CHANGES",
    },
    {
      deletions => 1,
      diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CONTRIBUTING.md b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CONTRIBUTING.md\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CONTRIBUTING.md\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CONTRIBUTING.md\n\@\@ -32 +32 \@\@\n - The versioning style used is dotted decimal, such as `v0.1.0`\n + The versioning style used is dotted decimal, such as `v0.1.1`\n",
      insertions => 1,
      source => "MOMOTARO/Folklore-Japan-v1.2.2/CONTRIBUTING.md",
      target => "MOMOTARO/Folklore-Japan-v1.2.3/CONTRIBUTING.md",
    },
    {
      deletions => 5,
      diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/lib/Foo/Bar.pm b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/lib/Foo/Bar.pm\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/lib/Foo/Bar.pm\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/lib/Foo/Bar.pm\n\@\@ -3 +3 \@\@\n - ## Version v0.1.0\n + Version v0.1.1\n\@\@ -7 +7 \@\@\n - ## Modified 2023/08/15\n + ## Modified 2023/08/19\n\@\@ -19 +19 \@\@\n - \$VERSION = 'v0.1.0';\n + \$VERSION = 'v0.1.1';\n\@\@ -29 +29 \@\@\n - sub name { return( \"John Doe\" ); }\n + sub name { return( \"Urashima Taro\" ); }\n\@\@ -48 + 48 \@\@\n -     v0.1.0\n +     v0.1.1",
      insertions => 5,
      source => "MOMOTARO/Folklore-Japan-v1.2.2/lib/Foo/Bar.pm",
      target => "MOMOTARO/Folklore-Japan-v1.2.3/lib/Foo/Bar.pm",
    },
    {
      deletions => 1,
      diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.json b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.json\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.json\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.json\n\@\@ -60 +60 \@\@\n -    \"version\" : \"v0.1.0\",\n +    \"version\" : \"v0.1.1\",\n",
      insertions => 1,
      source => "MOMOTARO/Folklore-Japan-v1.2.2/META.json",
      target => "MOMOTARO/Folklore-Japan-v1.2.3/META.json",
    },
    {
      deletions => 1,
      diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.yml b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.yml\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.yml\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.yml\n\@\@ -32 +32 \@\@\n - version: v0.1.0\n + version: v0.1.1\n",
      insertions => 1,
      source => "MOMOTARO/Folklore-Japan-v1.2.2/META.yml",
      target => "MOMOTARO/Folklore-Japan-v1.2.3/META.yml",
    },
  ],
  target => "MOMOTARO/Folklore-Japan-v1.2.3",
} ) || die( Net::API::CPAN::Diff->error );

my $string = $obj->diff;
my $str = $obj->object;
my $string = $obj->source;
my $array = $obj->statistics;
foreach my $this ( @$array )
{
    my $integer = $this->deletions;
    my $scalar = $this->diff;
    my $integer = $this->insertions;
    my $scalar = $this->source;
    my $scalar = $this->target;
}
my $string = $obj->target;

VERSION

v0.1.0

DESCRIPTION

This class serves to retrieve and manipulate diffs.

It inherits from Net::API::CPAN::Generic

CONSTRUCTOR

new

Provided with an hash or hash reference of parameters, and this instantiates a new Net::API::CPAN::Diff object.

The parameters that can be provided bear the same name and supports the same values as the methods below.

METHODS

diff

Sets or gets a string and returns a scalar object, even if there is no value.

object

Returns the object type for this class, which is diff

source

$obj->source( "MOMOTARO/Folklore-Japan-v1.2.2" );
my $string = $obj->source;

Sets or gets a string and returns a scalar object, even if there is no value.

statistics

$obj->statistics( [
  {
    deletions => 0,
    diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CHANGES b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CHANGES\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CHANGES\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CHANGES\n\@\@ -2,5 +3,5 \@\@\n v0.1.1 2023-08-19T13:10:37+0900\n    - Updated name returned\n",
    insertions => 1,
    source => "MOMOTARO/Folklore-Japan-v1.2.2/CHANGES",
    target => "MOMOTARO/Folklore-Japan-v1.2.3/CHANGES",
  },
  {
    deletions => 1,
    diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CONTRIBUTING.md b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CONTRIBUTING.md\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CONTRIBUTING.md\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CONTRIBUTING.md\n\@\@ -32 +32 \@\@\n - The versioning style used is dotted decimal, such as `v0.1.0`\n + The versioning style used is dotted decimal, such as `v0.1.1`\n",
    insertions => 1,
    source => "MOMOTARO/Folklore-Japan-v1.2.2/CONTRIBUTING.md",
    target => "MOMOTARO/Folklore-Japan-v1.2.3/CONTRIBUTING.md",
  },
  {
    deletions => 5,
    diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/lib/Foo/Bar.pm b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/lib/Foo/Bar.pm\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/lib/Foo/Bar.pm\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/lib/Foo/Bar.pm\n\@\@ -3 +3 \@\@\n - ## Version v0.1.0\n + Version v0.1.1\n\@\@ -7 +7 \@\@\n - ## Modified 2023/08/15\n + ## Modified 2023/08/19\n\@\@ -19 +19 \@\@\n - \$VERSION = 'v0.1.0';\n + \$VERSION = 'v0.1.1';\n\@\@ -29 +29 \@\@\n - sub name { return( \"John Doe\" ); }\n + sub name { return( \"Urashima Taro\" ); }\n\@\@ -48 + 48 \@\@\n -     v0.1.0\n +     v0.1.1",
    insertions => 5,
    source => "MOMOTARO/Folklore-Japan-v1.2.2/lib/Foo/Bar.pm",
    target => "MOMOTARO/Folklore-Japan-v1.2.3/lib/Foo/Bar.pm",
  },
  {
    deletions => 1,
    diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.json b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.json\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.json\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.json\n\@\@ -60 +60 \@\@\n -    \"version\" : \"v0.1.0\",\n +    \"version\" : \"v0.1.1\",\n",
    insertions => 1,
    source => "MOMOTARO/Folklore-Japan-v1.2.2/META.json",
    target => "MOMOTARO/Folklore-Japan-v1.2.3/META.json",
  },
  {
    deletions => 1,
    diff => "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.yml b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.yml\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.yml\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.yml\n\@\@ -32 +32 \@\@\n - version: v0.1.0\n + version: v0.1.1\n",
    insertions => 1,
    source => "MOMOTARO/Folklore-Japan-v1.2.2/META.yml",
    target => "MOMOTARO/Folklore-Japan-v1.2.3/META.yml",
  },
] );
my $array = $obj->statistics;
foreach my $this ( @$array )
{
    $this->deletions( 0 );
    my $integer = $this->deletions;
    $this->diff( "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CHANGES b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CHANGES\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CHANGES\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CHANGES\n\@\@ -2,5 +3,5 \@\@\n v0.1.1 2023-08-19T13:10:37+0900\n    - Updated name returned\n" );
    my $scalar = $this->diff;
    $this->insertions( 1 );
    my $integer = $this->insertions;
    $this->source( "MOMOTARO/Folklore-Japan-v1.2.2/CHANGES" );
    my $scalar = $this->source;
    $this->target( "MOMOTARO/Folklore-Japan-v1.2.3/CHANGES" );
    my $scalar = $this->target;
}

Sets or gets an array of dynamic class objects with class name Net::API::CPAN::Diff::Statistics and having the folowing properties also accessible as methods, and returns an array object even if there is no value.

A Net::API::CPAN::Diff::Statistics object will be instantiated with each value from the array provided and replace said value.

  • deletions integer (number object)

  • diff scalar_as_object

  • insertions integer (number object)

  • source scalar_as_object

  • target scalar_as_object

target

$obj->target( "MOMOTARO/Folklore-Japan-v1.2.3" );
my $string = $obj->target;

Sets or gets a string and returns a scalar object, even if there is no value.

API SAMPLE

{
   "source" : "MOMOTARO/Folklore-Japan-v1.2.2",
   "statistics" : [
      {
         "deletions" : 0,
         "diff" : "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CHANGES b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CHANGES\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CHANGES\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CHANGES\n@@ -2,5 +3,5 @@\n v0.1.1 2023-08-19T13:10:37+0900\n    - Updated name returned\n",
         "insertions" : 1,
         "source" : "MOMOTARO/Folklore-Japan-v1.2.2/CHANGES",
         "target" : "MOMOTARO/Folklore-Japan-v1.2.3/CHANGES"
      },
      {
         "deletions" : 1,
         "diff" : "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CONTRIBUTING.md b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CONTRIBUTING.md\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/CONTRIBUTING.md\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/CONTRIBUTING.md\n@@ -32 +32 @@\n - The versioning style used is dotted decimal, such as `v0.1.0`\n + The versioning style used is dotted decimal, such as `v0.1.1`\n",
         "insertions" : 1,
         "source" : "MOMOTARO/Folklore-Japan-v1.2.2/CONTRIBUTING.md",
         "target" : "MOMOTARO/Folklore-Japan-v1.2.3/CONTRIBUTING.md"
      },
      {
         "deletions" : 5,
         "diff" : "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/lib/Foo/Bar.pm b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/lib/Foo/Bar.pm\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/lib/Foo/Bar.pm\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/lib/Foo/Bar.pm\n@@ -3 +3 @@\n - ## Version v0.1.0\n + Version v0.1.1\n@@ -7 +7 @@\n - ## Modified 2023/08/15\n + ## Modified 2023/08/19\n@@ -19 +19 @@\n - $VERSION = 'v0.1.0';\n + $VERSION = 'v0.1.1';\n@@ -29 +29 @@\n - sub name { return( \"John Doe\" ); }\n + sub name { return( \"Urashima Taro\" ); }\n@@ -48 + 48 @@\n -     v0.1.0\n +     v0.1.1",
         "insertions" : 5,
         "source" : "MOMOTARO/Folklore-Japan-v1.2.2/lib/Foo/Bar.pm",
         "target" : "MOMOTARO/Folklore-Japan-v1.2.3/lib/Foo/Bar.pm"
      },
      {
         "deletions" : 1,
         "diff" : "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.json b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.json\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.json\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.json\n@@ -60 +60 @@\n -    \"version\" : \"v0.1.0\",\n +    \"version\" : \"v0.1.1\",\n",
         "insertions" : 1,
         "source" : "MOMOTARO/Folklore-Japan-v1.2.2/META.json",
         "target" : "MOMOTARO/Folklore-Japan-v1.2.3/META.json"
      },
      {
         "deletions" : 1,
         "diff" : "diff --git a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.yml b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.yml\n--- a/var/tmp/source/MOMOTARO/Folklore-Japan-v1.2.2/META.yml\n+++ b/var/tmp/target/MOMOTARO/Folklore-Japan-v1.2.3/META.yml\n@@ -32 +32 @@\n - version: v0.1.0\n + version: v0.1.1\n",
         "insertions" : 1,
         "source" : "MOMOTARO/Folklore-Japan-v1.2.2/META.yml",
         "target" : "MOMOTARO/Folklore-Japan-v1.2.3/META.yml"
      }
   ],
   "target" : "MOMOTARO/Folklore-Japan-v1.2.3"
}

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Net::API::CPAN, Net::API::CPAN::Activity, Net::API::CPAN::Author, Net::API::CPAN::Changes, Net::API::CPAN::Changes::Release, Net::API::CPAN::Contributor, Net::API::CPAN::Cover, Net::API::CPAN::Diff, Net::API::CPAN::Distribution, Net::API::CPAN::DownloadUrl, Net::API::CPAN::Favorite, Net::API::CPAN::File, Net::API::CPAN::Module, Net::API::CPAN::Package, Net::API::CPAN::Permission, Net::API::CPAN::Rating, Net::API::CPAN::Release

MetaCPAN::API, MetaCPAN::Client

https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md

COPYRIGHT & LICENSE

Copyright(c) 2023 DEGUEST Pte. Ltd.

All rights reserved

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