Moose/Connection/WWW.pm

filter: Statementstmt 77.1% 27 / 35 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod 0.0% 0 / 2 totaltotal 74.4% 35 / 47 SCAR 0.1
CC
1
Cov
77%
Read
2.0
Write
2.0
BEGIN
1.0
CRAP 1.0
« Moose/Instrument/Keysight34470A.pm ↑ Summary Moose/Sweep/DataFile.pm »
1 package Lab::Moose::Connection::WWW;
2 1 $Lab::Moose::Connection::WWW::VERSION = '3.881';
3 #ABSTRACT: Connection with URL requests
4  
5 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Moose::Util::TypeConstraints qw(enum);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use Lab::Moose::Instrument qw/timeout_param read_length_param/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use LWP::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19  
20 1 has ip => (
21 is => 'ro',
22 isa => 'Str',
23 required => 1,
24 );
25  
26 1 has port => (
27 is => 'ro',
28 isa => 'Lab::Moose::PosNum',
29 required => 1,
30 );
31  
32 sub Read {
33 0 ▶ my ( $self, %args ) = validated_hash(
Subroutine Read: not called CC=1 SCAR=6.9
Pod undocumented
34 \@_,
35 command => { isa => 'Str' },
36 );
37 0 my $command = $args{'command'};
38 0 my $url = "http://$self->ip():$self->port()$command";
39 0 return get( $url );
40 }
41  
42 sub Write {
43 0 ▶ my ( $self, %args ) = validated_hash(
Subroutine Write: not called CC=1 SCAR=6.9
Pod undocumented
44 \@_,
45 command => { isa => 'Str' },
46 );
47 0 my $command = $args{'command'};
48 0 my $url = "http://$self->ip():$self->port()$command";
49 0 get( $url );
50 }
51  
52 1 1;
53  
54 __END__
55  
56 =pod
57  
58 =encoding UTF-8
59  
60 =head1 NAME
61  
62 Lab::Moose::Connection::WWW - Connection with URL requests
63  
64 =head1 VERSION
65  
66 version 3.881
67  
68 =head1 SYNOPSIS
69  
70 use Lab::Moose
71
72 my $instrument = instrument(
73 type => 'random_instrument',
74 connection_type => 'WWW',
75 connection_options => {ip => 172.22.11.2, port => 8002},
76 );
77  
78 =head1 DESCRIPTION
79  
80 This module provides a connection for devices with an integrated web
81 server.
82  
83 =head1 COPYRIGHT AND LICENSE
84  
85 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
86  
87 Copyright 2022 Mia Schambeck
88  
89  
90 This is free software; you can redistribute it and/or modify it under
91 the same terms as the Perl 5 programming language system itself.
92  
93 =cut
« Moose/Instrument/Keysight34470A.pm ↑ Summary Moose/Sweep/DataFile.pm »