Subversion Repositories DevTools

Rev

Rev 7300 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
#! perl
2
########################################################################
7300 dpurdie 3
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
227 dpurdie 4
#
5
# Module name   : jats.sh
6
# Module type   : Perl Package
7
# Compiler(s)   : n/a
8
# Environment(s): jats
9
#
10
# Description   : This package contains functions to create a makefile entry
11
#                 The entry may consist of the following (optional) fields
12
#
13
#                 .PHONY <targets>
14
#                 <targets> : VARAIBLE = VALUE
15
#                 <targets> : <prerequisites>
16
#                       @echo "Run time comment"
17
#                       Recipe
18
#                       ( ShellRecipe )
19
#
20
#                 The order that information is added is not important
21
#                 Recipes and prerequisites may be mixed to simplify
22
#                 programming.
23
#
4344 dpurdie 24
#                 The --Define option creates
25
#                 define <name>
26
#                   Recipe
27
#                 endef
28
#
29
#                The --Raw option creates
30
#                   Recipe
31
#
4778 dpurdie 32
#                The --Raw with --Phony option creates
33
#                   .PHONY <targets>
34
#                   <targets>:
35
#                       Recipe
4344 dpurdie 36
#
4778 dpurdie 37
#
38
#
227 dpurdie 39
#......................................................................#
40
 
255 dpurdie 41
use 5.006_001;
227 dpurdie 42
use strict;
43
use warnings;
44
 
45
package MakeEntry;
46
use JatsError;
47
use ArrayHashUtils;
48
 
49
#
50
#   Global variables
51
#
52
my $llength = 80;                           # Target line length
53
 
54
 
55
#-------------------------------------------------------------------------------
56
# Function        : New
57
#
58
# Description     : Create a new empty entry
59
#
271 dpurdie 60
# Inputs          : handle              - FILEHANDLE or variable ref
61
#                                         eg: *MAKEFILE     - print to handle
62
#                                              \$var        - print to variable
63
#
64
#                   name                - Primary target name
65
#                   options             - Preload the fields
227 dpurdie 66
#                           --Target=name,name,name
67
#                           --Comment=text
68
#                           --Prereq=name,name,name
69
#                           --Recipe=text
70
#                           --Phony
4344 dpurdie 71
#                           --Define
72
#                           --Raw
227 dpurdie 73
#                           --Print
74
#
75
# Returns         : Ref to a an object that can be manipulated
76
#
77
sub New
78
{
79
    my ($handle, $name, @args ) = @_;
80
    my $self  = {};
81
    $self->{DEPENDANCY}     = [];
82
    $self->{NAME}           = [];
83
    $self->{RECIPE}         = [];
84
    $self->{SHELL}          = [];
85
    $self->{PRINTED}        = 0;
86
    $self->{COMMENT}        = [];
7322 dpurdie 87
    $self->{DEFN}           = [];
227 dpurdie 88
    $self->{PHONY}          = 0;
4344 dpurdie 89
    $self->{DEFINE}         = 0;
90
    $self->{RAW}            = 0;
227 dpurdie 91
    $self->{FH}             = $handle;
271 dpurdie 92
    $self->{FH_inmemory}    = 0;
227 dpurdie 93
    $self->{RECIPE_PREFIX}  = '';
5708 dpurdie 94
    $self->{RECIPE_WRAPPER}  = ['(', ')'];
227 dpurdie 95
    $self->{RECIPE_COMMENT} = '';
4778 dpurdie 96
    $self->{STACK}          = [];
4781 dpurdie 97
    $self->{SDEF}           = '';
227 dpurdie 98
 
99
    push @{$self->{NAME}}, split(/,/,$name) if ( $name );
100
 
101
    bless ($self, __PACKAGE__);
102
 
103
    #
104
    #   Process any argument
105
    #
106
    my $print = 0;
107
    foreach ( @args )
108
    {
109
        if ( m/^--Target=(.*)/ ) {
110
            $self->AddName(split(/,/,$1));
111
 
112
        } elsif ( m/^--Comment=(.*)/ ) {
113
            $self->AddComment($1);
114
 
115
        } elsif ( m/^--Prereq=(.*)/ ) {
116
            $self->AddDependancy(split(/,/,$1));
117
 
118
        } elsif ( m/^--Phony/ ) {
119
            $self->Phony();
120
 
4344 dpurdie 121
        } elsif ( m/^--Define/ ) {
122
            $self->Define();
123
 
124
        } elsif ( m/^--Raw/ ) {
125
            $self->Raw();
126
 
227 dpurdie 127
        } elsif ( m/^--Recipe=(.*)/ ) {
128
            $self->AddRecipe($1);
129
 
130
        } elsif ( m/^--Print/ ) {
131
            $print = 1;
132
 
133
        } elsif ( m/^--/ ) {
134
            Error ("MakeEntry: Unknown option: $_");
135
 
136
        } else {
137
            $self->AddDependancy( $_ );
138
 
139
        }
140
    }
141
 
271 dpurdie 142
    #
143
    #   Set up the printer handle
144
    #   May be
145
    #       Empty           - use stderr
146
    #       ref to a scalar - use in memory file
147
    #       typeglob        - normal handle
148
    #
149
    if ( ref $handle eq 'SCALAR' )
150
    {
151
        $$handle = '' if ( ! defined $$handle );
152
        open(MEMORY,'>>', $handle) || Error ("Cannot open in-memory file");
153
        $self->{FH_inmemory} = $handle;
154
        $self->{FH} = \*MEMORY;
155
 
156
    } elsif ( ! $handle ) {
157
       $self->{FH} = \*STDERR;
158
    }
159
 
160
    #
161
    #   Print simple entry if required
162
    #
227 dpurdie 163
    $self->Print() if ( $print );
164
    return $self;
165
}
166
 
