[FFmpeg-devel] [PATCH] doc/t2h: Support texinfo 7.0

Frank Plowman post at frankplowman.com
Mon Nov 6 19:31:24 EET 2023


On 05/11/2023 21:01, Stefano Sabatini wrote:

>> @@ -159,7 +192,18 @@ sub ffmpeg_begin_file($$$)
>>       my ($title, $description, $encoding, $date, $css_lines,
>>           $doctype, $bodytext, $copying_comment, $after_body_open,
>>           $extra_head, $program_and_version, $program_homepage,
>> -        $program, $generator) = $self->_file_header_informations($command);
>> +        $program, $generator);
>> +    if ($program_version_num >= 7.000000) {
>> +        ($title, $description, $encoding, $date, $css_lines,
>> +         $doctype, $bodytext, $copying_comment, $after_body_open,
>> +         $extra_head, $program_and_version, $program_homepage,
>> +         $program, $generator) = $self->_file_header_information($command);
>> +    } else {
>> +        ($title, $description, $encoding, $date, $css_lines,
>> +         $doctype, $bodytext, $copying_comment, $after_body_open,
>> +         $extra_head, $program_and_version, $program_homepage,
>> +         $program, $generator) = $self->_file_header_informations($command);
>> +    }
> nit: maybe can be refactored a bit to avoid the duplication (but my
> perl is rusty and I cannot test with texinfo 7.0):
>
> my $get_header_information_fn = $program_version_num >= 7.000000 ? $self->_file_header_information : $self->_file_header_informations;
> my (...) = $get_header_information_fn($command);
>
> [...]

I've just had a little fiddle to try get this working, and unfortunately 
it looks like while you can create references to normal subroutines, you 
can't easily bind to object methods in Perl. There are some workarounds 
(see 
https://stackoverflow.com/questions/47077879/perl-pass-object-method-reference-as-parameter-to-function), 
but imo they are less readable.

This is the first Perl I've ever written so if any wizards out there 
know a better way please let me know and I'd be happy to put together a v2.

> Looks good otherwise, thanks.
> _______________________________________________
>
Cheers,
Frank

-- 
https://www.frankplowman.com/


More information about the ffmpeg-devel mailing list