comparison Lib/IMPL/Web/DOM/FileNode.pm @ 151:e36ffd8c29db

Fixed major bug in conversion from a POST request to the DOM document (when instanceId == 0) minor fixes
author wizard
date Fri, 20 Aug 2010 16:33:37 +0400
parents e6447ad85cb4
children 1f7a6d762394
comparison
equal deleted inserted replaced
150:4369d5458bb6 151:e36ffd8c29db
11 get => sub { 11 get => sub {
12 my ($this) = @_; 12 my ($this) = @_;
13 $this->_parameterName() or 13 $this->_parameterName() or
14 $this->_parameterName( 14 $this->_parameterName(
15 join '/', ( map { 15 join '/', ( map {
16 $_->nodeProperty('instanceId') ? 16 (defined $_->nodeProperty('instanceId')) ?
17 $_->nodeName . '['.$_->nodeProperty('instanceId').']': 17 $_->nodeName . '['.$_->nodeProperty('instanceId').']':
18 $_->nodeName 18 $_->nodeName
19 } $this->_selectParents, $this ) 19 } $this->_selectParents, $this )
20 ); 20 );
21 } 21 }
41 die new IMPL::InvalidArgumentException("A reference to a function should be specified") unless $sub && ref $sub eq 'CODE'; 41 die new IMPL::InvalidArgumentException("A reference to a function should be specified") unless $sub && ref $sub eq 'CODE';
42 42
43 $target ||= $this; 43 $target ||= $this;
44 44
45 my $query = $this->document->nodeProperty('query') or die new IMPL::InvalidOperationException("Failed to get a CGI query from the document"); 45 my $query = $this->document->nodeProperty('query') or die new IMPL::InvalidOperationException("Failed to get a CGI query from the document");
46 my $hFile = $query->upload($this->parameterName) or $query->cgi_error ? die new IMPL::IOException("Failed to open the uploaded file",$query->cgi_error) : return; 46 my $hFile = $query->upload($this->parameterName) or die new IMPL::IOException("Failed to open the uploaded file",$query->cgi_error,$this->parameterName,$this->nodeProperty('instanceId'));
47 47
48 my ($hTemp,$tempFileName) = tempfile(); 48 my ($hTemp,$tempFileName) = tempfile();
49 binmode($hTemp); 49 binmode($hTemp);
50 50
51 print $hTemp $_ while <$hFile>; 51 print $hTemp $_ while <$hFile>;
52 52
53 $hTemp->flush(); 53 $hTemp->flush();
54 seek $hTemp, 0,0; 54 seek $hTemp, 0,0;
55 { 55 {
56 local $_ = $tempFileName; 56 local $_ = $tempFileName;
57 &$sub($this,$tempFileName,$hTemp); 57 $sub->($this,$tempFileName,$hTemp);
58 } 58 }
59 } 59 }
60 60
61 sub _selectParents { 61 sub _selectParents {
62 my ($node) = @_; 62 my ($node) = @_;