167
#-------------------------------------------------------------------------------
168
# Function        : AddName
169
#
4778 dpurdie 170
# Description     : Add a target name to the entry
227 dpurdie 171
#
172
# Inputs          : An array of names to add
173
#
174
# Returns         :
175
#
176
sub AddName
177
{
178
    my $self = shift;
179
    push @{$self->{NAME}}, @_
180
}
181
 
182
#-------------------------------------------------------------------------------
183
# Function        : Phony
184
#
185
# Description     : Flag the entry as a phony
186
#
187
# Inputs          :
188
#
189
# Returns         :
190
#
191
sub Phony
192
{
193
    my $self = shift;
194
    $self->{PHONY} = 1;
195
}
196
 
4344 dpurdie 197
#-------------------------------------------------------------------------------
198
# Function        : Define
199
#
200
# Description     : Flag the entry as a define, rather than a normal target
201
#                   Many of the other commands are not supported
202
#                   Only AddComment and AddRecipe
203
#
204
# Inputs          :
205
#
206
# Returns         :
207
#
208
sub Define
209
{
210
    my $self = shift;
211
    $self->{DEFINE} = 1;
212
}
227 dpurdie 213
 
214
#-------------------------------------------------------------------------------
4344 dpurdie 215
# Function        : Raw
216
#
217
# Description     : Flag the entry as raw text
218
#                   Many of the other commands are not supported
219
#                   Only AddComment and AddRecipe
220
#
221
# Inputs          :
222
#
223
# Returns         :
224
#
225
sub Raw
226
{
227
    my $self = shift;
228
    $self->{RAW} = 1;
229
}
230
 
231
#-------------------------------------------------------------------------------
227 dpurdie 232
# Function        : AddComment
233
#
234
# Description     : Add a comment to the entry
235
#
236
# Inputs          : An array of names to add
237
#
238
# Returns         :
239
#
240
sub AddComment
241
{
242
    my $self = shift;
243
    push @{$self->{COMMENT}}, @_
244
}
245
 
5991 dpurdie 246
 
227 dpurdie 247
#-------------------------------------------------------------------------------
5991 dpurdie 248
# Function        : QuoteDependency
249
#
250
# Description     : Escape/Quote a pathname for make
251
#                       Allow files with a $ in the name
252
#                       Allow files with a space in the name
253
#                       Allow files with a comma in the name
254
#                       Allow files with a colon in the name
255
#                       Allow for paths that have make-varible prefixes
7322 dpurdie 256
#                           $(GBE_...) or ${GBE_...} or $(OBJDIR) or $(BUILDVERNUM)
5991 dpurdie 257
#                           as these may be generated internally
258
#
259
#                       Must also allow $(GBE_TYPE) in the remainder
260
#
261
# Inputs          : uarg                - Arg to quote
262
#
263
# Returns         : Quoted arg
264
#
265
 
