Permalink
Browse files

- Prima->find_image;

  • Loading branch information...
1 parent 946e1dc commit 4df4e2c6000ff18401d61150ccc58da9d4fa0de9 tobez committed Jul 23, 1999
Showing with 38 additions and 16 deletions.
  1. +36 −0 Prima.pm
  2. +2 −16 Prima/StdBitmap.pm
View
36 Prima.pm
@@ -1,3 +1,28 @@
+#
+# Copyright (c) 1997-1999 The Protein Laboratory, University of Copenhagen
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
package Prima;
use strict;
@@ -31,4 +56,15 @@ sub import
}
}
+sub find_image
+{
+ shift if @_ > 1;
+ my $name = shift;
+ $name =~ s!::!/!g;
+ for (@INC) {
+ return "$_/Prima/images/$name" if -f "$_/Prima/images/$name" && -r _;
+ }
+ return undef;
+}
+
1;
View
18 Prima/StdBitmap.pm
@@ -25,7 +25,7 @@
#
package Prima::StdBitmap;
use strict;
-use Prima::Const;
+require Prima;
require Exporter;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@ISA = qw(Exporter);
@@ -35,21 +35,7 @@ $VERSION = '1.00';
%EXPORT_TAGS = ();
my %bmCache = ();
-my $bmImageFile = undef;
-
-{
- my $imagePath = '.';
- for ( keys %::) {
- if (/Prima\/StdBitmap\.pm$/) {
- $imagePath = $_;
- $imagePath =~ s/^..(.*)\/StdBitmap\.pm$/$1/;
- last;
- }
- }
- # my $scriptPath = (grep { m/Script$/ } @INC)[-1];
- # ( my $imagePath = $scriptPath) =~ s/Script$/Images/;
- $bmImageFile = "$imagePath/sysimage.gif";
-}
+my $bmImageFile = Prima-> find_image( "sysimage.gif");
sub load_std_bmp
{

0 comments on commit 4df4e2c

Please sign in to comment.