CPAN::...er::API(3pm)
π NAME π
okay so bestie, this is CPAN::Reporter::API β it's giving "Programmer's interface to CPAN::Reporter" π«Ά like, the backstage pass to the whole thing.
πΈ VERSION πΈ
version 1.2020 β¨ (yes queen, we're on that version)
π FUNCTIONS π
so here's the tea, CPAN::Reporter only hands out a few public functions for use inside CPAN.pm. they are not imported during "use" β like, they don't just show up uninvited π€. and fr fr, ordinary users will never need them. this is strictly for the devs in the group chat.
π
configure()
CPAN::Reporter::configure();
this one prompts the user to edit the configuration settings stored in the CPAN::Reporter config.ini file πΈ. it will create that config file if it doesn't already exist β very "i made it myself, you're welcome" energy. it gets automatically called by CPAN.pm when initializing the 'test_report' option, like:
cpan> o conf init test_report
π record_command()
($output, $exit_value) = CPAN::Reporter::record_command( $cmd, $secs );
takes a command to be executed via system(), but wraps and tees it to show the output to the console, capture the output, and capture the exit code π₯. returns an array reference of output lines (merged STDOUT and STDERR) and the return value from system().
β οΈ okay important: this return value is$?, so the actual exit value of the command will need to be extracted as described inperlvar. don't forget bestie π
a few things to know:
- If the command matches
/\b(?:Makefile|Build)\.PL\b/, thenDevel::Autoflushis added to"PERL5OPT"to force autoflushing of user prompts π¦. - If the command includes a pipe character (
'|'), only the part of the command prior to the pipe will be wrapped and teed. The pipe will be applied to the execution of the wrapper script. This is essential to capture the exit value of the command and should be otherwise transparent β¨. - If a non-zero
$secsargument is provided, the command will be run with a timeout of$secs(seconds) if the appropriate process management modules are available. On Win32,Win32::Jobmust be available; on Unix,Proc::Killfammust be available. Otherwise, code will fall-back to running without a timeout π. - Also, on Win32, the first space-separated element of the command must be absolute, or else
".exe"will be appended and thePATHsearched for a matching command π. - If the attempt to record fails, a warning will be issued and one or more of
$outputor$exit_valuewill be undefined π.
β grade_make()
CPAN::Reporter::grade_make( $dist, $command, \@output, $exit);
given a CPAN::Distribution object, the system command used to build the distribution (e.g. "make", "perl Build"), an array of lines of output from the command and the exit value from the command, grade_make() determines a grade for this stage of distribution installation πΈ.
If the grade is "pass", grade_make() does not send a CPAN Testers report for this stage and returns true to signal that the build was successful π. Otherwise, a CPAN Testers report is sent and grade_make() returns false π.
π¦ grade_PL()
CPAN::Reporter::grade_PL( $dist, $command, \@output, $exit);
given a CPAN::Distribution object, the system command used to run Makefile.PL or Build.PL (e.g. "perl Makefile.PL"), an array of lines of output from the command and the exit value from the command, grade_PL() determines a grade for this stage of distribution installation β¨.
If the grade is "pass", grade_PL() does not send a CPAN Testers report for this stage and returns true to signal that the Makefile.PL or Build.PL ran successfully π. Otherwise, a CPAN Testers report is sent and grade_PL() returns false π.
π grade_test()
CPAN::Reporter::grade_test( $dist, $command, \@output, $exit);
given a CPAN::Distribution object, the system command used to run tests (e.g. "make test"), an array of lines of output from testing and the exit value from the system command, grade_test() determines a grade for distribution tests π.
A CPAN Testers report is then sent unless specified prerequisites were not satisfied, in which case the report is discarded ποΈ. This function returns true if the grade is "pass" or "unknown" and returns false, otherwise π
π₯ test() β DEPRECATED
CPAN::Reporter::test( $cpan_dist, $system_command );
π¨ bestie this one is DEPRECATED. it's still here, but like... it's giving legacy.
this function is maintained for backwards compatibility π«Ά. It effectively wraps the functionality of record_command() and grade_test() into a single function call. It takes a CPAN::Distribution object and the system command to run distribution tests π.
π SEE ALSO π
CPAN::ReporterCPAN::Reporter::ConfigCPAN::Reporter::FAQ
π AUTHOR π
David Golden <dagolden@cpan.org> π
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2023 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
and that's the whole page bestie, no cap π
this was CPAN::Reporter::API(3pm) from the User Contributed Perl Documentation, running under perl v5.40.0 and dated 2024-08-17 β slay, you read the whole thing, i'm so proud of you π«Άβ¨π
π¦ where this page comes from
- ubuntu resolute: libcpan-reporter-perl 1.2020-1 Β· Apache-2.0
- ubuntu stonking: libcpan-reporter-perl 1.2020-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms