jfroebe has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to create a complex data type (dbS_web::Type) and am getting an odd error "No pod wsdl found for type 'integer'." I'm not sure if I'm doing something wrong or if this is a bug or what.

$ cat ./wsdl.pl

#!/usr/bin/perl use strict; use warnings; use Pod::WSDL; my $pod = new Pod::WSDL(source => "./Test.pm", location => 'http://localhost/test/soap', pretty => 1, withDocumentation => 1); print( $pod->WSDL );

$ cat Test.pm

package Test; use dbS_web::Type; =begin WSDL _IN wabbit $dbS_web::Type testing =end WSDL sub hi { my $out = "hi"; return $out; } 1;

cat dbS_web/Type.pm

package dbS_web::Type; sub new { bless { foo => 'foo', bar => -1 }, $_[0]; } =begin WSDL _ATTR foo $string A foo _ATTR bar $integer And a bar =end WSDL 1;

Output:

No pod wsdl found for type 'integer'. <?xml version="1.0" encoding="UTF-8"?> <!-- WSDL for http://localhost/test/soap created by Pod::WSDL version: 0.05 on Fri Jul 20 12:42:18 2007 --> <wsdl:definitions targetNamespace="http://localhost/Test" xmlns:impl="http://localhost/Test" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns1="http://localhost/Test"> <wsdl:types> <schema targetNamespace="http://localhost/Test" xmlns="http://www.w3.org/2001/XMLSchema"> <import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <complexType name="Integer"> <annotation> <documentation>NAME integer - Perl pragma to use integer arithmetic instead of floatin +g point SYNOPSIS use integer; $x = 10/3; # $x is now 3, not 3.33333333333333333 DESCRIPTION This tells the compiler to use integer operations from here to the end of the enclosing BLOCK. On many machines, this doesn't matter a great deal for most computations, but on those without floating point hardware, it can make a big difference in performance. Note that this only affects how most of the arithmetic and relational operators handle their operands and results, and not how all numbers everywhere are treated. Specifically, "use integer;" has the effec +t that before computing the results of the arithmetic operators (+, -, *, /, %, +=, -=, *=, /=, %=, and unary minus), the comparison operators (&lt;, &lt;=, &gt;, &gt;=, ==, !=, &lt;=&gt;), and the bitwise operators (|, &amp;, ^, &lt;&lt;, &gt;&gt;, |=, &amp;=, ^=, &lt;&lt;=, &gt;&gt;=), the operands have their fractional portions truncated (or floored), and the result will have its fractional portion truncate +d as well. In addition, the range of operands and results is restricted to that of familiar two's complement integers, i.e., -(2**31) .. (2**31-1) on 32-bit architectures, and -(2**63) .. (2**63-1) on 64-bit architectures. For example, this code use integer; $x = 5.8; $y = 2.5; $z = 2.7; $a = 2**31 - 1; # Largest positive integer on 32-bit machines $, = ", "; print $x, -$x, $x + $y, $x - $y, $x / $y, $x * $y, $y == $z, $a, $a + 1; will print: 5.8, -5, 7, 3, 2, 10, 1, 2147483647, -2147483648 Note that $x is still printed as having its true non-integer value of 5.8 since it wasn't operated on. And note too the wrap-around from the largest positive integer to the largest negative one. Also, arguments passed to functions and the values returned by them are not affected by "use integer;". E.g., srand(1.5); $, = ", "; print sin(.5), cos(.5), atan2(1,2), sqrt(2), rand(10); will give the same result with or without "use integer;" The power operator "**" is also not affected, so that 2 ** .5 is always the square root of 2. Now, it so happens that the pre- and post- increment an +d decrement operators, ++ and --, are not affected by "use integer;" either. Some may rightly consider this to be a bug -- but at least it's a long-standing one. Finally, "use integer;" also has an additional affect on the bitwise operators. Normally, the operands and results are treated as unsigned integers, but with "use integer;" the operands and results are signed. This means, among other things, that ~0 is -1, and -2 &amp; -5 is -6. Internally, native integer arithmetic (as provided by your C compiler) is used. This means that Perl's own semantics for arithmetic operations may not be preserved. One common source of trouble is the modulus of negative numbers, which Perl does one way, but your hardware may d +o another. % perl -le 'print (4 % -3)' -2 % perl -Minteger -le 'print (4 % -3)' 1 See "Pragmatic Modules" in perlmodlib, "Integer Arithmetic" in perlop</documentation> </annotation> <sequence> </sequence> </complexType> <complexType name="DbS_webType"> <annotation> <documentation> 1;</documentation> </annotation> <sequence> <element name="foo" nillable="true" type="xsd:string"> <annotation> <documentation>A foo</documentation> </annotation> </element> <element name="bar" nillable="true" type="tns1:Integer"> <annotation> <documentation>And a bar</documentation> </annotation> </element> </sequence> </complexType> </schema> </wsdl:types> <wsdl:message name="hiRequest"> <wsdl:part name="wabbit" type="tns1:DbS_webType"> <wsdl:documentation>testing</wsdl:documentation> </wsdl:part> </wsdl:message> <wsdl:message name="empty" /> <wsdl:portType name="TestHandler"> <wsdl:operation name="hi" parameterOrder="wabbit"> <wsdl:input message="impl:hiRequest" name="hiRequest" /> <wsdl:output message="impl:empty" /> </wsdl:operation> </wsdl:portType> <wsdl:binding name="TestSoapBinding" type="impl:TestHandler"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="hi"> <wsdlsoap:operation soapAction="" /> <wsdl:input name="hiRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Test" use="encoded" /> </wsdl:input> <wsdl:output name="empty"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost/Test" use="encoded" /> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="TestHandlerService"> <wsdl:port binding="impl:TestSoapBinding" name="Test"> <wsdlsoap:address location="http://localhost/test/soap" /> </wsdl:port> </wsdl:service> </wsdl:definitions>

Jason L. Froebe

Help find a cure for breast cancer! Net proceeds benefit the Susan G. Komen Breast Cancer Foundation and the National Philanthropic Trust. Help by donating - I'm walking 60 miles in 3 days in August 2007. (The day I return from TechWave is the first day of the Walk).

Blog, Tech Blog

Replies are listed 'Best First'.
Re: Bug in Pod::WSDL?
by erroneousBollock (Curate) on Jul 23, 2007 at 05:42 UTC
    try $int rather than $integer

    -David.