in reply to Re: CMD says files is closed when It should be open
in thread CMD says files is closed when It should be open
I have updated my code to include what you suggest, and based on what I have read about File::Slurp you are correct, it is the proper choice. However, the problem I run into now is the error: "Uncaught exception from user code: read_file 'F:\SEC\10s\.' - sysopen: Permission denied at ... line 22. Perhaps for some reason the file name is not getting appended to the file path and that is causing the problem?
#!/usr/bin/perl use 5.014; # so push/pop/etc work on scalars (experimental) use strict; use warnings; use diagnostics; use File::Slurp; use LWP::Simple 'get'; use HTML::TableExtract; use HTML::FormatText::WithLinks::AndTables; my $directory = 'F:\\SEC10q\\10Qs\\'; #print "$directory\n"; my $n = 0; opendir (DIR, $directory) or die $!; while (my $secfile = readdir(DIR)) { #print $directory."$secfile\n"; my $data = $directory."$secfile"; ########################## print $secfile; print $data; my $str = read_file($data); print $str; $n=$n+1; print "$n\n"; ######################### my $te = HTML::TableExtract->new( headers => [ 'Purchased','Average','Publicly','May'], slice_columns => 0,keep_html => 0,br_translate => 0 #shoul +d we turn the automap option on? ); $te->parse($str); } closedir(DIR);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: CMD says files is closed when It should be open
by choroba (Cardinal) on Aug 21, 2012 at 21:21 UTC | |
|
Re^3: CMD says files is closed when It should be open
by Kenosis (Priest) on Aug 21, 2012 at 21:45 UTC |