output :
if you want to give input as numbers only , you can remove # from the lines starting with # from if condition.
otherwise, you get this warning message "Argument "" isn't numeric in sort at try.pl line 23, <STDIN> line ."
you can ignore this.
Ok, I am thinking about developing a small little web app to help teach C to people. So you can type some C code into a text area, then a CGI Perl script or something similar would compile the code, then possibly execute it showing the results in another text area.
My concern of course is... (1 Reply)
if anyone knows how to do the loop and the function listed, please let me know it would be a great help. Thanks!
•Create an array NUM with the following ten values in it:
14, 25.6, 43, 22, 412.14, 819, 2, 721, 7.218, 11.9
•Print the array NUM
•Create an array COLOR with the following... (1 Reply)
I have 2 files , one is master file and another file i am genearting which contains Number of fails for all host & version.
The first file is master file which contains 2 column, Test Case name and Product Name:
daily/DB/attach/attach_redundancy.exp: YRS
daily/DB/help/help.exp: ... (0 Replies)
Is there a way to see or print a sub code?
Sometime a sub could be already defined, but in the debug mode (so, interactively) it could be already out of screen.
So, I would think about a way to check if the sub is defined (just 'defined' is not a problem) and how it is defined.
Also, if... (4 Replies)
Hi,
plz see the below code , i have catch the file "Orders.20110714.out "file
as a Orders*.out. but it giving me an error .it does not open the file.
if the same thing i have done by code
code-> ls Orders*.out then it gives me the output
Orders.20110714.out
i am trying apply the... (1 Reply)
Hi
Please read the below information carefully and help me to solve the issue .
I want to know ,how to catch the word before perticular word using perl code??
Eg:
if the row contains
===========================
Original Order Tuple
Duplicatel Execution Tuple
... (1 Reply)
What is the meaning of below code, which is capturing from one file .
$runDate = $1 if $str =~ m/,"TransactTime":"({10})/; # get transaction date as run date
Is it the date from the first line of file or last line of file??? (Note:Each line from the file contains date) (2 Replies)
i'm using the below perl code to get a list of ips:
my @allipsfound ;
for my $elem (@gatches) {
my ($ip) = split ":",$elem;
print "$ip \n";
}
it spits out several lines of ips. most of those ips are the same. how do i do sort and uniq in the above code to make it so that it only... (3 Replies)
Discussion started by: SkySmart
3 Replies
LEARN ABOUT MOJAVE
extutils::packlist
ExtUtils::Packlist(3pm) Perl Programmers Reference Guide ExtUtils::Packlist(3pm)NAME
ExtUtils::Packlist - manage .packlist files
SYNOPSIS
use ExtUtils::Packlist;
my ($pl) = ExtUtils::Packlist->new('.packlist');
$pl->read('/an/old/.packlist');
my @missing_files = $pl->validate();
$pl->write('/a/new/.packlist');
$pl->{'/some/file/name'}++;
or
$pl->{'/some/other/file/name'} = { type => 'file',
from => '/some/file' };
DESCRIPTION
ExtUtils::Packlist provides a standard way to manage .packlist files. Functions are provided to read and write .packlist files. The
original .packlist format is a simple list of absolute pathnames, one per line. In addition, this package supports an extended format,
where as well as a filename each line may contain a list of attributes in the form of a space separated list of key=value pairs. This is
used by the installperl script to differentiate between files and links, for example.
USAGE
The hash reference returned by the new() function can be used to examine and modify the contents of the .packlist. Items may be
added/deleted from the .packlist by modifying the hash. If the value associated with a hash key is a scalar, the entry written to the
.packlist by any subsequent write() will be a simple filename. If the value is a hash, the entry written will be the filename followed by
the key=value pairs from the hash. Reading back the .packlist will recreate the original entries.
FUNCTIONS
new()
This takes an optional parameter, the name of a .packlist. If the file exists, it will be opened and the contents of the file will be
read. The new() method returns a reference to a hash. This hash holds an entry for each line in the .packlist. In the case of old-
style .packlists, the value associated with each key is undef. In the case of new-style .packlists, the value associated with each key
is a hash containing the key=value pairs following the filename in the .packlist.
read()
This takes an optional parameter, the name of the .packlist to be read. If no file is specified, the .packlist specified to new() will
be read. If the .packlist does not exist, Carp::croak will be called.
write()
This takes an optional parameter, the name of the .packlist to be written. If no file is specified, the .packlist specified to new()
will be overwritten.
validate()
This checks that every file listed in the .packlist actually exists. If an argument which evaluates to true is given, any missing
files will be removed from the internal hash. The return value is a list of the missing files, which will be empty if they all exist.
packlist_file()
This returns the name of the associated .packlist file
EXAMPLE
Here's "modrm", a little utility to cleanly remove an installed module.
#!/usr/local/bin/perl -w
use strict;
use IO::Dir;
use ExtUtils::Packlist;
use ExtUtils::Installed;
sub emptydir($) {
my ($dir) = @_;
my $dh = IO::Dir->new($dir) || return(0);
my @count = $dh->read();
$dh->close();
return(@count == 2 ? 1 : 0);
}
# Find all the installed packages
print("Finding all installed modules...
");
my $installed = ExtUtils::Installed->new();
foreach my $module (grep(!/^Perl$/, $installed->modules())) {
my $version = $installed->version($module) || "???";
print("Found module $module Version $version
");
print("Do you want to delete $module? [n] ");
my $r = <STDIN>; chomp($r);
if ($r && $r =~ /^y/i) {
# Remove all the files
foreach my $file (sort($installed->files($module))) {
print("rm $file
");
unlink($file);
}
my $pf = $installed->packlist($module)->packlist_file();
print("rm $pf
");
unlink($pf);
foreach my $dir (sort($installed->directory_tree($module))) {
if (emptydir($dir)) {
print("rmdir $dir
");
rmdir($dir);
}
}
}
}
AUTHOR
Alan Burlison <Alan.Burlison@uk.sun.com>
perl v5.18.2 2013-11-04 ExtUtils::Packlist(3pm)