266
sub QuoteDependency
267
{
268
    my ($uarg) = @_;
269
 
270
    #
271
    #   Split into two
272
    #       $(xxx)/             - Makefile variables
273
    #       Remainder           - Stuff to quote
274
    #
275
    $uarg =~ m~^((\$\(.*?\)/)*)(.*)~;
276
    my $prefix = defined $1 ? $1 : '';
277
    my $arg    = defined $3 ? $3 : '';
278
 
7322 dpurdie 279
    $arg =~ s~\$(?!\(GBE_[A-Z]+\)|{GBE_[A-Z]+}|\(OBJDIR\)|\(BUILDVERNUM\))~\$\$~g;       # $, not followed by (GBE_ or ${GBE_ or (OBJDIR)- is not $(GBE_ AND not $(OBJDIR)
5991 dpurdie 280
    $arg =~ s~ ~\\ ~g;
281
    $arg =~ s~,~\$(comma)~g;
282
    $arg =~ s~%~\\%~g;
5999 dpurdie 283
    $arg =~ s~:~\\:~g if ($::ScmHost eq 'Unix');
5991 dpurdie 284
    return $prefix . $arg;
285
}
286
 
287
#-------------------------------------------------------------------------------
288
# Function        : AddDependancyEscaped
289
#
290
# Description     : Add a dependancy to the entry and Quote the value so that
291
#                   it can be it can be processed by make
292
#
293
# Inputs          : An array of dependencies to add
294
#
295
# Returns         :
296
#
297
sub AddDependancyEscaped
298
{
299
    my $self = shift;
300
    my @escaped;
301
 
302
    push @escaped, QuoteDependency($_) foreach (@_);
303
    UniquePush $self->{DEPENDANCY}, @escaped ;
304
}
305
 
306
#-------------------------------------------------------------------------------
227 dpurdie 307
# Function        : AddDependancy
308
#
309
# Description     : Add a dependancy to the entry
5991 dpurdie 310
#                   These will not be escaped.
227 dpurdie 311
#
5991 dpurdie 312
# Inputs          : An array of dependencies to add
227 dpurdie 313
#
314
# Returns         :
315
#
316
sub AddDependancy
317
{
318
    my $self = shift;
319
    UniquePush $self->{DEPENDANCY}, @_ ;
320
}
321
 
322
#-------------------------------------------------------------------------------
323
# Function        : AddDefn
324
#
325
# Description     : Add a definition to the entry
7322 dpurdie 326
#                   Preserve the order
227 dpurdie 327
#
328
# Inputs          : A hash of definitions to add
329
#                   The Hash gets lost in the subcall. Its simply a list
330
#                   of NAME, VALUE pairs
331
#
332
# Returns         :
333
#
334
sub AddDefn
335
{
336
    my $self = shift;
337
    while ( @_ )
338
    {
339
        my $defn = shift;
340
        my $value = shift || '';
7322 dpurdie 341
        push @{$self->{DEFN}}, join( $;, $defn, $value) ;
227 dpurdie 342
    }
343
}
344
 
345
#-------------------------------------------------------------------------------
346
# Function        : RecipePrefix
347
#
348
# Description     : Set the recipe prefix
349
#                   This will be added to ALL recipe entries
350
#
351
# Inputs          :
352
#
353
# Returns         :
354
#
355
sub RecipePrefix
356
{
357
    my $self = shift;
358
    my $prefix = shift || '';
359
    $self->{RECIPE_PREFIX} = $prefix;
360
}
361
 
362
#-------------------------------------------------------------------------------
363
# Function        : RecipeComment
364
#
365
# Description     : Add a runtime comment to the entry
366
#
367
# Inputs          : String to print at runtime
368
#
369
# Returns         :
370
#
371
sub RecipeComment
372
{
373
    my $self = shift;
374
    $self->{RECIPE_COMMENT} = join( ' ', @_);
375
}
376
 
377
 
5708 dpurdie 378
#-------------------------------------------------------------------------------
379
# Function        : RecipeWrapper
380
#
381
# Description     : Add a wrapper around the recipe
382
#
383
# Inputs          : begin   - Start of wrapper
384
#                   end     - End of wrapper
385
#
386
# Returns         :
387
#
388
sub RecipeWrapper
389
{
390
    my $self = shift;
391
    Error("RecipeWrapper requires exacly two arguments") unless scalar @_ == 2;
392
    my ($begin, $end) = @_;
393
    $self->{RECIPE_WRAPPER}[0] = $begin;
394
    $self->{RECIPE_WRAPPER}[1] = $end;
395
}
227 dpurdie 396
 
