Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / blib / script / wxperl_overload
1 #!/usr/bin/perl -w
2
3 eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
4     if 0; # not running under some shell
5 #############################################################################
6 ## Name:        script/wxperl_overload
7 ## Purpose:     builds overload constants
8 ## Author:      Mattia Barbon
9 ## Modified by:
10 ## Created:     17/08/2001
11 ## RCS-ID:      $Id: wxperl_overload 2335 2008-01-21 22:58:59Z mbarbon $
12 ## Copyright:   (c) 2001-2003, 2005-2008 Mattia Barbon
13 ## Licence:     This program is free software; you can redistribute it and/or
14 ##              modify it under the same terms as Perl itself
15 #############################################################################
16
17 use FindBin;
18
19 use strict;
20 use lib "$FindBin::RealBin/../build";
21
22 =head1 NAME
23
24 wxperl_overload - create overload declarations for wxPerl extensions
25
26 =head1 SYNOPSIS
27
28     # usually invoked from Makefile
29     wxperl_overload <.cpp file> <.h file> files...
30
31     wxperl_overload <.cpp file> <.h file> file.lst
32
33 =head1 DOCUMENTATION
34
35 This script if usually invoked from an
36 C<ExtUtils::MakeMaker>-generated file by using C<WX_OVERLOAD> in
37 F<Makefile.PL>.
38
39 Scans the files given on the command line or listed in the F<.lst>
40 file searching for wxPerl overload declarations.  Writes a F<.h> file
41 with matching F<.cpp> file containing the definition for wxPerl
42 overload constants.
43
44 =cut
45
46 use Wx::Overload::Driver;
47
48 my( $ovlc, $ovlh ) = ( shift, shift );
49
50 if( $ARGV[0] && $ARGV[0] =~ /\.lst$/ ) { # lame hack to read list from file
51     open my $fh, "<", $ARGV[0] or die "$!";
52     @ARGV = map { chomp; $_ } <$fh>;
53 }
54
55 my $driver = Wx::Overload::Driver->new
56   ( files  => \@ARGV,
57     header => $ovlh,
58     source => $ovlc,
59     );
60 $driver->process;
61
62 exit 0;