10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
I'm trying to sort out the charing of a problem folder, in the 'ls -l' list is shows as:
d???????????? ? ? ? ? ? Pi-Share
PiShare is the name of the directory, all the ??s make no sense to me at all, and no user (there are only two, pi and root) can make any changes to it.... (4 Replies)
Discussion started by: MuntyScrunt
4 Replies
2. Shell Programming and Scripting
Hi one of the output of the command is as below
# sed -n "/CCM-ResourceHealthCheck:/,/---------/{/CCM-ResourceHealthCheck:/d;/---------/d;p;}" Automation.OutputZ$zoneCounter | sed 's/$/<br>/'
Resource List : <br>
*************************** 1. row ***************************<br>
... (2 Replies)
Discussion started by: vivek d r
2 Replies
3. AIX
SOS Guys...
Is there any way to determine the user attributes, mainly if that userid is set as never expire?
I do not have admin rights, and I'm working on AIX 5.3
I've tried :
lsuser -f <username>
but no luck on that (2 Replies)
Discussion started by: freakygs
2 Replies
4. UNIX for Advanced & Expert Users
Hi Gurus,
I am trying to create a FS using SVM but system is throwing the following error.
newfs /dev/md/rdsk/d1002
newfs: construct a new file system /dev/md/rdsk/d1002: (y/n)? y
/usr/sbin/clri: can't get execution attributes (1 Reply)
Discussion started by: rama krishna
1 Replies
5. AIX
Guys
Is there a way to determine the attributes of the disks installed in a system p box through HMC? (Like disk type and capacity)
Thanks in advance
Bala (2 Replies)
Discussion started by: balaji_prk
2 Replies
6. UNIX for Dummies Questions & Answers
I got a server (test server) that hangs anytime we run a ls attribute like ls -ltr or ls -al. We can run ls | more command with no problem. But getting back to the ls attribute problem, it just sits and hangs, I did a ps -ef | grep ls, and a user had 15 sessions of ls -al running, I killed those,... (3 Replies)
Discussion started by: Sarccastik Dude
3 Replies
7. Shell Programming and Scripting
How to retrieve file attributes in a sh/bash script (modification time, access time, size, etc.)? (1 Reply)
Discussion started by: Hitori
1 Replies
8. UNIX for Dummies Questions & Answers
hi,
i am very- very new to unix
i have os - sun solaris 5.9 and i want to learn more about system attributes for example, the make - model of machine , operating system & patch versions
can somebody tell me a usefull command to learn these?
any help would be apreciated,
regards to all,... (3 Replies)
Discussion started by: merope
3 Replies
9. Shell Programming and Scripting
how do we set file attributes at shell prompt (2 Replies)
Discussion started by: hytechpro
2 Replies
10. Shell Programming and Scripting
Good day
Does anyone have an idea on how I can rcp a file together with its attributes. owner,group, permissions ?
Regards
J (2 Replies)
Discussion started by: jhansrod
2 Replies
IO::Capture::Stdout(3pm) User Contributed Perl Documentation IO::Capture::Stdout(3pm)
NAME
IO::Capture::Stdout - Capture any output sent to STDOUT
SYNOPSIS
# Generic example (Just to give the overall view)
use IO::Capture::Stdout;
$capture = IO::Capture::Stdout->new();
$capture->start(); # STDOUT Output captured
print STDOUT "Test Line One
";
print STDOUT "Test Line Two
";
print STDOUT "Test Line Three
";
$capture->stop(); # STDOUT output sent to wherever it was before 'start'
# In 'scalar context' returns next line
$line = $capture->read;
print "$line"; # prints "Test Line One"
$line = $capture->read;
print "$line"; # prints "Test Line Two"
# move line pointer to line 1
$capture->line_pointer(1);
$line = $capture->read;
print "$line"; # prints "Test Line One"
# Find out current line number
$current_line_position = $capture->line_pointer;
# In 'List Context' return an array(list)
@all_lines = $capture->read;
# More useful example 1 - "Using in module tests"
# Note: If you don't want to make users install
# the IO::Capture module just for your tests,
# you can just install in the t/lib directory
# of your module and use the lib pragma in
# your tests.
use lib "t/lib";
use IO::Capture::Stdout;
use Test::More;
my $capture = IO::Capture::Stdout->new;
$capture->start
# execute with a bad parameter to make sure get
# an error.
ok( ! $test("Bad Parameter") );
$capture->stop();
DESCRIPTION
The module "IO::Capture::Stdout", is derived from the abstract class "IO::Capture". See IO::Capture. The purpose of the module (as the
name suggests) is to capture any output sent to "STDOUT". After the capture is stopped, the STDOUT filehandle will be reset to the previ-
ous location. E.g., If previously redirected to a file, when "IO::Capture->stop" is called, output will start going into that file again.
Note: This module won't work with the perl function, system(), or any other operation
involving a fork(). If you want to capture the output from a system command,
it is faster to use open() or back-ticks.
my $output = `/usr/sbin/ls -l 2>&1`;
METHODS
new
o Creates a new capture object.
o An object can be reused as needed, so will only need to do one of these.
o Be aware, any data previously captured will be discarded if a new capture session is started.
start
o Start capturing data into the "IO::Capture" Object.
o Can not be called on an object that is already capturing.
o Can not be called while STDOUT tied to an object.
o "undef" will be returned on an error.
stop
o Stop capturing data and point STDOUT back to it's previous output location I.e., untie STDOUT
read
o In Scalar Context
o Lines are read from the buffer at the position of the "line_pointer", and the pointer is incremented by one.
$next_line = $capture->read;
o In List Context
o The array is returned. The "line_pointer" is not affected.
@buffer = $capture->read;
o Data lines are returned exactly as they were captured. You may want to use "chomp" on them if you don't want the end of line charac-
ter(s)
while (my $line = $capture->read) {
chomp $line;
$cat_line = join '', $cat_line, $line;
}
line_pointer
o Reads or sets the "line_pointer".
my $current_line = $capture->line_pointer;
$capture->line_pointer(1);
SUB-CLASSING
Adding Features
If you would like to sub-class this module to add a feature (method) or two, here is a couple of easy steps. Also see IO::Capture::Over-
view.
1 Give your package a name
package MyPackage;
2 Use this "IO::Capture::Stdout" as your base class like this:
package MyPackage;
use base qw/IO::Capture::Stdout/;
3 Add your new method like this
package MyPackage;
use base qw/IO::Capture::Stdout/;
sub grep {
my $self = shift;
for $line (
}
See Also
IO::Capture::Overview
IO::Capture
IO::Capture::Stderr
AUTHORS
Mark Reynolds reynolds@sgi.com
Jon Morgan jmorgan@sgi.com
COPYRIGHT
Copyright (c) 2003, Mark Reynolds. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under
the same terms as Perl itself.
perl v5.8.8 2007-07-30 IO::Capture::Stdout(3pm)