NAME
Azure::SDK::Storage::Blobs::BlobItem - one entry from a Blob listing
SYNOPSIS
for my $item ( @{ $page->items } ) {
say $item->name, ' ', $item->etag, ' ', $item->content_length;
}
DESCRIPTION
A declared value object for one <Blob> element of a Blob listing, so callers do not depend on the wire shape of the XML.
ETag normalization
The Blob service returns ETags in two different forms. The ETag response header on an upload or download is quoted:
etag: "0x1DC96B8AA9DE930"
The <Etag> element inside a container listing is not:
<Etag>0x1DC96B8AA9DE930</Etag>
A consumer that compares a listed ETag against a downloaded ETag would never see a match. BlobItem therefore normalizes every ETag to its unquoted form, and exposes normalize_etag so response headers can be normalized the same way.
Validator strength is not folded into that normalization. A weak validator, W/"0x1DC96B8AA9DE930", cannot satisfy the strong comparison RFC 9110 requires for If-Match. The W/ prefix is stripped from etag so value comparison still works, and the strength is reported separately by etag_is_weak so a weak validator is never silently promoted into a strong precondition.
CONSTRUCTOR
new
Named parameters: name (required), etag, last_modified, content_length, and content_type. etag is normalized and content_length is validated as numeric and coerced to a number.
METHODS
name
The blob name, decoded.
etag
The normalized, unquoted ETag, or undef. The W/ prefix of a weak validator is not part of this value; see etag_is_weak.
etag_is_weak
True when the ETag arrived as a weak validator. False when it was strong or absent. Callers building an If-Match precondition must not use an ETag whose etag_is_weak is true.
last_modified
The last-modified value exactly as the service returned it (an HTTP date).
content_length
The blob size in bytes as a number, or undef.
content_type
The blob content type, or undef.
normalize_etag
my $etag = Azure::SDK::Storage::Blobs::BlobItem->normalize_etag($raw);
Class method. Strips surrounding whitespace, a weak-validator W/ prefix, and surrounding double quotes. Returns undef for an empty or undefined value. Use the etag_is_weak accessor when validator strength matters.
as_hashref
Returns the fields as a plain hash reference.
SEE ALSO
Azure::SDK::Storage::Blobs::BlobPage, Azure::SDK::Storage::Blobs::Serializer