File: code.pl

package info (click to toggle)
libgetargs-long-perl 1.1012-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 280 kB
  • sloc: perl: 2,303; makefile: 2
file content (40 lines) | stat: -rwxr-xr-x 736 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#
# $Id: code.pl,v 1.1.1.1 2004/09/22 17:32:58 coppit Exp $
#
#  Copyright (c) 2000-2001, Raphael Manfredi
#  
#  You may redistribute only under the terms of the Artistic License,
#  as specified in the README file that comes with the distribution.
#
# HISTORY
# $Log: code.pl,v $
# Revision 1.1.1.1  2004/09/22 17:32:58  coppit
# initial import
#
# Revision 0.1.1.1  2001/03/02 17:59:48  ram
# patch1: added.
#
# Revision 0.1  2001/03/01 14:46:55  manfredi
# Initial revision.
#
# $EndLog$
#

sub contains {
	my ($file, $pattern) = @_;
	local *FILE;
	local $_;
	open(FILE, $file) || die "can't open $file: $!\n";
	my $found = 0;
	while (<FILE>) {
		if (/$pattern/) {
			$found = 1;
			last;
		}
	}
	close FILE;
	return $found;
}

1;