Skip to content

Commit 309a882

Browse files
committed
Some more S22 tweaks, introducing .parse-spec
1 parent 480e2ef commit 309a882

File tree

1 file changed

+44
-24
lines changed

1 file changed

+44
-24
lines changed

S22-package-format.pod

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -369,26 +369,7 @@ Optional. A hash of resource groups, each of them corresponding to a
369369
directory in the "resource" directory in the distribution. Each resource
370370
group has a name and a list of files that are provided. During installation
371371
the installer will install these into a location, and make the files available
372-
through the %?RESOURCE hash. So, for example:
373-
374-
"resource" : {
375-
"images" : {
376-
"fido.png"
377-
}
378-
}
379-
380-
would assume there is a file C<resource/images/fido.png>. After installation,
381-
the path of that file would be available through
382-
383-
%?RESOURCE<images><fido.png>.path
384-
385-
and a handle could be obtained with:
386-
387-
%?RESOURCE<images><fido.png>.IO
388-
389-
without there being any guarantee that this path has anything to do with the
390-
path as specified in the distribution. Please also note that the installer
391-
may mangle filenames of actually installed files.
372+
through the L</%?RESOURCE> hash.
392373

393374
=head3 support
394375

@@ -524,7 +505,15 @@ will be assumed. So:
524505
inst:/installed,/also both use CURL::Installation
525506
/foo/bar,inst:/installed first CURL::File, second CURL::Installation
526507

527-
=head2 new
508+
=head3 parse-spec
509+
510+
my @repo-specs = CompUnitRepo.parse-spec( $string );
511+
512+
This helper method returns a C<List> of C<Parcel>s, in which the first element
513+
contains the L</short-id>, the second contains a C<Hash> of the optional
514+
named parameters, and the third contains the location string.
515+
516+
=head3 new
528517

529518
my $repo = CompUnitRepo.new( $specification );
530519

@@ -544,7 +533,7 @@ The following C<short-id>'s are pre-defined:
544533
file CompUnitRepo::Local::File
545534
inst CompUnitRepo::Local::Installation
546535

547-
=head2 install
536+
=head3 install
548537

549538
my $installed = $repo.install( $something );
550539

@@ -598,9 +587,9 @@ the C<META6.json> file of a distribution.
598587

599588
=head3 new
600589

601-
my $dist = Distribution( 'HTML-Template-1.20.tar.gz' );
590+
my $dist = Distribution.new( 'HTML-Template-1.20.tar.gz' );
602591

603-
my $dist = Distribution( '.unpacked/HTML-Template-1.20' );
592+
my $dist = Distribution.new( '.unpacked/HTML-Template-1.20' );
604593

605594
Create object from distribution file, or from an already unpacked distribution.
606595

@@ -620,6 +609,37 @@ if something went wrong.
620609

621610
Several dynamic variables are available.
622611

612+
=head2 %?RESOURCE
613+
614+
This hash provides compile and runtime access to files associated with the
615+
L</Distribution> of the current compilation unit.
616+
617+
So, if the C<META6.json> file contains this C<resource> section:
618+
619+
"resource" : {
620+
"images" : {
621+
"fido.png"
622+
}
623+
}
624+
625+
then the C<Distribution> is supposed to contain a file
626+
C<resource/images/fido.png>. After installation, the path of that file would
627+
be available through
628+
629+
%?RESOURCE<images><fido.png>.path
630+
631+
and a handle could be obtained with:
632+
633+
%?RESOURCE<images><fido.png>.IO
634+
635+
without there being any guarantee that this path has anything to do with the
636+
path as specified in the distribution. Please also note that the installer
637+
may mangle filenames of actually installed files.
638+
639+
This means you can have files with unicode characters in upper/lower case,
640+
and still be able to access them when installed on a file system that does
641+
not support unicode.
642+
623643
=head2 %*CUSTOM_LIB
624644

625645
This hash provides key/value pairs of C<CompUnitRepo> specifications, to be

0 commit comments

Comments
 (0)