397
#-------------------------------------------------------------------------------
398
# Function        : AddRecipe
399
#
400
# Description     : Add a line to the line-by-line recipe
401
#
402
# Inputs          : One or more recipe lines
403
#                   Each line of the recipe will be prefixed with the current
404
#                   recipe prefix.
405
#
406
#                   An array will be treated as a recipe with implicit line
4344 dpurdie 407
#                   breaks for formatting purposes.
227 dpurdie 408
#
409
# Returns         :
410
#
411
sub AddRecipe
412
{
413
    my $self = shift;
414
    my $prefix = $self->{RECIPE_PREFIX};
415
    foreach ( @_ )
416
    {
417
        if (ref($_) eq "ARRAY")
418
        {
419
            $_->[0] = $prefix . $_->[0];
420
            push @{$self->{RECIPE}}, $_;
421
        }
422
        else
423
        {
424
            push @{$self->{RECIPE}}, $prefix . $_;
425
        }
426
    }
427
}
428
 
429
#-------------------------------------------------------------------------------
430
# Function        : AddShellRecipe
431
#
432
# Description     : Add recipe lines that will be processed within a 'shell'
433
#
434
# Inputs          : One or more recipe lines
435
#
436
#                   An array will be treated as a recipe with implicit line
4778 dpurdie 437
#                   breaks for formatting purposes.
227 dpurdie 438
#
439
# Returns         :
440
#
441
sub AddShellRecipe
442
{
443
    my $self = shift;
444
    push @{$self->{SHELL}}, @_
445
}
446
 
4778 dpurdie 447
#-------------------------------------------------------------------------------
448
# Function        : NewSection 
449
#
450
# Description     : Create a new section within the current recipe
451
#                   Only used within a standard recipe (not raw or defined)
452
#                   Used to create multiple sections in cases with multiple shell
453
#                   and recipe sections.
454
#
455
#                   Save existing entries and start again
456
#
457
# Inputs          : None 
458
#
459
# Returns         : 
460
#
461
sub NewSection
462
{
463
    my $self = shift;
464
    my %data;
227 dpurdie 465
 
4778 dpurdie 466
    $data{RECIPE}           = $self->{RECIPE};
467
    $data{SHELL}            = $self->{SHELL};
468
    $data{RECIPE_PREFIX}    = $self->{RECIPE_PREFIX};
469
    $data{RECIPE_COMMENT}   = $self->{RECIPE_COMMENT};
5708 dpurdie 470
    $data{RECIPE_WRAPPER}   = $self->{RECIPE_WRAPPER};
4781 dpurdie 471
    $data{SDEF}             = $self->{SDEF};
472
 
4778 dpurdie 473
 
474
    push @{$self->{STACK}}, \%data;
475
 
476
    $self->{RECIPE}         = []; 
477
    $self->{SHELL}          = [];
478
    $self->{RECIPE_PREFIX}  = '';
479
    $self->{RECIPE_COMMENT} = '';
5708 dpurdie 480
    $self->{RECIPE_WRAPPER} = ['(', ')'];
4781 dpurdie 481
    $self->{SDEF}           = '';
4778 dpurdie 482
}
483
 
4889 dpurdie 484
#-------------------------------------------------------------------------------
485
# Function        : SectionIfDef 
486
#
487
# Description     : Place the current section within a ifdef ... endif block
488
#
489
# Inputs          : defn        - Definition to use within the ifdef construct 
490
#
491
# Returns         : Nothing
492
#
493
 
494
sub SectionIfDef
4781 dpurdie 495
{
496
    my $self = shift;
7322 dpurdie 497
    $self->{SDEF} = 'ifdef ' . $_[0];
4781 dpurdie 498
}
499
 
227 dpurdie 500
#-------------------------------------------------------------------------------
7322 dpurdie 501
# Function        : SectionIfEq
502
#
503
# Description     : Place the current section within a ifeq ... endif block
504
#
505
# Inputs          : arg1
506
#                   arg2
507
#
508
# Returns         : Nothing
509
#
510
 
511
sub SectionIfEq
512
{
513
    my $self = shift;
514
    $self->{SDEF} = 'ifeq "' . $_[0] . '" "' . $_[1] . '"';
515
}
516
 
