lib/Zoom/Meeting.pm untested

filter: Statementstmt 0.0% 0 / 42 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 Subroutinesub 0.0% 0 / 7 totaltotal 0.0% 0 / 58 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # ABSTRACT: Launch Zoom meetings via Perl
2  
3 use v5.37.12;
4 use experimental qw( class try builtin );
5 use builtin qw( true false blessed );
6  
7 package Zoom::Meeting; # quirk
8 class Zoom::Meeting {
9  
10 use overload q("") => sub { $_[0] -> _url; };
11  
12 use URI;
13 use Path::Tiny;
14 use System::Command;
15  
16 # @formatter:off
17 field $id :param;
18 field $password :param = undef;
19 # @formatter:on
20  
21  
22 method id ( $new_id = undef ) {
23 if ( defined $new_id ) {
24 $id = $new_id;
25 }
26 else {
27 return $id;
28 }
29 }
30  
31  
32  
33 method password ( $new_password = undef ) {
34 if ( defined $new_password ) {
35 $password = $new_password;
36 }
37 else {
38 return $password;
39 }
40 }
41  
42  
43 method _url ( ) {
44 my $uri = URI -> new( 'zoommtg://zoom.us' ); # scheme is '_foreign' class, so no 'host' method
45 $uri -> path( 'join' );
46 $uri -> query_form_hash( {
47 'confno' => $id ,
48 'pwd' => $password
49 } );
50 return $uri;
51 }
52  
53  
54  
55 method launch ( ) {
56  
57 my $zoom;
58  
59 if ( $^O eq 'linux' and -f '/proc/sys/fs/binfmt_misc/WSLInterop' ) {
60 $zoom = path '/mnt/c/Program Files/Zoom/bin/zoom.exe';
61 }
62  
63 System::Command -> new(
64 $zoom ,
65 "--url=@{ [ $self -> _url ] }" ,
66 # { trace => 3 }
67 );
68  
69 }
70  
71  
72 }
73  
74 __END__