CPAN::Testers::Common::Utils - Utility functions for CPAN Testers modules


CPAN-Testers-Common-Utils documentation  | view source Contained in the CPAN-Testers-Common-Utils distribution.

Index


NAME

Top

CPAN::Testers::Common::Utils - Utility functions for CPAN Testers modules

VERSION

Top

version 0.002

SYNOPSIS

Top

     use CPAN::Testers::Common::Utils ':all';

     # NNTP ID <=> GUID mapping
     $guid    = nntp_to_guid( $nntp_id );
     $nntp_id = guid_to_nntp( $guid    );

DESCRIPTION

Top

This module contains common utility functions for use by other CPAN Testers modules

USAGE

Top

Mapping NNTP IDs to GUIDs

Legacy CPAN Testers reports were sent via email and made available via an NNTP group, C<perl.cpan.testers>. Reports were 'indexed' by their NNTP ID. The next generation of CPAN Testers uses a GUID URN to identify reports.

Old reports with an NNTP ID are mapped to GUIDs by replacing the first 8 hex characters of a common 'base GUID' with a zero-padded decimal representation of the NNTP ID.

   XXXXXXXX-b19f-3f77-b713-d32bba55d77f

Such GUID URNs are visually distinctive and have the nice feature of sorting earlier than second-generated report GUIDs based on a timestamp.

Two translation functions are provided for convenience.

nntp_to_guid

     $guid    = nntp_to_guid( $nntp_id );

Given a numeric NNTP ID, returns a standard string-form GUID. (No range checking is done.) Examples:

   nntp_to_guid( 51432   );  # 00051432-b19f-3f77-b713-d32bba55d77f
   nntp_to_guid( 6171265 );  # 06171265-b19f-3f77-b713-d32bba55d77f

guid_to_nntp

     $guid    = nntp_to_guid( $nntp_id );

Given a GUID string of the form described above, returns the decimal number in the first 8 characaters. Examples:

   guid_to_nntp( '00051432-b19f-3f77-b713-d32bba55d77f' ); # 51432
   guid_to_nntp( '06171265-b19f-3f77-b713-d32bba55d77f' ); # 6171265

If the GUID string is not derived from the base GUID, this function returns undef.

BUGS

Top

Please report any bugs or feature requests using the CPAN Request Tracker web interface at http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Testers-Common-Utils

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

Top

AUTHOR

Top

  David A Golden <dagolden@cpan>

COPYRIGHT AND LICENSE

Top


CPAN-Testers-Common-Utils documentation  | view source Contained in the CPAN-Testers-Common-Utils distribution.