CfgTie

 view release on metacpan or  search on metacpan

bin/DNS-find-free  view on Meta::CPAN

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
else
  {print "Sorry, none of the address spaces work\n";}
 
if (exists $MyArgs{'swip-output'})
{
    SWIP_Gen(\%SReq, $MyArgs{'swip-input'}, $MyArgs{'swip-output'});
}
 
 
#Find the first free rang in the address block
sub find_first_free($$)
{
   my ($A,$Num)=@_;
   for(my $I=1; $I<255-$Num+1;$I++)
    {
       #Check to see if the first item is already used
       if (exists $A->{$I}) {next;}
 
       #Okay, the first item is not already used.. check the next few
       my $T=0;
       for(my $J=$I+1; $J<$I+$Num; $J++)
        {
            if (exists $A->{$J}) {$T=1;}
        }
       if (!$T) {return $I;}
    }
 
   undef;
}
 
sub ARIN_scan($$)
{
   #Scans an ARIN file, placing the relevant information in S
   #Example: ARIN_Scan(\%MyHash,'file');
   my ($S,$Name)=@_;
 
   if (!-e $Name) {Fatal(FILE_NEXIST, $Name);}
 
   my $ARIN=$FNum++;
   open ARIN, "<$Name";

cgi/sys.cgi  view on Meta::CPAN

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use 5.004;
use strict;
my %Gen;
tie %Gen, 'CfgTie::TieGeneric';
my $pathinfo;
my $CSS="$Base0/CfgTie.css";
my $Base="$Base0/sys.cgi/";
 
sub redirect($) {exec ("cat ".shift);}
sub Untaint_path($) {$_[0]=~ s/^(.*)$/$1/;}
 
sub Prefixes_To_Avoid($)
{
   my $self=shift;
   #Avoid anything that starts with act-
   if ($self->{'name'} =~ /^act-/i) {return 0;}
   return 1;
}
 
sub Gen_print($$)
{
   my ($Space,$Name)= @_;
 
   #If the user does not exists, gripe
   if ( (defined $Space && $Space && length $Space &&  !exists $Gen{$Space}) ||
        (defined $Name && $Name && !exists $Gen{$Space}->{$Name}))
     {
        #Carlington miniscule
        my $Thingy=$Space;
        if ($Space=~/^(\w)(\w+)/) {my $a=$1;$a=~tr/a-z/A-Z/;$Thingy=$a.$2;}

lib/CfgTie/CfgArgs.pm  view on Meta::CPAN

236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#       elsif (!exists $N->{VALUE}
#       else {save this for later...}
    }
}
 
#while <F>
#  Args_parse(split /(?:\\)\s/);
#}
 
 
sub Help()
{
   #This returns a text string describing the flags.  It is meant to help
   #put together a command line tool help message
   my $L="\t    ";
   "Main operation mode:\n".
   "$L--op=set|unset|remove|delete|exists|fetch|get|copy|rename\n".
   "$L--copy   name1=name2 name3=name4 ...\n".
   "$L--delete name1 name2 ...\n".
   "$L--exists name1 name2 name3 ...\n".
   "$L--fetch  name1 name2 name3 ...\n".

lib/CfgTie/Cfgfile.pm  view on Meta::CPAN

275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
       #Check to see if we need an initial description.
       if (!defined $Obj->comments) {@Args=(@Args, '-t-');}
#       print "Checkin' in\n";
       $Obj->ci(@Args);
    }
   %Files2CheckIn=();
}
 
__END__
 
