DOKK / manpages / debian 12 / libxmltv-perl / XMLTV::Configure::Writer.3pm.en
Configure::Writer(3pm) User Contributed Perl Documentation Configure::Writer(3pm)

XMLTV::Configure::Writer - Configuration file writer for XMLTV grabbers

Utility class that helps grabbers write configuration descriptions.

  use XMLTV::Configure::Writer;
  my $result;
  my $writer = new XMLTV::Writer::Configure( OUTPUT => \$result,
                                             encoding => 'iso-8859-1' );
  $writer->start( { grabber => 'tv_grab_xxx' } );
  $writer->write_string( {
    id => 'username',
    title => [ [ 'Username', 'en' ],
               [ 'Användarnamn', 'sv' ] ],
    description => [ [ 'The username for logging in to DataDirect.', 'en' ],
                     [ 'Användarnamn hos DataDirect', 'sv' ] ],
    } );
  $writer->start_selectone( {
    id => 'lineup',
    title => [ [ 'Lineup', 'en' ],
               [ 'Programpaket', 'sv' ] ],
    description => [ [ 'The lineup of channels for your region.', 'en' ],
                     [ 'Programpaket för din region', 'sv' ] ],
    } );
  $writer->write_option( {
    value=>'eastcoast',
    text=> => [ [ 'East Coast', 'en' ],
                [ 'Östkusten', 'sv' ] ]
  } );
  $writer->write_option( {
    value=>'westcoast',
    text=> => [ [ 'West Coast', 'en' ],
                [ 'Västkusten', 'sv' ] ]
  } );
  $writer->end_selectone();
  $writer->end();
  print $result;

None.

Write the start of the <xmltvconfiguration> element. Parameter is a hashref which gives the attributes of this element.
Write a <string> element. Parameter is a hashref with the data for the element:

  $writer->write_string( {
    id => 'username',
    title => [ [ 'Username', 'en' ],
               [ 'Användarnamn', 'sv' ] ],
    description => [ [ 'The username for logging in to DataDirect.', 'en' ],
                     [ 'Användarnamn hos DataDirect', 'sv' ] ],
    default => "",
    } );
    

To add a constant use 'constant' key: If constant value is empty then revert to 'ask' procedure.

  $writer->write_string( {
    id => 'version',
    title => [ [ 'Version number', 'en' ] ],
    description => [ [ 'Automatically added version number - no user input', 'en' ] ],
    constant => '123',
    } );
    
2023-02-24 perl v5.36.0