I'm toying with Puppet (a Ruby-based system administration app), and interfacing with it is seemingly done via a REST API. It allows file transfers, format YAML, which do work, but Perl's module chokes on anything larger than 32K while I'd want to move a 4MB JPEG. I do realise that even if it worked, it would be loaded entirely in RAM, but let's suppose that wasteful manner is not an issue. The error I get is "Complex regular subexpression recursion limit (32766) exceeded at YAML/Loader.pm line 519" - why would it even try to apply a regex to the data? The spec simply says everything up to \n should just be swallowed in a string. Smaller files, binary or not, do work - is this an expected limitation of the format?
Sample:Update: the "complex regex" part seems to be quite an old bug: https://bugzilla.redhat.com/show_bug.cgi?id=192400use LWP::UserAgent; use YAML; my $ua = LWP::UserAgent->new; my $ah = HTTP::Headers->new; $ah->header('Accept' => 'yaml'); //required by puppet my $req = HTTP::Request->new('GET', 'https://localhost:8140/production +/file_content/test/afile.jpg', $ah); my $res = $ua->request($req); if(!$res->is_success) { die "Something went wrong: $res->status_line" +} else { my @a = YAML::Load($res->content."\n"); //puppet seems to forget add +ing that trailing newline open(HM, '>hm.jpg'); binmode HM; print HM $a[0]->{content}; }
In reply to Load large(ish) files with YAML? by rgcosma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |