From jrice at datacraftsolutions.net Tue Jan 2 11:16:55 2007 From: jrice at datacraftsolutions.net (Jason Rice) Date: Tue, 2 Jan 2007 14:16:55 -0500 Subject: [Raleigh-talk] Mysterious GLOB files Message-ID: I have a set of scripts which cycle through some directories (on a redhat linux machine) to process files. The code works fine, except for creating GLOB(0x.......) files when the scripts complete. Anyone have an idea on this? Snippet follows: opendir my $handle_dir, $baseDir; # Get list of server folders my @all_files; my @folders = grep { not /[.][.]?|.*[.]\w+/xmsi } readdir $handle_dir; foreach my $fld (@folders) { opendir my $sub_handle_dir, "$baseDir/$fld/processed"; my @sub_folders = grep { /\d{15}/xmsi } readdir $sub_handle_dir; foreach my $fld2 (@sub_folders) { opendir my $xls_handle_dir, "$baseDir/$fld/processed/$fld2/XML"; chdir "$baseDir/$fld/processed/$fld2/XML"; my @xls_files = grep { /\A.*[.]xml\z/xmsi } readdir $xls_handle_dir; foreach my $file (@xls_files) { # Move each file to the processed directory structure chdir "$baseDir/$fld/processed/$fld2/"; my @args = ('mv', "$baseDir/$fld/processed/$fld2/XML/$file", "$baseDir/$fld/processed/$fld2/XML/complete"); my $ret = system(@args); if (!$ret) { #Process here } } closedir $xls_handle_dir; } closedir $sub_handle_dir; } closedir $handle_dir; =======END CODE =======BEGIN ls -l Result -rw-r--r-- 1 root root 0 Jan 2 12:52 GLOB(0x9710bdc) -rw-r--r-- 1 root root 0 Jan 2 12:49 GLOB(0x9d1ebdc) -rw-r--r-- 1 root root 0 Jan 2 12:51 GLOB(0x9ee0bdc) -rw-r--r-- 1 root root 0 Jan 2 12:50 GLOB(0x9f95bdc) =======END ls -l Result Thanks, --JER -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/raleigh-talk/attachments/20070102/d0d25285/attachment.html From wia at iglass.net Wed Jan 3 14:11:17 2007 From: wia at iglass.net (Marc Wiatrowski) Date: Wed, 3 Jan 2007 17:11:17 -0500 Subject: [Raleigh-talk] Mysterious GLOB files In-Reply-To: Message-ID: <024b01c72f84$172ad4e0$6bb1a8c0@istructure.com> What directory is it creating these GLOB files in? $baseDir? What are some of the directory, subdirectory, and file names? Any funky special characters in them? My guess is some how you are creating files named after your actual file (directory) handles, $handle_dir and/or $sub_handle_dir, and/or $xls_handle_dir. Maybe sneaking into the second parameter of your mv system call... Any more of the script that may be reusing those variables? marc _____ From: raleigh-talk-bounces+wia=iglass.net at pm.org [mailto:raleigh-talk-bounces+wia=iglass.net at pm.org] On Behalf Of Jason Rice Sent: Tuesday, January 02, 2007 2:17 PM To: raleigh-talk at pm.org Subject: [Raleigh-talk] Mysterious GLOB files I have a set of scripts which cycle through some directories (on a redhat linux machine) to process files. The code works fine, except for creating GLOB(0x.......) files when the scripts complete. Anyone have an idea on this? Snippet follows: opendir my $handle_dir, $baseDir; # Get list of server folders my @all_files; my @folders = grep { not /[.][.]?|.*[.]\w+/xmsi } readdir $handle_dir; foreach my $fld (@folders) { opendir my $sub_handle_dir, "$baseDir/$fld/processed"; my @sub_folders = grep { /\d{15}/xmsi } readdir $sub_handle_dir; foreach my $fld2 (@sub_folders) { opendir my $xls_handle_dir, "$baseDir/$fld/processed/$fld2/XML"; chdir "$baseDir/$fld/processed/$fld2/XML"; my @xls_files = grep { /\A.*[.]xml\z/xmsi } readdir $xls_handle_dir; foreach my $file (@xls_files) { # Move each file to the processed directory structure chdir "$baseDir/$fld/processed/$fld2/"; my @args = ('mv', "$baseDir/$fld/processed/$fld2/XML/$file", "$baseDir/$fld/processed/$fld2/XML/complete"); my $ret = system(@args); if (!$ret) { #Process here } } closedir $xls_handle_dir; } closedir $sub_handle_dir; } closedir $handle_dir; =======END CODE =======BEGIN ls -l Result -rw-r--r-- 1 root root 0 Jan 2 12:52 GLOB(0x9710bdc) -rw-r--r-- 1 root root 0 Jan 2 12:49 GLOB(0x9d1ebdc) -rw-r--r-- 1 root root 0 Jan 2 12:51 GLOB(0x9ee0bdc) -rw-r--r-- 1 root root 0 Jan 2 12:50 GLOB(0x9f95bdc) =======END ls -l Result Thanks, --JER -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/raleigh-talk/attachments/20070103/0cd09807/attachment.html From jrice at datacraftsolutions.net Thu Jan 4 07:06:04 2007 From: jrice at datacraftsolutions.net (Jason Rice) Date: Thu, 4 Jan 2007 10:06:04 -0500 Subject: [Raleigh-talk] Mysterious GLOB files Message-ID: >>What directory is it creating these GLOB files in? $baseDir? What are >>some of the directory, subdirectory, and >>file names? Any funky special characters in them? I've looked a bit more into the issue, and it is not with that loop at all (even though 'I was sure I had isolated it to that loop'). The GLOB gets created when I perform a redirection of STDOUT and STDERR. Below is a quick sample which creates the empty GLOB on my red-hat server: open my $file_log, '>>', 'test2.log'; open STDOUT, '>>', $file_log; open STDERR, '>>', $file_log; select(STDOUT); $| = 1; select(STDERR); $| = 1; print STDOUT "STDOUT 1\n"; print STDERR "STDERR 1\n"; close STDOUT; close STDERR; I've attempted to dig a little around and see what the issue is. It was that I wasn't redirecting STDOUT and STDERR via a file handle the proper way. The below code has been working fine: open my $file_log, '>>', 'test2.log'; open STDOUT, '>>&', $file_log; open STDERR, '>>&', $file_log; select(STDOUT); $| = 1; select(STDERR); $| = 1; print STDOUT "STDOUT 1\n"; print STDERR "STDERR 1\n"; close STDOUT; close STDERR; I had left out the duping directive or whatever you term the '&' appended to the open mode. I had always previously just redirected them via the file name directly, so had never had a need for the '&'. Sorry for the mis-direction. --Jason ________________________________________ From: raleigh-talk-bounces+jrice=datacraftsolutions.net at pm.org [mailto:raleigh-talk-bounces+jrice=datacraftsolutions.net at pm.org] On Behalf Of Marc Wiatrowski Sent: Wednesday, January 03, 2007 5:11 PM To: raleigh-talk at pm.org Subject: Re: [Raleigh-talk] Mysterious GLOB files What directory is it creating these GLOB files in??? $baseDir? What are some of the directory, subdirectory, and file names?? Any funky special characters in them?? ? My guess is some how you are creating files named after your actual file (directory) handles, $handle_dir and/or $sub_handle_dir, and/or?$xls_handle_dir.? Maybe sneaking into the second parameter of your mv system call... Any more of the script that may be reusing those variables? ? marc ________________________________________ From: raleigh-talk-bounces+wia=iglass.net at pm.org [mailto:raleigh-talk-bounces+wia=iglass.net at pm.org] On Behalf Of Jason Rice Sent: Tuesday, January 02, 2007 2:17 PM To: raleigh-talk at pm.org Subject: [Raleigh-talk] Mysterious GLOB files I have a set of scripts which cycle through some directories (on a redhat linux machine) to process files. The code works fine, except for creating GLOB(0x.......) files when the scripts complete. Anyone have an idea on this? Snippet follows: opendir my $handle_dir, $baseDir; # Get list of server folders my @all_files; my @folders = grep { not /[.][.]?|.*[.]\w+/xmsi } readdir $handle_dir; foreach my $fld (@folders) { ??????????? opendir my $sub_handle_dir, "$baseDir/$fld/processed"; ??????????? my @sub_folders = grep { /\d{15}/xmsi } readdir $sub_handle_dir; ??????????? foreach my $fld2 (@sub_folders) { ??????????????????????? opendir my $xls_handle_dir, "$baseDir/$fld/processed/$fld2/XML"; ??????????????????????? chdir "$baseDir/$fld/processed/$fld2/XML"; ??????????????????????? my @xls_files = grep { /\A.*[.]xml\z/xmsi } readdir $xls_handle_dir; ??????????????????????? foreach my $file (@xls_files) { ??????????????????????????????????? # Move each file to the processed directory structure ??????????????????????????????????? chdir "$baseDir/$fld/processed/$fld2/"; ??????????????????????????????????? my @args = ('mv', "$baseDir/$fld/processed/$fld2/XML/$file", ? "$baseDir/$fld/processed/$fld2/XML/complete"); ??????????????????????????????????? my $ret = system(@args); ??????????????????????????????????? if (!$ret) { ??????????????????????????????????????????????? #Process here ??????????????????????????????????? } ??????????????????????? } ??????????????????????? closedir $xls_handle_dir;??????????????????????? ??????????? } ??????????? closedir $sub_handle_dir; } closedir $handle_dir; =======END CODE =======BEGIN ls -l Result -rw-r--r--??? 1 root???? root??????????? 0 Jan? 2 12:52 GLOB(0x9710bdc) -rw-r--r--??? 1 root???? root??????????? 0 Jan? 2 12:49 GLOB(0x9d1ebdc) -rw-r--r--??? 1 root???? root??????????? 0 Jan? 2 12:51 GLOB(0x9ee0bdc) -rw-r--r--??? 1 root???? root??????????? 0 Jan? 2 12:50 GLOB(0x9f95bdc) =======END ls -l Result Thanks, --JER From bradoaks at gmail.com Wed Jan 10 06:36:11 2007 From: bradoaks at gmail.com (Brad Oaks) Date: Wed, 10 Jan 2007 09:36:11 -0500 Subject: [Raleigh-talk] perl related comic strip Message-ID: Hey folks, This one has been going around at work, and if you haven't heard of xkcd, it's worth a look: http://xkcd.com/c208.html --bradoaks From bradoaks at gmail.com Thu Jan 18 10:20:33 2007 From: bradoaks at gmail.com (Brad Oaks) Date: Thu, 18 Jan 2007 13:20:33 -0500 Subject: [Raleigh-talk] January meeting question/proposal. Message-ID: how do you folks feel about rescheduling January's meeting for sometime next week? I'd like to talk about Asterisk and it's API for scripts -- AGI. they can be written in perl, but i've not gotten far enough along in my exploration to begin using them. Alternatively I could talk (or recruit someone more knowledgeable to talk) about the Class::Accessor::Fast module. holler back, --bradoaks.