The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Net::API::CPAN::File - Meta CPAN API File Class

SYNOPSIS

my $obj = Net::API::CPAN::File->new( {
abstract => "Japan Folklore Object Class",
author => "MOMOTARO",
authorized => \1,
binary => \0,
date => "2023-07-29T05:10:12",
deprecated => \0
,
description => "Folklore::Japan is a totally fictious perl 5 module designed to serve as an example for the MetaCPAN API.",
directory => \0
,
dist_fav_count => 1,
distribution => "Folklore::Japan",
documentation => "Folklore::Japan",
id => "l0tsOf1192fuN100",
indexed => \1
,
level => 1,
maturity => "released",
mime => "text/x-script.perl-module",
module => [
{
associated_pod => "MOMOTARO/Folklore-Japan-v1.2.3/lib/Folklore/Japan.pm",
authorized => \1
,
indexed => \1
,
name => "Folklore::Japan",
version => "v1.2.3",
version_numified => "1.002003",
},
],
name => "Japan.pm",
path => "lib/Folklore/Japan.pm",
pod => "NAME Folklore::Japan - Japan Folklore Object Class VERSION version v1.2.3 SYNOPSIS use Folklore::Japan; my \$fun = Folklore::Japan->new; DESCRIPTION This is an imaginary class object to Japan folklore to only serve as dummy example AUTHOR Momo Taro <momo.taro\@example.jp> COPYRIGHT AND LICENSE This software is copyright (c) 2023 by Okayama, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.",
pod_lines => [
[
1192,
1868,
],
],
release => "Folklore-Japan-v1.2.3",
sloc => 202,
slop => 637,
stat => {
gid => 12345,
mode => 33188,
mtime => 1690618397,
size => 10240,
uid => 16790,
},
status => "latest",
suggest => {
input => [
"Folklore::Japan",
],
payload => {
doc_name => "Folklore::Japan",
},
weight => 985,
},
version => "v1.2.3",
version_numified => "1.002003",
} ) || die( Net::API::CPAN::File->error );
my $string = $obj->abstract;
# Returns a scalar object when this is a string, or an Net::API::CPAN::Author object
my $author = $obj->author;
my $bool = $obj->authorized;
my $bool = $obj->binary;
my $string = $obj->category;
my $date = $obj->date;
my $bool = $obj->deprecated;
my $string = $obj->description;
my $string = $obj->dir;
my $bool = $obj->directory;
my $num = $obj->dist_fav_count;
my $string = $obj->distribution;
my $string = $obj->documentation;
my $uri = $obj->download_url;
my $string = $obj->id;
my $bool = $obj->indexed;
my $num = $obj->level;
my $string = $obj->maturity;
my $string = $obj->mime;
my $array = $obj->module;
foreach my $this ( @$array )
{
my $scalar = $this->associated_pod;
my $boolean = $this->authorized;
my $boolean = $this->indexed;
my $scalar = $this->name;
my $scalar = $this->version;
my $number = $this->version_numified;
}
my $string = $obj->name;
my $str = $obj->object;
my $string = $obj->path;
my $string = $obj->pod;
my $array = $obj->pod_lines;
# Returns a scalar object when this is a string, or an Net::API::CPAN::Release object
my $release = $obj->release;
my $num = $obj->sloc;
my $num = $obj->slop;
my $this = $obj->stat;
my $integer = $obj->stat->gid;
my $integer = $obj->stat->mode;
my $datetime = $obj->stat->mtime;
my $integer = $obj->stat->size;
my $integer = $obj->stat->uid;
my $string = $obj->status;
my $this = $obj->suggest;
my $array = $obj->suggest->input;
my $hash = $obj->suggest->payload;
my $integer = $obj->suggest->weight;
my $vers = $obj->version;
my $num = $obj->version_numified;

VERSION

v0.1.0

DESCRIPTION

This class serves to retrieve and manipulate files.

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::File object.

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

METHODS

abstract

$obj->abstract( "Japan Folklore Object Class" );
my $string = $obj->abstract;

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

author

$obj->author( "MOMOTARO" );
# Returns a scalar object when this is a string, or an Net::API::CPAN::Author object
my $author = $obj->author;

Sets or gets either a string or an Net::API::CPAN::Author object, and returns either a scalar object or an Net::API::CPAN::Author object, or undef if nothing was set.