sub RCS_Handshake($)
{
   my $self=shift;
   if (!exists $self->{RCS}) {return;}
 
   my $RObj = $self->{RCS};
   if (defined $RObj->comments)
     {
        my $locker = $RObj->lock;
 
        #Do we need to check it out?

lib/CfgTie/Cfgfile.pm  view on Meta::CPAN

359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
   my ($self,$key) = @_;
   return exists $self->{Contents}->{$key};
}
 
sub FETCH
{
   my ($self,$key)=@_;
   return $self->{Contents}->{$key};
}
 
sub Queue_Delete($$)
{
   my ($self,$key) = @_;
 
#   print "Queuing a delete for $key\n";
 
   #If there is a value it is supposed to be associated with, remove it, and
   #queue it for later
   $self->{Queue}->{$key} ='';
}
 
sub Queue_Store($$$)
{
   my ($self,$key,$val) = @_;
 
   #If there is a value it is supposed to be associated with, override it, and
   #queue it for later
   $self->{Queue}->{$key} = $val;
}
 
sub DELETE
{
   my ($self,$key)=@_;
   #Queue this for later.
 
   #Remove it from our current set of values
   if (exists $self->{Contents}->{$key}) {delete $self->{Contents}->{$key};}
 
   Queue_Delete($self, $key);
}
 
sub STORE_cheap($$)
{
   my ($self,$val) = @_;
   #if we add something, and it is not in the DB, we have it easy...
   #we just append it to the end of the file and run newaliases
   #It is not completely cheap since we run new aliases...
 
   #Do the append
   eval '$self->cfg_begin();';
 
   #Check with the revision control system

lib/CfgTie/Cfgfile.pm  view on Meta::CPAN

516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
               }
          }\n";
#Could be faster with an 'else'..
    }
 
   $Sub.="   }\n";
   eval "$Sub";
#die "$Sub\n $@\n";
}
 
sub Comment_Add($$)
{
   #This appends the comments to the set of comments for this revision
   my ($self,$Cmt) = @_;
   if (exists $self->{Comments})
     {$self->{Comments} .= "$Cmt\n";}
    else
     {$self->{Comments} = "$Cmt\n";}
}
 
#Some HTML helpers

lib/CfgTie/TieAliases.pm  view on Meta::CPAN

212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
}
 
sub cfg_end
{
   my $self = shift;
   if (exists $self->{Path} && $self->{Path} eq '/etc/aliases')
     {CfgTie::filever::system("/usr/bin/newaliases");}
#    else {print "Not a path for newaliases\n";}
}
 
sub format($$)
{
   my ($self,$key,$value)=@_;
   "$key: ".join(',',@{$value})."\n";
}
 
#sub is_tainted {not eval {join('',@_),kill 0; 1;};}
 
sub makerewrites
{
   my ($self) = @_;

lib/CfgTie/TieAliases.pm  view on Meta::CPAN

249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
   $Rules .="\n   \$_;\n};\n";
   $@='';
#   if (&is_tainted($Rules))
#       {die "Rules for updating aliases file are tainted\n";}
#    else
     {eval $Rules;}
   if (defined $@ && length $@) {die "rewrite rules compilation failed: $@";}
   return $Sub;
}
 
sub ImpGroups(&$)
{
   my ($CodeRef,$Ref)=@_;
   #Create a list of group names that pass the selection criteria
   #The code ref is passed a reference to the group information
   my %groups;
   use CfgTie::TieGroup;
   tie %groups, 'CfgTie::TieGroup';
 
   if (!defined $CodeRef)
     {

lib/CfgTie/TieGeneric.pm  view on Meta::CPAN

232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
        #Tie in the key
        tie %{$self->{Contents}->{$key}}, $A,$B;
     }
   if (exists $self->{Cache}->{$key}) {return $self->{Cache}->{$key};}
   #Try to get the local thing first
   if (exists $self->{Contents}->{$key}) {return $self->{Contents}->{$key};}
   return undef;
}
 
sub HTML($)
{
   my $self=shift;
   my $A='';
   for (my $I=FIRSTKEY($self); $I; $I=NEXTKEY($self,$I))
    {
       $A.="<tr>".CfgTie::Cfgfile::td("<a href=\"$I\">$I</a>")."</tr>";
    }
   CfgTie::Cfgfile::table('Directory',$A,1);
}

lib/CfgTie/TieGroup.pm  view on Meta::CPAN

