Added POD tests and a Perl::Critic test
[nasm/perl-rewrite.git] / perl / lib / Nasm / insns / Operands.pm
blob887c87bca80178dece32265039507f6e2c19da03
1 =head1 NAME
3 Nasm::insns::Operands
5 =cut
7 package Nasm::insns::Operands;
8 use strict;
9 use warnings;
10 use Scalar::Util 'reftype';
12 =head2 new
14 Creates a new Nasm::insns::Operands object
16 =cut
18 sub new{
19 my( $class, $string ) = @_;
20 $string =~ s/^ \s+ //gx;
21 $string =~ s/ \s+ $//gx;
23 if( $string eq 'ignore' ){
24 return bless \$string, $class;
27 my $self = bless [], $class;
30 return $self unless $string;
31 return $self if $string eq 'void';
33 @$self = split ',', $string;
35 return $self;
39 =head2 string
41 Stringifys an Nasm::insns::Operands object
43 =cut
45 sub string{
46 my( $self ) = @_;
48 return '' if reftype $self eq 'SCALAR';
49 return '' if reftype $self eq 'REF';
51 #return '()' unless @$self;
52 return '('.join(',',@$self).')';