From: Florian Ragwitz Date: Mon, 9 Feb 2009 03:51:00 +0000 (+0000) Subject: Disable deprecated get_all_packge_symbols in list context. X-Git-Tag: 0.77~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a4bb317200403742305b36bb18db254967d2a798;p=gitmo%2FClass-MOP.git Disable deprecated get_all_packge_symbols in list context. --- diff --git a/Changes b/Changes index 9e6afa9..f3aa821 100644 --- a/Changes +++ b/Changes @@ -8,6 +8,10 @@ Revision history for Perl extension Class-MOP. * Class::MOP::Class - Add get_all_method_names (Sartak) + * Class::MOP::Package + - Disable deprecated get_all_package_symbols in list context. (Florian + Ragwitz) + 0.76 Thu, January 22, 2008 * Class::MOP::Method::Generated - Added new private methods to support code generation, which diff --git a/MOP.xs b/MOP.xs index 902510b..71e2c7d 100644 --- a/MOP.xs +++ b/MOP.xs @@ -425,7 +425,6 @@ get_all_package_symbols(self, filter=TYPE_FILTER_NONE) XSRETURN_EMPTY; } - PUTBACK; if ( (he = hv_fetch_ent((HV *)SvRV(self), key_package, 0, hash_package)) ) { @@ -434,34 +433,11 @@ get_all_package_symbols(self, filter=TYPE_FILTER_NONE) if (!stash) { - switch (GIMME_V) { - case G_SCALAR: XSRETURN_UNDEF; break; - case G_ARRAY: XSRETURN_EMPTY; break; - } + XSRETURN_UNDEF; } symbols = get_all_package_symbols(stash, filter); - - switch (GIMME_V) { - case G_SCALAR: - PUSHs(sv_2mortal(newRV_inc((SV *)symbols))); - break; - case G_ARRAY: - warn("Class::MOP::Package::get_all_package_symbols in list context is deprecated. use scalar context instead."); - - EXTEND(SP, HvKEYS(symbols) * 2); - - while ((he = hv_iternext(symbols))) { - PUSHs(hv_iterkeysv(he)); - PUSHs(sv_2mortal(SvREFCNT_inc(HeVAL(he)))); - } - - break; - default: - break; - } - - SvREFCNT_dec((SV *)symbols); + PUSHs(sv_2mortal(newRV_noinc((SV *)symbols))); void name(self) diff --git a/lib/Class/MOP/Package.pm b/lib/Class/MOP/Package.pm index 2366f59..2c2c0d6 100644 --- a/lib/Class/MOP/Package.pm +++ b/lib/Class/MOP/Package.pm @@ -284,11 +284,7 @@ sub get_all_package_symbols { my $namespace = $self->namespace; - if (wantarray) { - warn 'Class::MOP::Package::get_all_package_symbols in list context is deprecated. use scalar context instead.'; - } - - return (wantarray ? %$namespace : $namespace) unless defined $type_filter; + return $namespace unless defined $type_filter; my %ret; # for some reason this nasty impl is orders of magnitude faster than a clean version @@ -316,7 +312,7 @@ sub get_all_package_symbols { } keys %$namespace; } - return wantarray ? %ret : \%ret; + return \%ret; } 1;