Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.4 KiB

  1. package Win32::Clipboard;
  2. #######################################################################
  3. #
  4. # Win32::Clipboard - Perl Module for Windows Clipboard Interaction
  5. # ^^^^^^^^^^^^^^^^
  6. # Version: 0.03 (23 Apr 1997)
  7. #
  8. #######################################################################
  9. require Exporter; # to export the constants to the main:: space
  10. require DynaLoader; # to dynuhlode the module.
  11. @ISA = qw( Exporter DynaLoader );
  12. #######################################################################
  13. # This AUTOLOAD is used to 'autoload' constants from the constant()
  14. # XS function. If a constant is not found then control is passed
  15. # to the AUTOLOAD in AutoLoader.
  16. #
  17. sub AUTOLOAD {
  18. my($constname);
  19. ($constname = $AUTOLOAD) =~ s/.*:://;
  20. #reset $! to zero to reset any current errors.
  21. $!=0;
  22. my $val = constant($constname, @_ ? $_[0] : 0);
  23. if ($! != 0) {
  24. # [dada] This results in an ugly Autoloader error
  25. #if ($! =~ /Invalid/) {
  26. # $AutoLoader::AUTOLOAD = $AUTOLOAD;
  27. # goto &AutoLoader::AUTOLOAD;
  28. #} else {
  29. # [dada] ... I prefer this one :)
  30. ($pack, $file, $line) = caller;
  31. undef $pack; # [dada] and get rid of "used only once" warning...
  32. die "Win32::Clipboard::$constname is not defined, used at $file line $line.";
  33. #}
  34. }
  35. eval "sub $AUTOLOAD { $val }";
  36. goto &$AUTOLOAD;
  37. }
  38. #######################################################################
  39. # STATIC OBJECT PROPERTIES
  40. #
  41. $VERSION = "0.03";
  42. #######################################################################
  43. # FUNCTIONS
  44. #
  45. sub new {
  46. my($class, $value) = @_;
  47. my $self = "I'm the Clipboard!";
  48. Win32::Clipboard::Set($value) if defined($value);
  49. return bless(\$self);
  50. }
  51. sub DESTROY {
  52. my($self) = @_;
  53. undef $self;
  54. }
  55. sub Version {
  56. return $VERSION;
  57. }
  58. #######################################################################
  59. # dynamically load in the Clipboard.pll module.
  60. #
  61. bootstrap Win32::Clipboard;
  62. # Preloaded methods go here.
  63. sub main::Win32::Clipboard {
  64. my($value) = @_;
  65. my $self={};
  66. my $result = Win32::Clipboard::Set($value) if defined($value);
  67. return bless($self, "Win32::Clipboard");
  68. }
  69. #Currently Autoloading is not implemented in Perl for win32
  70. # Autoload methods go after __END__, and are processed by the autosplit program.
  71. 1;
  72. __END__