package util; #----------------------------------------------------------------------- # name : get_title_version # function : get the title version from the specified tad file #----------------------------------------------------------------------- sub get_title_version { my $titleVersion = 0 ; my $cmdPython = "/usr/bin/python.exe"; my $scrpPython = "/usr/local/bin/mkcls.py"; $tad = $_[0]; open(PY, "$cmdPython $scrpPython $tad | ") or die "$!"; $titleVersion = $1 if ( =~ /([0-9]{1,})/) ; close(PY); $titleVersion; } #----------------------------------------------------------------------- # name : get_nlist # function : get the list of the specified directory except "." and ".." #----------------------------------------------------------------------- sub get_nlist { my $dirname = ( $#_ < 0) ? "." : $_[0]; my @list; unless ( opendir(DIR, "$dirname") ) { print "Can't open directory: $dirname\n"; return ""; } foreach $node ( readdir(DIR) ) { push(@list, $node) unless ( $node =~ /^\.{1,2}$/ ); } closedir(DIR); @list; } #----------------------------------------------------------------------- # name : fecheck # function : check the specified file existence (Error if no file) #----------------------------------------------------------------------- sub fecheck { my $filename = $_[0]; unless ( -e $filename ) { print <