Author: joes
Date: Sun Feb 27 22:45:40 2005
New Revision: 155670
URL: http://svn.apache.org/viewcvs?view=rev&rev=155670
Log:
Expose APR::Request::Error as its own module
(not just a subpackage of APR::Request).
Added:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.pm
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.xs
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL
httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Cookie.pm
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/error.pm
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map
Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL?view=diff&r1=155669&r2=155670
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL (original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/Makefile.PL Sun Feb 27
22:45:40 2005
@@ -173,6 +173,11 @@
# That's the whole script - below is just a bunch of local overrides
##################################################
+sub get_functions {
+ my $self = shift;
+ $self->{XS}->{"APR::Request::Error"} ||= [];
+ $self->SUPER::get_functions;
+}
sub copy_docs {
my @lines;
Modified: httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Cookie.pm
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Cookie.pm?view=diff&r1=155669&r2=155670
==============================================================================
--- httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Cookie.pm
(original)
+++ httpd/apreq/branches/multi-env-unstable/glue/perl/lib/Apache/Cookie.pm Sun
Feb 27 22:45:40 2005
@@ -53,7 +53,7 @@
sub freeze {
my ($class, $value) = @_;
- die "Usage: Apache::Cookie->freeze($value)" unless @_ == 2;
+ die 'Usage: Apache::Cookie->freeze($value)' unless @_ == 2;
if (not ref $value) {
return encode($value);
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/error.pm
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/error.pm?view=diff&r1=155669&r2=155670
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/error.pm
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/t/response/TestAPI/error.pm
Sun Feb 27 22:45:40 2005
@@ -7,16 +7,18 @@
use Apache::TestUtil;
use APR::Request::Apache2;
+use APR::Request::Error qw/GENERAL TAINTED/;
sub handler {
my $r = shift;
- plan $r, tests => 1;
+ plan $r, tests => 3;
my $req = APR::Request::Apache2->new($r);
ok $req->isa("APR::Request");
# XXX export some constants, and test apreq_xs_strerror
-
+ ok TAINTED > GENERAL;
+ ok GENERAL eq "Internal apreq error";
return 0;
}
Added:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.pm
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.pm?view=auto&rev=155670
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.pm
(added)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.pm
Sun Feb 27 22:45:40 2005
@@ -0,0 +1,3 @@
+use APR::Error;
+our @ISA = qw/APR::Error APR::Request/;
+
Added:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.xs
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.xs?view=auto&rev=155670
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.xs
(added)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Error/Error.xs
Sun Feb 27 22:45:40 2005
@@ -0,0 +1,43 @@
+static XS(XS_APR__Request__Error_nil)
+{
+ dXSARGS;
+ (void)items;
+ XSRETURN_EMPTY;
+}
+
+MODULE = APR::Request::Error PACKAGE = APR::Request::Error
+
+SV *as_string(hv, p1=NULL, p2=NULL)
+ APR::Request::Error hv
+ SV *p1
+ SV *p2
+ PREINIT:
+ SV **svp;
+
+ CODE:
+ svp = hv_fetch(hv, "rc", 2, FALSE);
+ if (svp == NULL)
+ RETVAL = &PL_sv_undef;
+ else
+ RETVAL = apreq_xs_error2sv(aTHX_ SvIVX(*svp));
+
+ OUTPUT:
+ RETVAL
+
+BOOT:
+ /* register the overloading (type 'A') magic */
+ PL_amagic_generation++;
+ /* The magic for overload gets a GV* via gv_fetchmeth as */
+ /* mentioned above, and looks in the SV* slot of it for */
+ /* the "fallback" status. */
+ sv_setsv(
+ get_sv( "APR::Request::Error::()", TRUE ),
+ &PL_sv_undef
+ );
+ newXS("APR::Request::Error::()", XS_APR__Request__Error_nil, file);
+ newXS("APR::Request::Error::(\"\"", XS_APR__Request__Error_as_string,
file);
+
+ newCONSTSUB(PL_defstash, "APR::Request::Error::GENERAL",
+ apreq_xs_error2sv(aTHX_ APREQ_ERROR_GENERAL));
+ newCONSTSUB(PL_defstash, "APR::Request::Error::TAINTED",
+ apreq_xs_error2sv(aTHX_ APREQ_ERROR_TAINTED));
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm?view=diff&r1=155669&r2=155670
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.pm
Sun Feb 27 22:45:40 2005
@@ -1,15 +1,11 @@
-{
- package APR::Request::Error;
- require APR::Error;
- push our @ISA, qw/APR::Error APR::Request/;
-}
-
sub import {
my $class = shift;
return unless @_;
my $pkg = caller;
no strict 'refs';
+
for (@_) {
- *{"$pkg\::$_"} = *{"$class\::$_"};
+ *{"$pkg\::$_"} = $class->can($_)
+ or die "Can't find method $_ in class $class";
}
}
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs?view=diff&r1=155669&r2=155670
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/APR/Request/Request.xs
Sun Feb 27 22:45:40 2005
@@ -1,10 +1,3 @@
-static XS(XS_APR__Request__Error_nil)
-{
- dXSARGS;
- (void)items;
- XSRETURN_EMPTY;
-}
-
static XS(apreq_xs_parse)
{
dXSARGS;
@@ -180,38 +173,5 @@
OUTPUT:
RETVAL
-
-
-MODULE = APR::Request PACKAGE = APR::Request::Error
-
-SV *as_string(hv, p1=NULL, p2=NULL)
- APR::Request::Error hv
- SV *p1
- SV *p2
- PREINIT:
- SV **svp;
-
- CODE:
- svp = hv_fetch(hv, "rc", 2, FALSE);
- if (svp == NULL)
- RETVAL = &PL_sv_undef;
- else
- RETVAL = apreq_xs_strerror(aTHX_ SvIVX(*svp));
-
- OUTPUT:
- RETVAL
-
-BOOT:
- /* register the overloading (type 'A') magic */
- PL_amagic_generation++;
- /* The magic for overload gets a GV* via gv_fetchmeth as */
- /* mentioned above, and looks in the SV* slot of it for */
- /* the "fallback" status. */
- sv_setsv(
- get_sv( "APR::Request::Error::()", TRUE ),
- &PL_sv_undef
- );
- newXS("APR::Request::Error::()", XS_APR__Request__Error_nil, file);
- newXS("APR::Request::Error::(\"\"", XS_APR__Request__Error_as_string,
file);
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h?view=diff&r1=155669&r2=155670
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/apreq_xs_postperl.h
Sun Feb 27 22:45:40 2005
@@ -169,6 +169,26 @@
APR_INLINE
+static SV* apreq_xs_error2sv(pTHX_ apr_status_t s)
+{
+ char buf[256];
+ SV *sv = newSV(0);
+
+ sv_upgrade(sv, SVt_PVIV);
+
+ apreq_strerror(s, buf, sizeof buf);
+ sv_setpvn(sv, buf, strlen(buf));
+ SvPOK_on(sv);
+
+ SvIVX(sv) = s;
+ SvIOK_on(sv);
+
+ SvREADONLY_on(sv);
+
+ return sv;
+}
+
+APR_INLINE
static SV *apreq_xs_sv2object(pTHX_ SV *sv, const char *class, const char attr)
{
SV *obj;
@@ -388,13 +408,6 @@
apreq_xs_croak(aTHX_ hv, status, func, errpkg); \
} \
} while (0)
-
-static APR_INLINE
-SV *apreq_xs_strerror(pTHX_ apr_status_t s) {
- char buf[256];
- apreq_strerror(s, buf, sizeof buf);
- return newSVpv(buf, 0);
-}
static APR_INLINE
Modified:
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map
URL:
http://svn.apache.org/viewcvs/httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map?view=diff&r1=155669&r2=155670
==============================================================================
---
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map
(original)
+++
httpd/apreq/branches/multi-env-unstable/glue/perl/xsbuilder/maps/apreq_types.map
Sun Feb 27 22:45:40 2005
@@ -9,6 +9,7 @@
void * | PTR
const void * | PTR
unsigned | UV
+unsigned char | UV
#apreq_cookie_version_t | APREQ_COOKIE_VERSION
#data structure stuff