HEX
Server: Apache
System: Linux opal14.opalstack.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User: curbgloabal_opal (1234)
PHP: 8.1.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/share/doc/perl-Readonly-1.03/t/tie.t
#!/usr/bin/perl -I..

# Test the Readonly function

use strict;
use Test::More tests => 4;

sub expected
{
    my $line = shift;
    $@ =~ s/\.$//;   # difference between croak and die
    return "Invalid tie at " . __FILE__ . " line $line\n";
}

# Find the module (1 test)
BEGIN {use_ok('Readonly'); }

eval {tie my $s, 'Readonly::Scalar', 1};
is $@ => expected(__LINE__-1), "Direct scalar tie";

eval {tie my @a, 'Readonly::Array', 2, 3, 4};
is $@ => expected(__LINE__-1), "Direct array tie";

eval {tie my %h, 'Readonly::Hash', five => 5, six => 6};
is $@ => expected(__LINE__-1), "Direct hash tie";