223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
   my $name = shift;
 
   #Basically delete the group now.
   CfgTie::filever::system("$CfgTie::TieGroup_rec'groupdel $name");
 
   #Remove it from our cache
   if (exists $CfgTie::TieGroup_rec'by_name{$name})
     {delete $CfgTie::TieGroup_rec'by_name{$name};}
}
 
sub HTML($$)
{
   my ($self,$CodeRef)=@_;
   my %A;
   for (my $I=FIRSTKEY($self); $I; $I=NEXTKEY($self,$I))
    {
       my $U=FETCH($self,$I);
       #See if the caller wants us to pass
       if (defined $CodeRef && !&$CodeRef($U)) {next;}
       $A{$I} = CfgTie::Cfgfile::trx(
                "<a href=\"group/$I\">$I</a>",

lib/CfgTie/TieGroup.pm  view on Meta::CPAN

490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
   else
        {
           #Just remove our local copy
           delete $self->{$lkey};
        }
}
 
 
sub trx   {CfgTie::Cfgfile::trx(@_);}
sub table {CfgTie::Cfgfile::table(@_);}
sub HTML($)
{
   # A routine to HTMLize the user
   my $self=shift;
 
   my %Keys2 = map {$_,1} (keys %{$self});
 
   delete $Keys2{name};
   delete $Keys2{id};
   delete $Keys2{password};
   delete $Keys2{members};

lib/CfgTie/TieGroup.pm  view on Meta::CPAN

565
566
567
568
569
570
571
572
573
574
575
576
577
578
                 'passwd' =>$x[1],
                 'id'     =>$x[2],
                 'members'=>[split(/(?:\s+|\,)/, $x[3])]
              };
         }
   }
 
   $F->close;
}
 
sub format($$)
{
   "$_[1]: ".join(',',@{$_[1]})."\n";
}

lib/CfgTie/TieMTab.pm  view on Meta::CPAN

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
   my $dev = Quota::getdev($path);
 
   #If it failed, it does not exist
   if (!defined $dev) {return undef;}
 
   if (!exists $by_dev{$dev}) {$by_dev{$dev}=[$dev];}
 
   $by_dev{$dev};
}
 
sub MTab_scan()
{
   Quota::setmntent();
   while (my @A=Quota::getmntent())
    {
       $by_dev {$A[0]}=\@A;
       $by_path{$A[1]}=\@A;     
    }
   Quota::endmntent();
}

lib/CfgTie/TieNamed.pm  view on Meta::CPAN

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
#       $AUTOLOAD eq 'reload'|| $AUTOLOAD eq 'status')
#     {
#        return (tied $serv)->$AUTOLOAD(@_);
#     }
 
   #Pass the message along
#   $self->{delegate}->$AUTOLOAD(@_);
#}
 
#List the reverses addresses spaces we primary (except loopback)
sub RevSpaces($)
{
   my $self=shift;
 
   # Get the goodies of the real deal
#   if (exists $self->{delegate}) {$self = $self->{delegate};}
 
   my $P=$_;
   my @Ret;
   foreach $_ (keys %{$self->{Contents}->{primary}})
    {
       if (/^0.0.127\.in-addr\.arpa$/i) {next;}
       if (/\.in-addr\.arpa$/i) {push @Ret, $_;}
    }
   $_=$P;
   @Ret;
}
 
#List the name spaces that we primary (except loopback and the reverse)
sub FwdSpaces($)
{
   my $self=shift;
 
   my $P=$_;
   my @Ret;
   foreach $_ (keys %{$self->{Contents}->{primary}})
    {
       if (/\.in-addr\.arpa$/i) {next;}
       push @Ret,$_;
    }

lib/CfgTie/TieNamed.pm  view on Meta::CPAN

610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
     }
   "$Ret</table>\n";
}
 
@ISA=qw(CfgTie::Cfgfile);
#A tie hash for a single primary file...
 
