1package Pod::WSDL::Attr;
2use strict;
3use warnings;
4use Pod::WSDL::AUTOLOAD;
5
6our $VERSION = "0.05";
7our @ISA = qw/Pod::WSDL::AUTOLOAD/;
8
9our %FORBIDDEN_METHODS = (
10	name      => {get => 1, set =>  0},
11	type      => {get => 1, set =>  0},
12	nillable  => {get => 1, set =>  0},
13	descr     => {get => 1, set =>  0},
14	array     => {get => 1, set =>  0},
15);
16
17sub new {
18	my ($pkg, $str) = @_;
19
20	defined $str or $str = ''; # avoids warnings
21	$str =~ s/\s*_ATTR\s*//i or die "Input string '$str' does not begin with '_ATTR'";
22	my ($name, $type, $needed, $descr) = split /\s+/, $str, 4;
23
24	$descr ||= '';
25
26	if ((uc $needed) ne '_NEEDED') {
27		$descr  = "$needed $descr";
28		$needed = 0;
29	} else {
30		$needed = 1;
31	}
32
33	$type =~ /([\$\@])(.*)/;
34	die "Type '$type' must be prefixed with either '\$' or '\@', died" unless $1;
35
36	bless {
37		_name     => $name,
38		_type     => $2,
39		_nillable => $needed ? undef : 'true',
40		_descr    => $descr,
41		_array    => $1 eq '@' ? 1 : 0,
42	}, $pkg;
43}
44
451;
46__END__
47
48=head1 NAME
49
50Pod::WSDL::Attr - Represents the WSDL pod for an attribute of a class (internal use only)
51
52=head1 SYNOPSIS
53
54  use Pod::WSDL::Attr;
55  my $attr = new Pod::WSDL::Attr('_ATTR $string _NEEDED This attribute is for blah ...');
56
57=head1 DESCRIPTION
58
59This module is used internally by Pod::WSDL. It is unlikely that you have to interact directly with it. If that is the case, take a look at the code, it is rather simple.
60
61=head1 METHODS
62
63=head2 new
64
65Instantiates a new Pod::WSDL::Attr. The method needs one parameter, the attribute string from the pod. Please see SYNOPSIS or the section "Pod Syntax" in the description of Pod::WSDL.
66
67=head1 EXTERNAL DEPENDENCIES
68
69  [none]
70
71=head1 EXAMPLES
72
73see Pod::WSDL
74
75=head1 BUGS
76
77see Pod::WSDL
78
79=head1 TODO
80
81see Pod::WSDL
82
83=head1 SEE ALSO
84
85  Pod::WSDL
86
87=head1 AUTHOR
88
89Tarek Ahmed, E<lt>bloerch -the character every email address contains- oelbsk.orgE<gt>
90
91=head1 COPYRIGHT AND LICENSE
92
93Copyright (C) 2006 by Tarek Ahmed
94
95This library is free software; you can redistribute it and/or modify
96it under the same terms as Perl itself, either Perl version 5.8.5 or,
97at your option, any later version of Perl 5 you may have available.
98
99=cut
100