Commit f4ea540a authored by Torsten Schönfeld's avatar Torsten Schönfeld

Make "use Cairo x.yyy" work

This required renaming the old Cairo::VERSION, a wrapper for
CAIRO_VERSION, to Cairo::LIB_VERSION -- but we kept the old way of
calling it working.  Cairo::version, Cairo::version_string and
Cairo::VERSION_ENCODE got the same treatment for consistency.

https://rt.cpan.org/Ticket/Display.html?id=72783
parent dcf3ff70
......@@ -425,13 +425,16 @@ BOOT:
call_atexit ((ATEXIT_t) cairo_debug_reset_static_data, NULL);
#endif
int VERSION (class=NULL)
# The VERSION fallback is implemented in lib/Cairo.pm.
int LIB_VERSION (...)
CODE:
RETVAL = CAIRO_VERSION;
OUTPUT:
RETVAL
int VERSION_ENCODE (...)
int LIB_VERSION_ENCODE (...)
ALIAS:
VERSION_ENCODE = 1
PREINIT:
int major, minor, micro;
CODE:
......@@ -444,7 +447,7 @@ int VERSION_ENCODE (...)
minor = SvIV (ST (2));
micro = SvIV (ST (3));
} else {
croak ("Usage: Cairo::VERSION_ENCODE (major, minor, micro) or Cairo->VERSION_ENCODE (major, minor, micro)");
croak ("Usage: Cairo::LIB_VERSION_ENCODE (major, minor, micro) or Cairo->LIB_VERSION_ENCODE (major, minor, micro)");
}
RETVAL = CAIRO_VERSION_ENCODE (major, minor, micro);
......@@ -453,11 +456,15 @@ int VERSION_ENCODE (...)
# int cairo_version ();
int cairo_version (class=NULL)
ALIAS:
lib_version = 1
C_ARGS:
/* void */
# const char* cairo_version_string ();
const char* cairo_version_string (class=NULL)
ALIAS:
lib_version_string = 1
C_ARGS:
/* void */
......
Overview of changes in Cairo <NEXT UNSTABLE>
==================================
* Make "use Cairo x.yyy" work. This required renaming the old Cairo::VERSION,
a wrapper for CAIRO_VERSION, to Cairo::LIB_VERSION -- but we kept the old way
of calling it working. Cairo::version, Cairo::version_string and
Cairo::VERSION_ENCODE got the same treatment for consistency.
Overview of changes in Cairo 1.082
==================================
* Update the symbol export list for linking on win32
(https://bugzilla.gnome.org/show_bug.cgi?id=665265)
(https://bugzilla.gnome.org/show_bug.cgi?id=665265)
Overview of changes in Cairo 1.081
==================================
......
......@@ -20,9 +20,17 @@ sub dl_load_flags { $^O eq 'darwin' ? 0x00 : 0x01 }
Cairo->bootstrap ($VERSION);
# --------------------------------------------------------------------------- #
package Cairo;
# Our Cairo::VERSION used to be a simple wrapper around CAIRO_VERSION. But a
# package's VERSION sub is supposed to do Perl version checking so that things
# like 'use Cairo 1.00' work. To not break backwards-compatibility, we
# dispatch according to the number of arguments passed in.
sub VERSION {
if (scalar @_ == 2) {
shift->SUPER::VERSION (@_);
} else {
Cairo::LIB_VERSION (@_);
}
}
1;
......@@ -1725,13 +1733,18 @@ For hysterical reasons, you can also use the following syntax:
=over
=item $version = Cairo->version
=item $version_code = Cairo->lib_version
=item $string = Cairo->version_string
=item $version_string = Cairo->lib_version_string
=item $version_code = Cairo->VERSION
These two functions return the version of libcairo that the program is
currently running against.
=item $version_code = Cairo->VERSION_ENCODE ($major, $minor, $micro)
=item $version_code = Cairo->LIB_VERSION
Returns the version of libcairo that L<Cairo> was compiled against.
=item $version_code = Cairo->LIB_VERSION_ENCODE ($major, $minor, $micro)
=over
......@@ -1743,6 +1756,9 @@ For hysterical reasons, you can also use the following syntax:
=back
Encodes the version C<$major.$minor.$micro> as an integer suitable for
comparison against C<< Cairo->lib_version >> and C<< Cairo->LIB_VERSION >>.
=back
=cut
......
#!/usr/bin/perl
#
# Copyright (c) 2004-2005 by the cairo perl team (see the file README)
#
# Licensed under the LGPL, see LICENSE file for more information.
#
use strict;
use warnings;
use Test::More tests => 18;
BEGIN {
ok (! eval "use Cairo 2.000; 1");
ok (eval "use Cairo 1.000; 1");
}
ok(defined Cairo::LIB_VERSION);
ok(defined Cairo::LIB_VERSION_ENCODE (1, 0, 0));
ok(defined Cairo->LIB_VERSION);
ok(defined Cairo->LIB_VERSION_ENCODE (1, 0, 0));
ok(defined Cairo::lib_version);
ok(defined Cairo::lib_version_string);
ok(defined Cairo->lib_version);
ok(defined Cairo->lib_version_string);
# Deprecated names:
ok(defined Cairo::VERSION);
ok(defined Cairo::VERSION_ENCODE (1, 0, 0));
ok(defined Cairo->VERSION);
ok(defined Cairo->VERSION_ENCODE (1, 0, 0));
ok(defined Cairo::version);
ok(defined Cairo::version_string);
ok(defined Cairo->version);
ok(defined Cairo->version_string);
......@@ -10,7 +10,7 @@
use strict;
use warnings;
use Test::More tests => 75;
use Test::More tests => 70;
unless (eval 'use Test::Number::Delta; 1;') {
my $reason = 'Test::Number::Delta not available';
......@@ -20,15 +20,7 @@ unless (eval 'use Test::Number::Delta; 1;') {
use constant IMG_WIDTH => 256;
use constant IMG_HEIGHT => 256;
BEGIN {
use_ok ('Cairo');
}
ok(defined Cairo::version);
ok(defined Cairo::version_string);
ok(defined Cairo->version);
ok(defined Cairo->version_string);
use Cairo;
my $surf = Cairo::ImageSurface->create ('rgb24', IMG_WIDTH, IMG_HEIGHT);
isa_ok ($surf, 'Cairo::Surface');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment