=item Win32::GetLongPathName(PATHNAME)
-[CORE] Returns a representaion of PATHNAME comprised of longname
-compnents (if any). The result may not necessarily be longer
+[CORE] Returns a representaion of PATHNAME composed of longname
+components (if any). The result may not necessarily be longer
than PATHNAME. No attempt is made to convert PATHNAME to the
absolute path. Compare with Win32::GetShortPathName and
Win32::GetFullPathName.
=item Win32::GetShortPathName(PATHNAME)
-[CORE] Returns a representation of PATHNAME comprised only of
+[CORE] Returns a representation of PATHNAME composed only of
short (8.3) path components. The result may not necessarily be
shorter than PATHNAME. Compare with Win32::GetFullPathName and
Win32::GetLongPathName.
=head2 Support for strings represented as a vector of ordinals
-Literals of the form v1.2.3.4 are now parsed as a string comprised of
+Literals of the form v1.2.3.4 are now parsed as a string composed of
of characters with the specified ordinals. This is an alternative, more
readable way to construct (possibly unicode) strings instead of
interpolating characters, as in C<"\x{1}\x{2}\x{3}\x{4}">.
=head2 New variable $^V contains Perl version in v5.6.0 format
-C<$^V> contains the Perl version number as a string comprised of
+C<$^V> contains the Perl version number as a string composed of
characters whose ordinals match the version numbers, so that it may
be used in string comparisons.
The basic subroutine lock looks like this:
- sub test_sub {
- use attrs qw(locked);
+ sub test_sub :locked {
}
This ensures that only one thread will be executing this subroutine at
new Thread \&thread_sub, 3;
new Thread \&thread_sub, 4;
- sub sync_sub {
- use attrs qw(locked);
+ sub sync_sub :locked {
my $CallingThread = shift @_;
print "In sync_sub for thread $CallingThread\n";
yield;
print "$ThreadID is done with sync_sub\n";
}
-The use attrs qw(locked) locks sync_sub(), and if you run this, you
-can see that only one thread is in it at any one time.
+The C<locked> attribute tells perl to lock sync_sub(), and if you run
+this, you can see that only one thread is in it at any one time.
=head2 Methods
return bless [@_], $class;
}
- sub per_object {
- use attrs qw(locked method);
+ sub per_object :locked :method {
my ($class, $thrnum) = @_;
print "In per_object for thread $thrnum\n";
yield;
print "Exiting per_object for thread $thrnum\n";
}
- sub one_at_a_time {
- use attrs qw(locked);
+ sub one_at_a_time :locked {
my ($class, $thrnum) = @_;
print "In one_at_a_time for thread $thrnum\n";
yield;
=head2 Locking A Subroutine
-You can lock a subroutine as you would lock a variable. Subroutine
-locks work the same as a C<use attrs qw(locked)> in the subroutine,
+You can lock a subroutine as you would lock a variable. Subroutine locks
+work the same as specifying a C<locked> attribute for the subroutine,
and block all access to the subroutine for other threads until the
lock goes out of scope. When the subroutine isn't locked, any number
of threads can be in it at once, and getting a lock on a subroutine
lock(\&sub_to_lock);
-Simple enough. Unlike use attrs, which is a compile time option,
-locking and unlocking a subroutine can be done at runtime at your
+Simple enough. Unlike the C<locked> attribute, which is a compile time
+option, locking and unlocking a subroutine can be done at runtime at your
discretion. There is some runtime penalty to using lock(\&sub) instead
-of use attrs qw(locked), so make sure you're choosing the proper
+of the C<locked> attribute, so make sure you're choosing the proper
method to do the locking.
You'd choose lock(\&sub) when writing modules and code to run on both