Changeset 32377
- Timestamp:
- Sep 8, 2011, 3:05:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20110622/PS-IPP-Config/lib/PS/IPP/Config.pm
- Property svn:mergeinfo set to
r30744 r32377 20 20 use Getopt::Long 2.33 qw( GetOptions :config gnu_getopt pass_through ); # Set pass_through so we don't kill @ARGV 21 21 use IPC::Cmd 0.36 qw( can_run run ); 22 use POSIX qw( strftime ); 22 23 23 24 use base qw( Exporter Class::Accessor::Fast ); … … 40 41 metadataLookupBool 41 42 metadataLookupS32 43 metadataLookupF32 42 44 caturi 43 45 file_scheme … … 691 693 } 692 694 695 696 693 697 # redirect stderr and stdout streams to a file 694 698 sub redirect_output … … 721 725 722 726 return 1; 727 } 728 729 # redirect stderr and stdout streams to log file. If file already exists rename it and record 730 # the name in the new log file. 731 sub redirect_to_logfile { 732 my $self = shift; 733 my $name = shift; 734 735 my $tstring = strftime "%Y%m%dT%H%M", gmtime; 736 737 my $old_name; 738 my $scheme = file_scheme($name); 739 if ($scheme eq 'neb') { 740 my $neb = $self->nebulous; 741 if ($neb->storage_object_exists($name)) { 742 eval { 743 $old_name = "$name.$tstring"; 744 $neb->move($name, $old_name); 745 }; 746 if ($@) { 747 carp "nebulous move failed for $name"; 748 return undef; 749 } 750 } 751 } else { 752 if ($self->file_exists($name)) { 753 my $resolved = $self->file_resolve($name); 754 $old_name = "$resolved.$tstring"; 755 if (!rename($resolved, $old_name)) { 756 carp "Failed to rename $resolved $old_name"; 757 return undef; 758 } 759 } 760 } 761 my $result = $self->redirect_output($name); 762 if ($result and $old_name) { 763 print "\nPrevious log file moved to $old_name\n"; 764 } 765 return $result; 723 766 } 724 767 … … 1576 1619 } 1577 1620 1621 # Lookup the metadata, checking the type is F32 1622 sub metadataLookupF32 1623 { 1624 my $item = metadataLookup(@_); 1625 return undef if not defined $item; 1626 my $name = shift; # Name of item 1627 carp "$name within metadata is type $item->{type} not F32.\n" unless $item->{type} eq "F32"; 1628 return $item->{value}; 1629 } 1630 1578 1631 # Lookup the metadata, checking the type is MD 1579 1632 sub metadataLookupMD
Note:
See TracChangeset
for help on using the changeset viewer.
