1 ## name Perl 4 package declarations
10 #-----------------------------------------------------------------------------
11 ## name Perl 5 package declarations
17 package Foo::Bar::Baz;
19 #-----------------------------------------------------------------------------
20 ## name Perl 4 simple variable access
26 my $x = $Foo'Bar::baz;
27 my $x = $Foo::Bar'baz;
30 my @x = @Foo'Bar::baz;
31 my @x = @Foo::Bar'baz;
35 my %x = %Foo'Bar::baz;
36 my %x = %Foo::Bar'baz;
38 #-----------------------------------------------------------------------------
39 ## name Perl 5 simple variable access
44 my $x = $Foo::Bar::baz;
50 my %x = %Foo::Bar::baz;
52 #-----------------------------------------------------------------------------
53 ## name Perl 4 simple variable assignment
69 #-----------------------------------------------------------------------------
70 ## name Perl 4 localized variable assignment
75 local $Foo'Bar::baz = $x;
76 local $Foo::Bar'baz = $x;
79 local @Foo'Bar::baz = @x;
80 local @Foo::Bar'baz = @x;
83 local %Foo'Bar::baz = %x;
84 local %Foo::Bar'baz = %x;
86 local ($Foo'Bar'baz, $Foo'Bar'bam) = @list;
88 #-----------------------------------------------------------------------------
89 ## name Perl 5 simple variable assignment
102 #-----------------------------------------------------------------------------
103 ## name Perl 5 localized variable assignment
107 local $Foo::Bar = $x;
108 local $Foo::Bar::baz = $x;
110 local @Foo::Bar = @x;
111 local @Foo::Bar::baz = @x;
113 local %Foo::Bar = %x;
114 local %Foo::Bar::baz = %x;
116 local ($Foo::Bar::baz, $Foo::Bar::bam) = @list;
118 #-----------------------------------------------------------------------------
119 ## name Perl 4 simple subroutine invocation
125 Foo'Bar::baz($x, 'y');
126 Foo::Bar'baz($x, 'y');
130 my $x = Foo'Bar::baz($x, 'y');
131 my $x = Foo::Bar'baz($x, 'y');
133 #-----------------------------------------------------------------------------
134 ## name Perl 5 simple subroutine invocation
140 Foo::Bar::baz($x, 'y');
143 my $x = Foo::Bar::baz($x, 'y');
145 #-----------------------------------------------------------------------------
146 ## name Perl 4 simple direct class method invocation
152 Foo'Bar::baz->new($x, 'y');
153 Foo::Bar'baz->new($x, 'y');
155 my $x = Foo'bar->new();
156 my $x = &Foo'bar->new;
157 my $x = Foo'Bar::baz->new($x, 'y');
158 my $x = Foo::Bar'baz->new($x, 'y');
160 #-----------------------------------------------------------------------------
161 ## name Perl 5 simple direct class method invocation
167 Foo::Bar::baz->new($x, 'y');
169 my $x = &Foo::bar->new;
170 my $x = Foo::bar->new();
171 my $x = Foo::Bar::baz->new($x, 'y');
173 #-----------------------------------------------------------------------------
174 ## name Perl 4 simple indirect class method invocation
180 $z = new Foo'Bar::baz($x, 'y');
181 $z = new Foo::Bar'baz($x, 'y');
183 #-----------------------------------------------------------------------------
184 ## name Perl 5 simple indirect class method invocation
190 $z = new Foo::Bar::baz($x, 'y');
192 #-----------------------------------------------------------------------------
193 ## name complicated statements
197 # If PPI ever gains the ability to parse regexes failures ought to be 26.
198 @Foo::bar = Xyzzy::Qux::corge(Grault::Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B::C::d e /xms;
199 @Foo'bar = Xyzzy::Qux::corge(Grault::Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B::C::d e /xms;
200 @Foo::bar = Xyzzy'Qux::corge(Grault::Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B::C::d e /xms;
201 @Foo::bar = Xyzzy::Qux'corge(Grault::Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B::C::d e /xms;
202 @Foo::bar = Xyzzy::Qux::corge(Grault'Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B::C::d e /xms;
203 @Foo::bar = Xyzzy::Qux::corge(Grault::Thud->fred('x') + new Plugh'Waldo) =~ m/ a $B::C::d e /xms;
204 @Foo::bar = Xyzzy::Qux::corge(Grault::Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B'C::d e /xms;
205 @Foo::bar = Xyzzy::Qux::corge(Grault::Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B::C'd e /xms;
207 @Foo'bar = Xyzzy::Qux'corge(Grault::Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B::C::d e /xms;
208 @Foo::bar = Xyzzy'Qux::corge(Grault'Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B::C::d e /xms;
209 @Foo::bar = Xyzzy::Qux'corge(Grault::Thud->fred('x') + new Plugh'Waldo) =~ m/ a $B::C::d e /xms;
210 @Foo::bar = Xyzzy::Qux::corge(Grault'Thud->fred('x') + new Plugh::Waldo) =~ m/ a $B'C::d e /xms;
211 @Foo::bar = Xyzzy::Qux::corge(Grault::Thud->fred('x') + new Plugh'Waldo) =~ m/ a $B::C'd e /xms;
213 @Foo'bar = Xyzzy::Qux'corge(Grault::Thud->fred('x') + new Plugh'Waldo) =~ m/ a $B'C::d e /xms;
215 @Foo'bar = Xyzzy'Qux'corge(Grault'Thud->fred('x') + new Plugh'Waldo) =~ m/ a $B'C'd e /xms;
218 #-----------------------------------------------------------------------------
224 $foo = { bar'baz => 0 };
225 print $foo{ bar'baz };
228 #-----------------------------------------------------------------------------
243 #-----------------------------------------------------------------------------
245 ##############################################################################
246 # $URL: http://perlcritic.tigris.org/svn/perlcritic/trunk/Perl-Critic/t/Variables/ProhibitPerl4PackageNames.run $
247 # $Date: 2008-05-20 22:43:14 -0500 (Tue, 20 May 2008) $
248 # $Author: clonezone $
250 ##############################################################################
254 # cperl-indent-level: 4
256 # indent-tabs-mode: nil
257 # c-indentation-style: bsd
259 # ex: set ts=8 sts=4 sw=4 tw=78 ft=perl expandtab shiftround :