ClearCase-Region
view release on metacpan or search on metacpan
docs/Creating_Reuseable_Perl_Scripts.htm view on Meta::CPAN
style='mso-spacerun:yes'> </span>International trades uses trades with project
id = "tr"<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span
style='mso-spacerun:yes'> </span><span style='mso-tab-count:2'> </span>2)<span
style='mso-spacerun:yes'> </span>Market Analysis uses current futures with
project id = "ma"<o:p></o:p></span></p>
<p class=MsoNormal style='text-indent:.5in'><span style='font-size:10.0pt'>Enter
1, 2, ... 2): 1<o:p></o:p></span></p>
<p class=MsoNormal style='text-indent:.5in'><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>So, the main_cos script can
be reused in different regions and subregions because the Region class
encapsulates the relevant data.<span style='mso-spacerun:yes'> </span>The
main_cos script uses the variable ${vobdir) = Region->vobdir() to define the
VOB storage directory location for all VOBs.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<h1><![if !supportLists]><span style='font-size:10.0pt;font-family:Helvetica;
mso-fareast-font-family:Helvetica'><span style='mso-list:Ignore'>9.<span
style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span
style='font-size:10.0pt;font-family:Helvetica;mso-bidi-font-family:Arial'>Using
the Region Class<o:p></o:p></span></h1>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:Helvetica;
mso-bidi-font-family:"Times New Roman"'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>The Region.pm class module
and all the associated sample scripts referenced in this paper are available
from CPAN.<span style='mso-spacerun:yes'> </span>The Region module is not a
generic class that can be applied to every site, so some customization will
be required.<span style='mso-spacerun:yes'> </span>The Region module assumes
that a branch per release version control policy is being used and hence,
contains methods that are most useful when using branch per release
management.<span style='mso-spacerun:yes'> </span>Nevertheless, the Region
class is a great starting point for building reuseable objects within your
company and then layering (or building) reuseable Perl scripts on top.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>Include the line:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>use ClearCase::Region;<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>in Perl scripts that will be
using the Region.pm module.<span style='mso-spacerun:yes'> </span>This module
must either be installed in one of @INC directories, or specified in one of the
$PERL5LIB directories.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>The Region.pm class module
and the associated sample scripts (Region_test, co_backup and main_cos) all use
the Log::Log4perl Class.<span style='mso-spacerun:yes'> </span>Log::Log4perl
is freely available from CPAN and SourceForge (<a
href="http://log4perl.sourceforge.net/">http://log4perl.sourceforge.net</a>).<span
style='mso-spacerun:yes'> </span>The Log::Log4perl module requires the
Log::Dispatch bundle as well.<span style='mso-spacerun:yes'> </span>If you
dont have Log::Log4perl, use the CPAN module or PPM to upgrade your Perl
environment prior to using these programs.<o:p></o:p></span></p>
<h1><![if !supportLists]><span style='font-size:10.0pt;font-family:Helvetica;
mso-fareast-font-family:Helvetica'><span style='mso-list:Ignore'>10.<span
style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span
style='font-size:10.0pt;font-family:Helvetica;mso-bidi-font-family:Arial'>A OO
Model of the ClearCase Vob<o:p></o:p></span></h1>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoBodyText>The following Rose model is an OO model of the ClearCase
VOB:</p>
<p class=MsoNormal><span style='font-size:10.0pt;mso-bidi-font-size:12.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><!--[if gte vml 1]><v:shape
id="_x0000_i1028" type="#_x0000_t75" style='width:108.75pt;height:354pt'>
<v:imagedata src="Creating_Reuseable_Perl_Scripts_files/image009.wmz" o:title=""/>
</v:shape><![endif]--><![if !vml]><img border=0 width=145 height=472
src="Creating_Reuseable_Perl_Scripts_files/image010.gif" v:shapes="_x0000_i1028"><![endif]><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>The sample script, Vob_test
can be used to test the Vob object.<span style='mso-spacerun:yes'>
</span>Running Vob_test produces:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>>perl Vob_test<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>All known vobs: trades
current futures<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>Did not get flag for vob.
Must ask...<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>Please select vob:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span
style='mso-spacerun:yes'> </span>1)<span style='mso-spacerun:yes'>
</span>trades<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span
style='mso-spacerun:yes'> </span>2)<span style='mso-spacerun:yes'>
</span>current<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span
style='mso-spacerun:yes'> </span>3)<span style='mso-spacerun:yes'>
</span>futures<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
docs/Creating_Reuseable_Perl_Scripts.htm view on Meta::CPAN
<p class=MsoNormal><span style='font-size:10.0pt'>src_dir<span
style='mso-tab-count:2'> </span>'src'<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>lib_dirs<span
style='mso-tab-count:2'> </span>['bin']<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>relnums<span
style='mso-spacerun:yes'> </span><span style='mso-tab-count:1'> </span>[
2, 3, 4, 5 ]<span style='mso-spacerun:yes'> </span># all release
numbers<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>active<span
style='mso-spacerun:yes'> </span><span style='mso-tab-count:1'> </span>[
1, 1, 1, 1 ]<span style='mso-spacerun:yes'> </span># array of active
releases<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>The rules for setting up the Vob.cfg
file are defined in the comments.<span style='mso-spacerun:yes'> </span>Adding
an additional attribute is easy.<span style='mso-spacerun:yes'> </span>For
example, the Group Id for each Vob could be added with the line:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>group_id<span style='mso-tab-count:1'> </span>bankofamerica<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>after the active line for
each Vob record.<span style='mso-spacerun:yes'> </span>The
ClearCase::Vob_Cfg_Parser->new() method will then add the key, group_id, to
the hash reference to class Vob, as shown here:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><!--[if gte vml 1]><v:shape id="_x0000_i1029" type="#_x0000_t75"
style='width:381pt;height:301.5pt' o:ole="">
<v:imagedata src="Creating_Reuseable_Perl_Scripts_files/image011.wmz" o:title=""/>
</v:shape><![endif]--><![if !vml]><img border=0 width=508 height=402
src="Creating_Reuseable_Perl_Scripts_files/image012.gif" v:shapes="_x0000_i1029"><![endif]><!--[if gte mso 9]><xml>
<o:OLEObject Type="Embed" ProgID="Visio.Drawing.6" ShapeID="_x0000_i1029"
DrawAspect="Content" ObjectID="_1119602664">
</o:OLEObject>
</xml><![endif]--><span style='font-size:10.0pt'><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>Of course, the Vob.pm class
would have to be modified to include an accessor method as well.<o:p></o:p></span></p>
<h1><![if !supportLists]><span style='font-size:10.0pt;font-family:Helvetica;
mso-fareast-font-family:Helvetica'><span style='mso-list:Ignore'>11.<span
style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span
style='font-size:10.0pt;font-family:Helvetica;mso-bidi-font-family:Arial'>Sample
program using both the ClearCase Region and Vob<o:p></o:p></span></h1>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt'>The sample program, co_backup
(available from CPAN), demonstrates the use of both the Region class and the
Vob class to create a reuseable Perl script. The co_backup Perl script creates
a compress cpio backup of all checked out files in all dynamic views.<span
style='mso-spacerun:yes'> </span>Hence, the co_backup script can be used to
back up files that are being worked on by developers (in dynamic views)
without having to back up the entire view.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>In addition, this script only
cares about the active releases (or views).<span style='mso-spacerun:yes'>
</span>The co_backup script uses the Vob object to determine which releases
(branches) are active for a VOB.<span style='mso-spacerun:yes'> </span>The
co_backup script assumes that all developers views follow a naming convention <login>_<subregion>_<relno>.<span
style='mso-spacerun:yes'> </span>Then by starting in the /view directory, all
developers views can be listed using:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>cleartool lsview short *_${subregion}_${relno}<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>Of course, if your company
has a different naming convention, then this line will need to change.<span
style='mso-spacerun:yes'> </span>The co_backup script will start the
developers view (if required).<span style='mso-spacerun:yes'> </span>The list
of active releases is used to determine which developers views to back
up.<span style='mso-spacerun:yes'> </span>So, for the market_unix_region
listed above, only the developers views:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_tr_1<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_tr_2<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_tr_3<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_ma_4<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_ma_5<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_ma_6<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>will be backed up (provided
there is some checked out files).<span style='mso-spacerun:yes'> </span>When
the co_backup program is executed on the ClearCase server in the
credit_unix_region, the developers views:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_cr_2<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_cr_3<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_cr_4<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>*_cr_5<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>will be backed up.<span
style='mso-spacerun:yes'> </span>Hence, the co_backup script is reuseable in
different regions.<span style='mso-spacerun:yes'> </span>If the co_backup
script encounters an error, like a bad view, it logs the error message to:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><span style='mso-tab-count:
1'> </span>$HOME/logs/${subregion}${relno}.${vob}.backup.log<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>using the class
Log::Log4perl.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<h1><![if !supportLists]><span style='font-size:10.0pt;font-family:Helvetica;
mso-fareast-font-family:Helvetica'><span style='mso-list:Ignore'>12.<span
style='font:7.0pt "Times New Roman"'> </span></span></span><![endif]><span
style='font-size:10.0pt;font-family:Helvetica;mso-bidi-font-family:Arial'>Summary<o:p></o:p></span></h1>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt'>A Perl script can be designed
so that it is completely reuseable between sites.<span
style='mso-spacerun:yes'> </span>The reuseable Perl script uses one or more
instances of Objects created from a Perl Classes.<span
style='mso-spacerun:yes'> </span>The Perl Classes are mostly reuseable.<span
style='mso-spacerun:yes'> </span>For the co_backup script, this can be
represented as:<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><!--[if gte vml 1]><v:shape id="_x0000_i1030" type="#_x0000_t75"
style='width:394.5pt;height:273pt' o:ole="">
<v:imagedata src="Creating_Reuseable_Perl_Scripts_files/image013.wmz" o:title=""/>
</v:shape><![endif]--><![if !vml]><img border=0 width=526 height=364
src="Creating_Reuseable_Perl_Scripts_files/image014.gif" v:shapes="_x0000_i1030"><![endif]><!--[if gte mso 9]><xml>
<o:OLEObject Type="Embed" ProgID="Visio.Drawing.6" ShapeID="_x0000_i1030"
DrawAspect="Content" ObjectID="_1119602665">
</o:OLEObject>
</xml><![endif]--><span style='font-size:10.0pt'><o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>The design of the Perl
Classes depends on the network topology, defined Regions, defined subregions or
projects and the version control policy being used.<span
style='mso-spacerun:yes'> </span>This paper presented a simple network
configuration using a branch per release version control policy is illustrate
the design of ClearCase classes for Region and Vob.<o:p></o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
<p class=MsoNormal><span style='font-size:10.0pt'>Using the Region and Vob
classes, many Perl scripts can be created that are reuseable between sites,
platforms and even companies.<span style='mso-spacerun:yes'> </span>The sample
scripts provided with this paper can be used to start building your own
reuseable Perl Scripts.<o:p></o:p></span></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-size:10.0pt'><o:p> </o:p></span></p>
</div>
</body>
</html>
( run in 2.950 seconds using v1.01-cache-2.11-cpan-bbb979687b5 )