517
#-------------------------------------------------------------------------------
518
# Function        : SectionIfNeq
519
#
520
# Description     : Place the current section within a ifeq ... endif block
521
#
522
# Inputs          : arg1
523
#                   arg2
524
#
525
# Returns         : Nothing
526
#
527
sub SectionIfNeq
528
{
529
    my $self = shift;
530
    $self->{SDEF} = 'ifneq "' . $_[0] . '" "' . $_[1] . '"';
531
}
532
 
533
 
534
#-------------------------------------------------------------------------------
227 dpurdie 535
# Function        : Print
536
#
537
# Description     : Print the entry
538
#
539
# Inputs          : None
540
#
541
# Returns         : Nothing
542
#
543
sub Print
544
{
545
    my $self = shift;
546
 
547
    #
548
    #   Set the default print stream to the desired stream
549
    #   This greatly simplifies the use of print
550
    #
551
    my $fh = $self->{FH};
552
    my $old_fh = select($fh);
553
 
271 dpurdie 554
 
227 dpurdie 555
    #
556
    #   A nice comment header
557
    #
558
    if ( @{$self->{COMMENT}} )
559
    {
560
        print( "#\n" );
561
        print map {"# $_\n"} @{$self->{COMMENT}};
562
        print( "#\n" );
563
    }
564
 
565
    #
566
    #   Print the targets
567
    #   Print PHONY information
568
    #   Print on multiple lines if multiple targets are very long
569
    #
570
    if ( $self->{PHONY} )
571
    {
572
        my $phony_string = ".PHONY: ";
573
        my $tstring = join $;, @{$self->{NAME}};
574
        my $join = length ($tstring) < $llength ? ' ' : "\n$phony_string";
575
        $tstring =~ s~$;~$join~g;
576
        print "$phony_string$tstring\n";
577
    }
578
 
579
    #
580
    #   Print any definitions
5986 dpurdie 581
    #       target: DEFN := VALUE
227 dpurdie 582
    #
583
    if ( $self->{DEFN}  )
584
    {
585
        my $tstring = join $;, @{$self->{NAME}};
586
        my $join = length ($tstring) < $llength ? ' ' : " \\\n    ";
587
        $tstring =~ s~$;~$join~g;
7322 dpurdie 588
 
589
        foreach ( @{$self->{DEFN}} ){
590
            my ($defn,$value) = split($;, $_);
591
            print( "$tstring: $defn := $value\n" );
227 dpurdie 592
        }
593
    }
594
 
4344 dpurdie 595
    if ( $self->{RAW}  )
227 dpurdie 596
    {
4778 dpurdie 597
        if ( $self->{PHONY} )
598
        {
599
            my $tstring = $self->{NAME}[0];
600
            print($tstring . ":\n");
601
        }
4344 dpurdie 602
        my $tstring = join ("\n", @{$self->{RECIPE}});
603
        print $tstring;
227 dpurdie 604
    }
4344 dpurdie 605
    elsif ( $self->{DEFINE}  )
606
    {
227 dpurdie 607
 
4344 dpurdie 608
        my $tstring = $self->{NAME}[0];
609
        print "define $tstring";
610
        print_list ( '', '', $self->{RECIPE}, '');
611
        print "\nendef";
612
    }
613
    else
614
    {
615
        #
616
        #   Print the main target name
617
        #   Print on multiple lines if multiple targets are very long
618
        #
619
        my $tstring = join $;, @{$self->{NAME}};
620
        my $join = length ($tstring) < $llength ? ' ' : " \\\n";
621
        $tstring =~ s~$;~$join~g;
622
        my $nlength = length $tstring;
623
        print "$tstring:";
624
 
625
        #
626
        #   Print the prerequisites
627
        #   Print on multiple lines if long
628
        #
629
        $tstring = join $;, @{$self->{DEPENDANCY}};
630
        $join = $nlength + length ($tstring) < $llength ? ' ' : " \\\n\t";
631
        $tstring =~ s~$;~$join~g;
632
        print $join . $tstring;
227 dpurdie 633
 
4344 dpurdie 634
        #
4778 dpurdie 635
        #   Push the current section onto the stack
636
        #   This will simplify processing of all sections
4344 dpurdie 637
        #
4778 dpurdie 638
        $self->NewSection();
639
        foreach my $recipeEntry (@{$self->{STACK}})
4344 dpurdie 640
        {
4778 dpurdie 641
            my $comment = $recipeEntry->{RECIPE_COMMENT};
5708 dpurdie 642
            my $wrapper = $recipeEntry->{RECIPE_WRAPPER};
4778 dpurdie 643
            my $prefix =  $recipeEntry->{RECIPE_PREFIX};
644
            my $recipe =  $recipeEntry->{RECIPE};
645
            my $shell =   $recipeEntry->{SHELL};
4781 dpurdie 646
            my $sdef =    $recipeEntry->{SDEF};
647
 
648
            if ($sdef)
649
            {
7322 dpurdie 650
                print "\n$sdef";
4781 dpurdie 651
            }
652
 
4778 dpurdie 653
            #
654
            #   Print the Recipe runtime comment
655
            #
656
            if ( $comment )
657
            {
658
                print "\n\t\@echo \"$comment\"";
659
            }
660
 
661
            #
662
            #   Print the recipe
663
            #
664
            print_list ( '', '', $recipe, '');
665
 
666
            #
667
            #   Print the recipe as a shell command
668
            #   Bracket the recipes with ( .. ) and place semi colons between lines
669
            #   Use the current recipe prefix
670
            #
5708 dpurdie 671
            print_list ( $prefix . $wrapper->[0], ';\\', $shell, $wrapper->[1]);
4781 dpurdie 672
 
673
            if ($sdef)
674
            {
675
                print "\nendif";
676
            }
4344 dpurdie 677
        }
678
    }
679
 
227 dpurdie 680
    print "\n\n";
681
 
682
    #
683
    #   Flag the entry as having been printed
684
    #   Used as a sanity test when the object is destroyed
685
    #
686
    $self->{PRINT} = 1;
687
 
688
    #
689
    #   Restore default output stream handle
690
    #
691
    select($old_fh);
692
}
693
 
