home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / lib / perl5 / Net / DBus / Binding / Value.pm < prev    next >
Encoding:
Perl POD Document  |  2006-02-19  |  2.5 KB  |  118 lines

  1. # -*- perl -*-
  2. #
  3. # Copyright (C) 2004-2005 Daniel P. Berrange
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. #
  19. # $Id: Value.pm,v 1.7 2006/01/27 15:34:24 dan Exp $
  20.  
  21. =pod
  22.  
  23. =head1 NAME
  24.  
  25. Net::DBus::Binding::Value - Strongly typed data value
  26.  
  27. =head1 SYNOPSIS
  28.  
  29.   # Import the convenience functions
  30.   use Net::DBus qw(:typing);
  31.  
  32.   # Call a method with passing an int32
  33.   $object->doit(dint32("3"));
  34.  
  35. =head1 DESCRIPTION
  36.  
  37. This module provides a simple wrapper around a raw Perl value,
  38. associating an explicit DBus type with the value. This is used
  39. in cases where a client is communicating with a server which does
  40. not provide introspection data, but for which the basic data types
  41. are not sufficient. This class should not be used directly, rather
  42. the convenience functions in L<Net::DBus> be called.
  43.  
  44. =head1 METHODS
  45.  
  46. =over 4
  47.  
  48. =cut
  49.  
  50. package Net::DBus::Binding::Value;
  51.  
  52. use strict;
  53. use warnings;
  54.  
  55. =item my $value = Net::DBus::Binding::Value->new($type, $value);
  56.  
  57. Creates a wrapper for the perl value C<$value> marking it as having
  58. the dbus data type C<$type>. It is not neccessary to call this method
  59. directly, instead the data typing methods in the L<Net::DBus> object
  60. should be used.
  61.  
  62. =cut
  63.  
  64. sub new {
  65.     my $class = shift;
  66.     my $self = [];
  67.     
  68.     $self->[0] = shift;
  69.     $self->[1] = shift;
  70.     
  71.     bless $self, $class;
  72.  
  73.     return $self;
  74. }
  75.  
  76. =item my $raw = $value->value
  77.  
  78. Returns the raw perl value wrapped by this object
  79.  
  80. =cut
  81.  
  82. sub value {
  83.     my $self = shift;
  84.     return $self->[1];
  85. }
  86.  
  87. =item my $type = $value->type
  88.  
  89. Returns the dbus data type this value is marked
  90. as having
  91.  
  92. =cut
  93.  
  94. sub type {
  95.     my $self = shift;
  96.     return $self->[0];
  97. }
  98.  
  99. 1;
  100.  
  101. =pod
  102.  
  103. =back
  104.  
  105. =head1 SEE ALSO
  106.  
  107. L<Net::DBus>, L<Net::DBus::Binding::Introspector>, L<Net::DBus::Binding::Iterator>
  108.  
  109. =head1 AUTHOR
  110.  
  111. Daniel Berrange E<lt>dan@berrange.comE<gt>
  112.  
  113. =head1 COPYRIGHT AND LICENSE
  114.  
  115. Copyright 2004-2005 by Daniel Berrange
  116.  
  117. =cut
  118.