authorized

$obj->authorized(1);
my $bool = $obj->authorized;

Sets or gets a boolean value, and returns a boolean object or undef if no value is set.

binary

$obj->binary(1);
my $bool = $obj->binary;

Sets or gets a boolean value, and returns a boolean object or undef if no value is set.

category

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

date

$obj->date( "2023-07-29T05:10:12" );
my $datetime_obj = $obj->date;

Sets or gets a datetime value, and returns a DateTime object that stringifies to the format that was provided with the string set (usally an ISO 8601 datetime format) or undef if no value is set.

deprecated

$obj->deprecated(1);
my $bool = $obj->deprecated;

Sets or gets a boolean value, and returns a boolean object or undef if no value is set.

description

$obj->description( "Folklore::Japan is a totally fictious perl 5 module designed to serve as an example for the MetaCPAN API." );
my $string = $obj->description;

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

dir

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

directory

$obj->directory(1);
my $bool = $obj->directory;

Sets or gets a boolean value, and returns a boolean object or undef if no value is set.

dist_fav_count

$obj->dist_fav_count(1);
my $number = $obj->dist_fav_count;

Sets or gets an integer value, and returns a number object or undef if no value is set.

distribution

$obj->distribution( "Folklore::Japan" );
my $string = $obj->distribution;

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

documentation

$obj->documentation( "Folklore::Japan" );
my $string = $obj->documentation;

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

download_url

my $uri = $obj->download_url;

Sets or gets an URI, and returns an URI object or undef if no value is set.

id

$obj->id( "l0tsOf1192fuN100" );
my $string = $obj->id;

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

indexed

$obj->indexed(1);
my $bool = $obj->indexed;

Sets or gets a boolean value, and returns a boolean object or undef if no value is set.

level

$obj->level(1);
my $number = $obj->level;

Sets or gets an integer value, and returns a number object or undef if no value is set.

maturity

$obj->maturity( "released" );
my $string = $obj->maturity;

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

mime

$obj->mime( "text/x-script.perl-module" );
my $string = $obj->mime;

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

module

$obj->module( [
{
associated_pod => "MOMOTARO/Folklore-Japan-v1.2.3/lib/Folklore/Japan.pm",
authorized => \1,
indexed => $VAR1->[0]{authorized},
name => "Folklore::Japan",
version => "v1.2.3",
version_numified => "1.002003",
},
] );
my $array = $obj->module;
foreach my $this ( @$array )
{
$this->associated_pod( "MOMOTARO/Folklore-Japan-v1.2.3/lib/Folklore/Japan.pm" );
my $scalar = $this->associated_pod;
$this->authorized( \1 );
my $boolean = $this->authorized;
$this->indexed( \1 );
my $boolean = $this->indexed;
$this->name( "Folklore::Japan" );
my $scalar = $this->name;
$this->version( "v1.2.3" );
my $scalar = $this->version;
$this->version_numified( 1.002003 );
my $number = $this->version_numified;
}

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

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

  • associated_pod scalar_as_object

  • authorized boolean (boolean object)

  • indexed boolean (boolean object)

  • name scalar_as_object

  • version scalar_as_object

  • version_numified number

name

$obj->name( "Japan.pm" );
my $string = $obj->name;

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 file

path

$obj->path( "lib/Folklore/Japan.pm" );
my $string = $obj->path;

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

pod

$obj->pod( "NAME Folklore::Japan - Japan Folklore Object Class VERSION version v1.2.3 SYNOPSIS use Folklore::Japan; my \$fun = Folklore::Japan->new; DESCRIPTION This is an imaginary class object to Japan folklore to only serve as dummy example AUTHOR Momo Taro <momo.taro\@example.jp> COPYRIGHT AND LICENSE This software is copyright (c) 2023 by Okayama, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself." );
my $string = $obj->pod;

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

pod_lines

$obj->pod_lines( [
[
1192,
1868,
],
] );
my $array = $obj->pod_lines;

Sets or gets an array of pod_lines and returns an array object, even if there is no value.

release

$obj->release( "Folklore-Japan-v1.2.3" );
# Returns a scalar object when this is a string, or an Net::API::CPAN::Release object
my $release = $obj->release;