694
#-------------------------------------------------------------------------------
695
# Function        : print_list
696
#
697
# Description     : Internal helper rouitine
698
#
699
# Inputs          : $prefix     - Optional prefix to wrap the list
700
#                                 If present will cause extra indentation
701
#                   $linesep    - Line seperator string
702
#                   $ref        - Ref to the list to display
703
#                                 Each element will be a line of text, or an
704
#                                 array of arguments which will be displayed on
705
#                                 new lines for pretty printing
706
#                   $suffix     - Optional suffix.
707
#
708
# Returns         :
709
#
710
sub print_list
711
{
712
    my ($prefix, $linesep ,$ref, $suffix) = @_;
713
    my @entry = @{$ref};
714
    my $leadin = "\t";
715
 
716
    if ( @entry  )
717
    {
718
        if ( $prefix )
719
        {
720
            print( "\n" . $leadin . $prefix . "\\" );
721
            $leadin .= "\t";
722
        }
723
 
724
        foreach ( @entry )
725
        {
726
            if (ref($_) eq "ARRAY")
727
            {
728
                my @array = @{$_};
729
                my $indent = '';
730
                my $tail = '';
731
                foreach ( @array )
732
                {
733
                    print( $tail . "\n" . $leadin . $indent . $_ );
734
                    $indent = "\t";
735
                    $tail = " \\";
736
                }
737
                print $linesep;
738
            }
739
            else
740
            {
741
                print( "\n" . $leadin . $_ . $linesep );
742
            }
743
        }
744
 
745
        if ( $suffix )
746
        {
4778 dpurdie 747
            $leadin = chop($leadin) if ($prefix);
227 dpurdie 748
            print( "\n" . $leadin . $suffix );
749
        }
750
    }
751
}
752
 
753
#-------------------------------------------------------------------------------
754
# Function        : DESTROY
755
#
756
# Description     : Sanity test
757
#
758
# Inputs          :
759
#
760
# Returns         :
761
#
762
sub DESTROY
763
{
764
    my $self = shift;
765
    unless ($self->{PRINT} )
766
    {
767
        $self->{PRINT} = 1;
768
        Error ("Destroying MakeEntry before printing.",
769
               "Name: @{$self->{NAME}}");
770
    }
271 dpurdie 771
 
772
    #
773
    #   If using an in-memory file close the handle
774
    #
775
    close $self->{FH} if ( $self->{FH_inmemory} );
227 dpurdie 776
}
777
 
778
1;
779
 
780