lib/OpenFrame/Argument/Blob.pm

filter: Statementstmt 92.8% 39 / 42 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 81.8% 9 / 11 Podpod 33.3% 2 / 6 totaltotal 84.6% 55 / 65 CC 4 SCAR 4.1
CC
4
Cov
92%
name
2.1
filename
2.0
filehandle
2.0
CRAP 1.5
« blib/lib/OpenFrame/Object.pm ↑ Summary
1 package OpenFrame::Argument::Blob;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use IO::Null;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use OpenFrame::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use base qw ( OpenFrame::Object );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $VERSION=3.05;
11  
12 1 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
13 1 my $self = shift;
14  
15 1 $self->name( '' ); ## initialize the argument name
16 1 $self->filename( '' ); ## initialize the filename
17 1 $self->filehandle( IO::Null->new() ); ## initialize the filehandle
18  
19 1 $self->SUPER::init(@_);
20 }
21  
22 1 ▶sub name {
Subroutine name: called CC=2 SCAR=7.2
Pod undocumented
23 1 my $self = shift;
24 1 my $name = shift;
25 1 ▶ if (defined($name)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $name) { } 1 0 1
26 1 $self->{name} = $name;
27 1 return $self;
28 } else {
29 0 return $self->{name};
30 }
31 }
32  
33 3 ▶sub filename {
Subroutine filename: called CC=2 SCAR=6.9
Pod documented
34 3 my $self = shift;
35 3 my $file = shift;
36 3 ▶ if (defined($file)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $file) { } 2 1 3
37 2 $self->{filename} = $file;
38 2 return $self;
39 } else {
40 1 return $self->{filename};
41 }
42 }
43  
44 2 ▶sub filehandle {
Subroutine filehandle: called CC=2 SCAR=6.9
Pod documented
45 2 my $self = shift;
46 2 my $fh = shift;
47 2 ▶ if (defined($fh)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $fh) { } 1 1 2
48 1 $self->{filehandle} = $fh;
49 1 return $self;
50 } else {
51 1 return $self->{filehandle};
52 }
53 }
54  
55 0 ▶sub STORABLE_freeze {
Subroutine STORABLE_freeze: not called CC=1 SCAR=6.9
Pod undocumented
56 0 my $self = shift;
57 0 $self->filehandle('');
58 }
59  
60 0 ▶sub STORABLE_thaw {
Subroutine STORABLE_thaw: not called CC=1 SCAR=0.0
Pod undocumented
61  
62 }
63  
64 2 1;
65  
66 =head1 NAME
67  
68 OpenFrame::Argument::Blob - handling for filehandle-style data in network requests
69  
70 =head1 SYNOPSIS
71  
72 use OpenFrame::Argument::Blob;
73  
74 my $blob = OpenFrame::Argument::Blob->new();
75  
76 $blob->filename( 'somefilename.dat' );
77 $blob->filehandle( $fh );
78  
79 my $filename = $blob->filename;
80 my $filehandle = $blob->filehandle;
81  
82 =head1 DESCRIPTION
83  
84 C<OpenFrame::Argument::Blob> is a class to support things such as browser-based uploads. It provides
85 a mechanisms to get the filehandle and filename of the uploaded element.
86  
87 =head1 METHODS
88  
89 =over 4
90  
91 =item filename( [ SCALAR ] )
92  
93 The C<filename()> method gets/sets the value of the filename attribute of the class. This should return
94 the filename of the uploaded data.
95  
96 =item filehandle( [ IO::Handle ] )
97  
98 The C<filehandle> method gets/sets the value of the filehandle that points to the uploaded data.
99  
100 =back
101  
102 =head1 INHERITANCE
103  
104 C<OpenFrame::Argument::Blob> inherits from the C<OpenFrame::Object> class and provides all methods that
105 its super class does.
106  
107 =head1 AUTHOR
108  
109 James A. Duncan <jduncan@fotango.com>
110  
111 =head1 COPYRIGHT
112  
113 Copyright 2002 Fotango Ltd. All Rights Reserved.
114  
115 This code is released under the GNU GPL and Artistic licenses.
116  
117 =cut
118  
119  
120  
« blib/lib/OpenFrame/Object.pm ↑ Summary