| 1 | #!/usr/bin/perl -w | ||||||||||
| 2 | # | ||||||||||
| 3 | # GDA.pm | ||||||||||
| 4 | # | ||||||||||
| 5 | # $Revision: 1.3 $ | ||||||||||
| 6 | # | ||||||||||
| 7 | # TODO: | ||||||||||
| 8 | # | ||||||||||
| 9 | # * Don't hardcode the app name, etc. in init(). | ||||||||||
| 10 | # | ||||||||||
| 11 | # Copyright (C) 2001 Gregor N. Purdy. All rights reserved. | ||||||||||
| 12 | # | ||||||||||
| 13 | # This program is free software. It may be modified and/or | ||||||||||
| 14 | # distributed under the same terms as Perl itself. | ||||||||||
| 15 | # | ||||||||||
| 16 | |||||||||||
| 17 | 5 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | package GDA; | ||||||||||
| 20 | |||||||||||
| 21 | 5 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | |||||||||||
| 23 | 5 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | $VERSION = '0.2'; | ||||||||||
| 25 | |||||||||||
| 26 | 5 | ▶ | use Inline 'C'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | 5 | ▶ | use Inline 'C' => Config => | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 29 | INC => '-I/usr/include/gda -I/usr/include/glib-1.2 -I/usr/lib/glib/include -I/usr/include/gtk-1.2 -I/usr/include/gnome-xml', | ||||||||||
| 30 | AUTO_INCLUDE => '#include "gda-config.h"', | ||||||||||
| 31 | 5 | LIBS => '-lgda-common'; | |||||||||
| 32 | |||||||||||
| 33 | Inline->init; | ||||||||||
| 34 | |||||||||||
| 35 | my $imported = 0; | ||||||||||
| 36 | |||||||||||
| 37 | sub import | ||||||||||
| 38 | 0 | ▶ | { | ||||||||
|
Subroutine
import: not called CC=7 SCAR=40.3
| |||||||||||
| 39 | 0 | my $package = shift; | |||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | return if $imported; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | |||||||||||
| 43 | croak "GDA.pm: usage: use GDA <app>, <ver>, ...;\n" | ||||||||||
| 44 | 0 | ▶ | . " Caller did: use GDA " . join(', ', map { "'$_'" } @_) . ";\n" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | . " (If this message is for a GDA::* module, perhaps you forgot to\n" | ||||||||||
| 46 | . " 'use GDA ...' in your main program?)" unless @_ >= 2; | ||||||||||
| 47 | |||||||||||
| 48 | 0 | my $app = shift; | |||||||||
| 49 | 0 | my $ver = shift; | |||||||||
| 50 | |||||||||||
| 51 | 0 | my $prog; | |||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | if (@_) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | $prog = shift; | |||||||||
| 55 | } else { | ||||||||||
| 56 | 0 | $prog = $0; | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | # TODO: Why were we getting undefs in the first place ('under make test')? | ||||||||||
| 60 | |||||||||||
| 61 | 0 | ▶ | $app = '<undef>' if not defined $app; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 0 | ▶ | $ver = '<undef>' if not defined $ver; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | ▶ | $prog = '<undef>' if not defined $prog; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | |||||||||||
| 65 | 0 | init($app, $ver, $prog); | |||||||||
| 66 | 0 | $imported++; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | sub imported | ||||||||||
| 70 | 0 | ▶ | { | ||||||||
|
Subroutine
imported: not called CC=1 SCAR=6.9
| |||||||||||
| 71 | 0 | return $imported; | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | 1; | ||||||||||
| 75 | |||||||||||
| 76 | =head1 NAME | ||||||||||
| 77 | |||||||||||
| 78 | GDA - GNU Data Access library Perl bindings | ||||||||||
| 79 | |||||||||||
| 80 | =head1 SYNOPSIS | ||||||||||
| 81 | |||||||||||
| 82 | use GDA 'my_app', 'my_version', 'my_progname'; | ||||||||||
| 83 | |||||||||||
| 84 | Initializes the underlying C<libgda> library. | ||||||||||
| 85 | |||||||||||
| 86 | See the other B<GDA::*> modules for the real functionality. | ||||||||||
| 87 | |||||||||||
| 88 | =head1 DESCRIPTION | ||||||||||
| 89 | |||||||||||
| 90 | A suite of Perl modules which wrap the C<libgda> library's API. | ||||||||||
| 91 | |||||||||||
| 92 | You must | ||||||||||
| 93 | |||||||||||
| 94 | use GDA ...; | ||||||||||
| 95 | |||||||||||
| 96 | before using any of the other B<GDA> modules. If you don't, you'll get | ||||||||||
| 97 | complaints from the B<GDA> module (at best), or crashes and core dumps | ||||||||||
| 98 | (at worst). | ||||||||||
| 99 | |||||||||||
| 100 | =head1 SEE ALSO | ||||||||||
| 101 | |||||||||||
| 102 | B<GDA::Config>, B<GDA::DSN>, B<GDA::Log> and B<GDA::Provider>. | ||||||||||
| 103 | |||||||||||
| 104 | =head1 AUTHOR | ||||||||||
| 105 | |||||||||||
| 106 | Gregor N. Purdy E<lt>gregor@focusresearch.comE<gt> | ||||||||||
| 107 | |||||||||||
| 108 | =head1 LICENSE | ||||||||||
| 109 | |||||||||||
| 110 | This program is free software. It may be modified and/or | ||||||||||
| 111 | distributed under the same terms as Perl itself. | ||||||||||
| 112 | |||||||||||
| 113 | =head1 COPYRIGHT | ||||||||||
| 114 | |||||||||||
| 115 | Copyright (C) 2001 Gregor N. Purdy. All rights reserved. | ||||||||||
| 116 | |||||||||||
| 117 | =cut | ||||||||||
| 118 | |||||||||||
| 119 | __DATA__ | ||||||||||