CellFunc-File-stat_row

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

{
   "abstract" : "Take input value as filename, generate a row from stat()",
   "author" : [
      "perlancar <perlancar@cpan.org>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "Dist::Zilla version 6.032, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",

META.yml  view on Meta::CPAN

---
abstract: 'Take input value as filename, generate a row from stat()'
author:
  - 'perlancar <perlancar@cpan.org>'
build_requires:
  File::Spec: '0'
  IO::Handle: '0'
  IPC::Open3: '0'
  Test::More: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0

Makefile.PL  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.032.
use strict;
use warnings;



use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Take input value as filename, generate a row from stat()",
  "AUTHOR" => "perlancar <perlancar\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "CellFunc-File-stat_row",
  "LICENSE" => "perl",
  "NAME" => "CellFunc::File::stat_row",
  "PREREQ_PM" => {
    "Log::ger" => "0.038",
    "strict" => 0,

README  view on Meta::CPAN

NAME
    CellFunc::File::stat_row - Take input value as filename, generate a row
    from stat()

VERSION
    This document describes version 0.001 of CellFunc::File::stat_row (from
    Perl distribution CellFunc-File-stat_row), released on 2024-12-10.

FUNCTIONS
  func
    Usage:

     func(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Take input value as filename, generate a row from stat().

    When file does not exist or cannot be stat()'d, will emit a warning and
    return an undefined value instead of a row.

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   follow_symlink => *bool* (default: 1)

        If set to false, will do an lstat() instead of stat().

    *   value* => *filename*

        (No description)

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something

lib/CellFunc/File/stat_row.pm  view on Meta::CPAN

    "number", # 12 "blocks",
);

our $resmeta = {
    'table.fields' => \@st_fields,
    'table.field_formats' => \@st_field_formats,
};

$SPEC{func} = {
    v => 1.1,
    summary => 'Take input value as filename, generate a row from stat()',
    description => <<'MARKDOWN',

When file does not exist or cannot be `stat()`'d, will emit a warning and return
an undefined value instead of a row.

MARKDOWN
    args => {
        value => {
            schema => 'filename*',
            req => 1,
            pos => 0,
        },
        follow_symlink => {
            schema => 'bool*',
            default => 1,
            description => <<'MARKDOWN',

If set to false, will do an `lstat()` instead of `stat()`.

MARKDOWN
        },
    },
};
sub func {
    my %args = @_;

    my @st = ($args{follow_symlink} // 1) ?  stat($args{value}) : lstat($args{value});
    unless (@st) {
        log_warn "Can't stat/lstat(%s): %s", $args{value}, $!;
        return [200, "OK"];
    }
    [200, "OK", \@st, $resmeta];
}

1;
# ABSTRACT: Take input value as filename, generate a row from stat()

__END__

=pod

=encoding UTF-8

=head1 NAME

CellFunc::File::stat_row - Take input value as filename, generate a row from stat()

=head1 VERSION

This document describes version 0.001 of CellFunc::File::stat_row (from Perl distribution CellFunc-File-stat_row), released on 2024-12-10.

=head1 FUNCTIONS


=head2 func

Usage:

 func(%args) -> [$status_code, $reason, $payload, \%result_meta]

Take input value as filename, generate a row from stat().

When file does not exist or cannot be C<stat()>'d, will emit a warning and return
an undefined value instead of a row.

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

=item * B<follow_symlink> => I<bool> (default: 1)

If set to false, will do an C<lstat()> instead of C<stat()>.

=item * B<value>* => I<filename>

(No description)


=back

Returns an enveloped result (an array).



( run in 1.625 second using v1.01-cache-2.11-cpan-49f99fa48dc )