Sets or gets either a string or an Net::API::CPAN::Release object, and returns either a scalar object or an Net::API::CPAN::Release object, or undef if nothing was set.

sloc

$obj->sloc(202);
my $number = $obj->sloc;

Sets or gets an integer value, and returns a number object or undef if no value is set.

slop

$obj->slop(637);
my $number = $obj->slop;

Sets or gets an integer value, and returns a number object or undef if no value is set.

stat

$obj->stat( {
gid => 12345,
mode => 33188,
mtime => 1690618397,
size => 10240,
uid => 16790,
} );
my $this = $obj->stat;
$obj->stat->gid( 12345 );
my $integer = $obj->stat->gid;
$obj->stat->mode( 33188 );
my $integer = $obj->stat->mode;
$obj->stat->mtime( 1690618397 );
my $datetime = $obj->stat->mtime;
$obj->stat->size( 10240 );
my $integer = $obj->stat->size;
$obj->stat->uid( 16790 );
my $integer = $obj->stat->uid;

Sets or gets a dynamic class object with class name Net::API::CPAN::File::Stat and having the folowing properties also accessible as methods, and returns an object from such class, or undef if no value was provided.

status

$obj->status( "latest" );
my $string = $obj->status;

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

suggest

$obj->suggest( {
input => [
"Folklore::Japan",
],
payload => {
doc_name => "Folklore::Japan",
},
weight => 985,
} );
my $this = $obj->suggest;
$obj->suggest->input( [
"Folklore::Japan",
] );
my $array = $obj->suggest->input;
$obj->suggest->payload( {
doc_name => "Folklore::Japan",
} );
my $hash = $obj->suggest->payload;
$obj->suggest->weight( 985 );
my $integer = $obj->suggest->weight;

Sets or gets a dynamic class object with class name Net::API::CPAN::File::Suggest and having the folowing properties also accessible as methods, and returns an object from such class, or undef if no value was provided.

version

$obj->version( "v1.2.3" );
my $version = $obj->version;

Sets or gets a version value and returns a version object using Changes::Version.

version_numified

$obj->version_numified("1.002003");
my $number = $obj->version_numified;

Sets or gets a float value, and returns a number object or undef if no value is set.

API SAMPLE

{
"abstract" : "Japan Folklore Object Class",
"author" : "MOMOTARO",
"authorized" : true,
"binary" : false,
"date" : "2023-07-29T05:10:12",
"deprecated" : false,
"description" : "Folklore::Japan is a totally fictious perl 5 module designed to serve as an example for the MetaCPAN API.",
"directory" : false,
"dist_fav_count" : 1,
"distribution" : "Folklore::Japan",
"documentation" : "Folklore::Japan",
"id" : "l0tsOf1192fuN100",
"indexed" : true,
"level" : 1,
"maturity" : "released",
"mime" : "text/x-script.perl-module",
"module" : [
{
"associated_pod" : "MOMOTARO/Folklore-Japan-v1.2.3/lib/Folklore/Japan.pm",
"authorized" : true,
"indexed" : true,
"name" : "Folklore::Japan",
"version" : "v1.2.3",
"version_numified" : 1.002003
}
],
"name" : "Japan.pm",
"path" : "lib/Folklore/Japan.pm",
"pod" : "NAME Folklore::Japan - Japan Folklore Object Class VERSION version v1.2.3 SYNOPSIS use Folklore::Japan; my $fun = Folklore::Japan->new; DESCRIPTION This is an imaginary class object to Japan folklore to only serve as dummy example AUTHOR Momo Taro <momo.taro@example.jp> COPYRIGHT AND LICENSE This software is copyright (c) 2023 by Okayama, Inc.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.",
"pod_lines" : [
[
1192,
1868
]
],
"release" : "Folklore-Japan-v1.2.3",
"sloc" : 202,
"slop" : 637,
"stat" : {
"gid" : 12345,
"mode" : 33188,
"mtime" : 1690618397,
"size" : 10240,
"uid" : 16790
},
"status" : "latest",
"suggest" : {
"weight" : 985,
"payload" : {
"doc_name" : "Folklore::Japan"
},
"input" : [
"Folklore::Japan"
]
},
"version" : "v1.2.3",
"version_numified" : 1.002003
}

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.