view build-aux/inplace_edit.pl @ 28245:46a23dc62056

Implement "gray" when uicontrol pushbuttons/togglebuttons are disabled (bug #57128) * BaseControl.cc (updatePalette): For pushbuttons & togglebuttons, add ":enabled" to beginning of StyleSheet specification so that custom colors are only applied when widget is active. * BaseControl.cc (init): Call blockSignals() if "Enable" property is "inactive" during setup of widget. Otherwise, call setEnabled() with value of "Enable" property. * BaseControl.cc (update): When updating "Enable" property, call blockSignals() if value is "inactive", otherwise call setEnabled().
author Rik <rik@octave.org>
date Sun, 26 Apr 2020 10:48:20 -0700
parents 8b548f2f8086
children
line wrap: on
line source

#!/usr/bin/perl -w

################################################################################
## File: inplace_edit.pl
## Usage: perl inplace_edit.pl 'PERL_CODE' file1 [file2] [...]
## Purpose: Run snippet of PERL_CODE on each line in a file and replace
## existing line with the results of running the code.
## This replaces perl -i -pe 'PERL_CODE' file1 [file2] ...
## due to a problem in Perl 5.28 which restricts the number of files
################################################################################

## Create Perl code from first argument (-e CODE)
eval "sub per_line_code { $ARGV[0]; }";
shift @ARGV;

## Loop over each file
foreach $fname (@ARGV)
{
  rename ($fname, "$fname.$$") or die "Rename failed:$fname:$!";
  open (my $FHI, "<", "$fname.$$") or die "Open failed:$fname.$$:$!";
  open (my $FHO, ">", "$fname") or die "Open failed:$fname:$!";

  ## Loop over each line
  while (<$FHI>)
  {
    per_line_code ();
    print $FHO $_;
  }

  close ($FHI);
  close ($FHO);
  unlink "$fname.$$" or die "Delete failed:$fname.$$:$!";
}