my @days_per_month=(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
 
sub SerialNum_next($)
{
   # A routine to guess the human format of the serial number and come up with
   # the next one.  The minimal rule here is that the returned value will be
   # no matter what, greater than the previous one.
   # We are allowed 9 digits in base 10.
   my $SN = shift;
 
   my ($sec,$min,$hour,$MDay,$Month,$Year,$WDay,$YDay,$isDST)=localtime;
 
   #Try YEAR-MONTH-DayOfMonth-Rev

lib/CfgTie/TieRCService.pm  view on Meta::CPAN

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
sub FETCH
{
   my $self=shift;
   my $key = shift;
   return $Services{$key};
}
 
sub trx {CfgTie::Cfgfile::trx(@_);}
sub table {CfgTie::Cfgfile::table(@_);}
sub num2chk($)
{
   my @Ret;
   foreach my $I (@{$_[0]})
    {
       if ($I)
         {push @Ret, "<font face=\"Wingdings\">x</font>";}
        else
         {push @Ret, "<font face=\"Wingdings\"> </font>";}
    }
}

lib/CfgTie/TieRCService.pm  view on Meta::CPAN

202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
    foreach my $I (sort keys %Services)
     {$A.= trx("<a href=\"runlevel/$I\">$I</a>",@{$Services{$I}->{levels}});}
 
   table("Run levels",
   "<tr><th>Service</th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th>".
   "<th>5</th><th>6</th><th>7</th><th>8</th><th>9</th></tr>\n$A",11);
}
 
 
sub proc_sig($$)
{
   my $pid = proc_id($_[0]);
 
   if (defined $pid)
     {
        kill $_[1], $pid;
        return 1;
     }
    return -1;
}
 
sub scan_for_script($$)
{
   my ($serv, $path) = @_;
   $FNum++;
   opendir FNum, $path;
   my @RCfiles = grep {/^$serv$/} (readdir(FNum));
   closedir FNum;
   if (!scalar @RCfiles) {return;}
   my ($R) = @RCfiles;
   $R;
}
 
sub scan_rcscript($)
{
   my $self=shift;
   my $F = new Secure::File "<".$self->{'path'};
   while (<$F>)
    {
       if (/^\s*\#\s*chkconfig\s*:\s*(\d+)/i)
         {
            my @A=(0,0,0,0,0,0,0,0,0,0);
            for (my $I=0; $I< length $1; $I++)
             {$A[substr($1,$I,1)]=1;}

lib/CfgTie/TieRCService.pm  view on Meta::CPAN

266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
{
   my ($self,$name,$levels)=@_;
   my $Node =
        {
            levels=>$levels,'name'=>$name,
        };
 
   return bless $Node, $self;
}
 
sub proc_id($)
{
   my $key = shift;
 
   if (!defined $key || !-e "/var/run/$key.pid") {return undef;}
 
   #use the canonically process ID
   my $F = new Secure::File "</var/run/$key.pid" or return undef;
   my ($I,$pid);
   while (<$F>)
    {
       if (/^(\d+)$/) {$pid=$1;}
    }
   $F->close;
   return $pid;
}
 
sub _stat($)
{
   my $self=shift;
   if (!defined $self) {return undef;}
   return stat("/var/run/".$self->{'name'}.".pid");
}
 
sub EXISTS ($$)
{
   my ($self,$key)=@_;
   my $lkey=lc($key);

lib/CfgTie/TieRCService.pm  view on Meta::CPAN

508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
            "   my \$self = shift;\n".
            "   delete \$self->{pid};\n".
            "   delete \$self->{'stat'};\n".
            "   if (exists \$self->{path})\n".
            "     {return system(\$self->{path}.\" $I\");}\n".
            "}\n\n";
    }
   eval $X;
}
 
sub reload($)
{
   my $self=shift;
   delete $self->{pid};
   delete $self->{status};
   if (-x "/usr/sbin/".$self->{'name'}.".reload")
     {
        return system("/usr/sbin/".$self->{'name'}.".reload");
     }
    else
     {

lib/CfgTie/TieUser.pm  view on Meta::CPAN

230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
=head1 Author
 
Randall Maas (L<randym@acm.org>)
 
=cut
 
my $Chg_FS = 1; #By default we want to update the file system when the user
# Id changes
 
sub stat($)
{
  # the information for the /etc/passwd file
  stat '/etc/passwd';
}
 
sub TIEHASH
{
   my $self = shift;
   my $node = {};
   return bless $node, $self;

lib/CfgTie/TieUser.pm  view on Meta::CPAN

314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
   my $name = shift;
 
   #Basically delete the user now.
   CfgTie::filver::system("$CfgTie::TieUser_rec'userdel $name");
 
   #Remove it from our cache
   if (exists $CfgTie::TieUser_rec'by_name{$name})
     {delete $CfgTie::TieUser_rec'by_name{$name};}
}
 
sub HTML($$)
{
   my ($self,$CodeRef)=@_;
   my %A;
   for (my $I=FIRSTKEY($self); $I; $I=NEXTKEY($self,$I))
    {
       my $U=FETCH($self,$I);
       #See if the caller wants us to pass
       if (defined $CodeRef && !&$CodeRef($U)) {next;}
       $A{$I} = CfgTie::Cfgfile::trx(
                "<a href=\"user/$I\">$I</a>",

lib/CfgTie/TieUser.pm  view on Meta::CPAN

336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
                "<a href=\"mailto:$I\">$I</a>"
                );
    }
   my $Us;
   foreach my $I (sort keys %A) {$Us.=$A{$I};}
   CfgTie::Cfgfile::table('Users',
        "<th class=\"cfgattr\">login</th><th class=\"cfgattr\">Full Name</th>".
         "<th class=\"cfgattr\">mailto:</th></tr>\n".$Us, 3);
}
 
sub add_scalar($$)
{
   my ($name,$package) =@_;
   $name=lc($name);
   $CfgTie::TieUser_rec::SDelegates->{$name}=$package;
}
 
sub add_hash($$)
{
   my ($name,$package) =@_;
   $name=lc($name);
   $CfgTie::TieUser_rec::HDelegates->{$name}=$package;
}
 
 
sub status
{

lib/CfgTie/TieUser.pm  view on Meta::CPAN

512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
   #while ($a = scalar each %{$EKeys})
   # {
   #    if (exists $self->{$a}) {next;}
   #    return $a;
   # }
   return $a;
}
 
#Modified from PERL Cookbook:
my $lastlog_fmt="L a16 A16"; #on sunos "L A8 A16"
sub lastlog_FETCH($)
{
   use User::pwent;
   use IO::Seekable qw(SEEK_SET);
 
   my $LASTLOG= new Secure::File "</var/log/lastlog";
   return unless defined $LASTLOG;
 
   my $User = shift;
   my $U = ($User =~ /^\d+$/) ? getpwuid($User) : getpwnam($User);
   if (!$U) {goto ret_from_here;}

lib/CfgTie/TieUser.pm  view on Meta::CPAN

703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
        }
   else
        {
           #Just remove our local copy
           delete $self->{$lkey};
        }
}
 
sub trx {CfgTie::Cfgfile::trx(@_);}
 
sub HTML($)
{
   # A routine to HTMLize the user
   my $self=shift;
 
   my %Keys2 = map {$_,1} (keys %{$self});
   $Keys2{'last'}=1;
 
   delete $Keys2{gcos};
   delete $Keys2{name};
   delete $Keys2{id};

lib/CfgTie/TieUser.pm  view on Meta::CPAN

778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
  {
     #Add the quota stuff in
     $CfgTie::TieUser_rec::HDelegate{'usage'}='CfgTie::TieUser_quota_usage';
     $CfgTie::TieUser_rec::HDelegate{'limits'}='CfgTie::TieUser_quota_limits';
     $CfgTie::TieUser_rec::HDelegate{'timeleft'}='CfgTie::TieUser_quota_timeleft';
    }
 
my $DB={usage=>{},timeleft=>{},limits=>{}};
1;
 
sub Query($$)
{
   #A wrapper around the Quota::query routine... converts into our internal
   #usage form
 
   my ($uid,$dev) = @_;
 
   #Get the information
   my ($Block_Curr, $Block_Soft, $Block_Hard, $Block_TimeLeft,
       $INode_Curr, $INode_Soft, $INode_Hard, $INode_TimeLeft) =
         Quota::query($dev,$uid);

lib/CfgTie/TieUser.pm  view on Meta::CPAN

831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
     
 
   if (exists $DB->{$key} && exists $DB->{$key}->{$self->{uid}}->{$dev})
   {
       return $DB->{$key}->{$self->{uid}}->{$dev};
   }
   undef;
}
 
sub new(@_)     {TIEHASH(@_);}
sub TIEHASH     {return bless {uid=>$_[1]}, $_[0];}
sub EXISTS ($$) {CfgTie::TieUser_quota::Exists($_[0],'limits',$_[1]);}
sub FETCH ($$)  {CfgTie::TieUser_quota::Fetch($_[0],'limits',$_[1]);}
 
sub STORE ($$)
{
   my ($self,$key,$val)=@_;
 
   #Convert the path into q form that can be used in a query
   #(The representation will vary with each system)
   #The key is the path
   my $dev = Query::getqcarg($key);
   
   #clear out the keys
   delete $limits{$self->{uid}};
 
   Quota::setqlim($dev, $self->{uid}, @{$val});
}
 
sub new(@_)     {TIEHASH(@_);}
sub TIEHASH     {return bless {uid=>$_[1]}, $_[0];}
sub EXISTS ($$) {CfgTie::TieUser_quota::Exists($_[0],'usage',$_[1]);}
sub FETCH ($$)  {CfgTie::TieUser_quota::Fetch ($_[0],'usage',$_[1]);}
 
sub new(@_)     {TIEHASH(@_);}
sub TIEHASH     {return bless {uid=>$_[1]}, $_[0];}
sub EXISTS ($$) {CfgTie::TieUser_quota::Exists($_[0],'timeleft',$_[1]);}
sub FETCH ($$)  {CfgTie::TieUser_quota::Fetch ($_[0],'timeleft',$_[1]);}
 
@ISA=qw(CfgTie::Cfgfile);
 
sub files
{

lib/CfgTie/TieUser.pm  view on Meta::CPAN

910
911
912
913
914
915
916
917
918
919
920
921
922
923
                 'passwd' =>$x[1],
                 'id'     =>$x[2],
                 'members'=>[split(/(?:\s+|\,)/, $x[3])]
              };
         }
   }
 
   $F->close;
}
 
sub format($$)
{
   "$_[1]: ".join(',',@{$_[1]})."\n";
}

lib/CfgTie/filever.pm  view on Meta::CPAN

165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
  if (!defined $Num) {$Num = $RollDepth;}
 
  if ($Num < 1) {return;}
 
  my $Base = $File.$Sep;
  rename $Base.'1',$File;
  for (my $I=1; $I < $RollDepth; $I++)
   {rename $Base.($I+1),$Base.$I;}
}
 
sub RCS_path($$)
{
   my ($RCSObj, $Path) = @_;
   if ($Path =~ /^(.+)\/([^\/]+)$/)
     {
        $RCSObj->workdir($1);
        $RCSObj->file($2);
 
        #Make the working directory and archive directory make sense
        my $t = $RCSObj->rcsdir;
        if (!defined $t || (substr($t,0,1) ne '/' && substr($1,0,1) ne '.'))

lib/CfgTie/filever.pm  view on Meta::CPAN

187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
     }
    else
     {
        $RCSObj->file($Path);
     }
}
 
 
sub open($)
{
   local($name)=@_;
   #Save the environment so we can restore it
   my $E=\%ENV;
 
   #Erase the path, and other environment information
   %ENV=();
   $ENV{'PATH'}='/bin:/sbin';
   my $F=eval ('new FileHandle $name');
 
   #Restore the environment
   %ENV=%{$E};
   $F;
}
 
sub system($)
{
   my $F= &filever::open($_[0]."|");
   $F->close;
}
 
 
my @UID_paths; # Holder of file paths that match
 
sub UID_worker
{

lib/Secure/File.pm  view on Meta::CPAN

106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
     }
   return 0 unless @S;
   if ($self->handle_check(@S))
     {
        return $self;
     }
   $self->close();
   return 0;
}
 
sub open_precheck($$)
{
   my $name=shift;
   if ($name =~ /^<\s*([^\s]+)$/)
        {
           r_check($1);
        }
   elsif ($name =~ /^>\s*([^\s]+)$/)
        {
           w_check($1);
        }



( run in 0.310 second using v1.01-cache-2.11-cpan-55f5a4728d2 )