What are the pros & cons, if any, between using Perl's copy module vs OS's system cp, for copying a file to another directory? Or are they exactly the same?
1) Perl's File::Copy module, as in
2)
PS. Sorry if this is already discussed in other/older threads.
Thanks.
Last edited by Scott; 01-01-2010 at 01:32 PM..
Reason: Please use code tags
Hi,
- on a solaris box what is the best utility to copy a whole file system from one place to other? - the aim of the operation is to place the contents of
the whole file system to other file system within the discs
cp ? - cpio? - tar?
- what about file systemes containing symbolic links ?... (1 Reply)
Hi, i'm trying to make a system copy from one server to another (solaris 9), they have the same configuration. I've tried to create a flash archive using the flarcreate but the flash file size is 5.06 approx. and the method the flarcreate is using is CPIO and he cannot handle sizes over 4 GB.
Is... (2 Replies)
I am trying to write a script which has to copy the directory structure from my system to another system on the network. But I dont want the files to be copied.
I think I have to start with copying all subdirectories names in a directory to a system on the network.
Here's the case:
Source... (1 Reply)
Hi,
my router is my Linux embedded device.
I have system installed on HDD 4GB usb stick, part1 swap, part2 /opt , part3 data.
I need to copy my system to new HDD 8GB usb stick.
What is a way for 4GB > 4GB HDD
and what for 4GB > 8GB
As I remeber, I can copy image of my 4GB HDD usb stick... (7 Replies)
Hi
Could you please help me on this
I have folder called D:\Data in which we have 20 files coming daily and needed all 20 files to copy into D:\Target ,as i am new to PERL, i did nt know how to use this
I googled sme of the code and done the copy script,it is throwing error like we do... (1 Reply)
Dear Guy’s
By using dd command or any strong command, I’d like to copy huge data from file system to another file system
Sours File system: /sfsapp
File system has 250 GB of data
Target File system: /tgtapp
I’d like to copy all these files and directories from /sfsapp to /tgtapp as... (28 Replies)
Hi All,
I have successfully backup & restore (using tar) one of my Debian Lenny Servers.
On the restore server (standby machine), everytime i have to erase the disk & extract the tar backup.
I want to extract the tar on the running restore server on a directory for e.g /systembackup-01,... (11 Replies)
Hi
I have a shell script to copy a pattern of files from Linux to Windows Filesystem.
When i execute the below command
cp -av TOUT_05-02-13* Windows/Folder
`TOUT_05-02-13-19:02:37.tar.gz' -> `Windows/Folder/SYSOUT_05-02-13-19:02:37.tar.gz'
cp: cannot create regular file... (5 Replies)
Hello,
I am creating a new disk using the following command:
dd if=/dev/zero of=/export/home/ramdisk/0 bs=512 count=4096k
after creating the disk, i tool a ufsdump of a solaris 10 filesytem (disk size 512MB)
ufsdump -cvf /export/home/ufsdump/sol_orig /and then restored the dump files onto... (10 Replies)
Discussion started by: Zam_1234
10 Replies
LEARN ABOUT SUSE
template::base
Template::Base(3) User Contributed Perl Documentation Template::Base(3)NAME
Template::Base - Base class module implementing common functionality
SYNOPSIS
package My::Module;
use base qw( Template::Base );
sub _init {
my ($self, $config) = @_;
$self->{ doodah } = $config->{ doodah }
|| return $self->error("No 'doodah' specified");
return $self;
}
package main;
my $object = My::Module->new({ doodah => 'foobar' })
|| die My::Module->error();
DESCRIPTION
Base class module which implements a constructor and error reporting functionality for various Template Toolkit modules.
PUBLIC METHODS
new(\%config)
Constructor method which accepts a reference to a hash array or a list of "name => value" parameters which are folded into a hash. The
"_init()" method is then called, passing the configuration hash and should return true/false to indicate success or failure. A new object
reference is returned, or undef on error. Any error message raised can be examined via the error() class method or directly via the $ERROR
package variable in the derived class.
my $module = My::Module->new({ ... })
|| die My::Module->error(), "
";
my $module = My::Module->new({ ... })
|| die "constructor error: $My::Module::ERROR
";
error($msg, ...)
May be called as an object method to get/set the internal "_ERROR" member or as a class method to get/set the $ERROR variable in the
derived class's package.
my $module = My::Module->new({ ... })
|| die My::Module->error(), "
";
$module->do_something()
|| die $module->error(), "
";
When called with parameters (multiple params are concatenated), this method will set the relevant variable and return undef. This is most
often used within object methods to report errors to the caller.
package My::Module;
sub foobar {
my $self = shift;
# some other code...
return $self->error('some kind of error...')
if $some_condition;
}
debug($msg, ...)
Generates a debugging message by concatenating all arguments passed into a string and printing it to "STDERR". A prefix is added to
indicate the module of the caller.
package My::Module;
sub foobar {
my $self = shift;
$self->debug('called foobar()');
# some other code...
}
When the "foobar()" method is called, the following message is sent to "STDERR":
[My::Module] called foobar()
Objects can set an internal "DEBUG" value which the "debug()" method will examine. If this value sets the relevant bits to indicate
"DEBUG_CALLER" then the file and line number of the caller will be appened to the message.
use Template::Constants qw( :debug );
my $module = My::Module->new({
DEBUG => DEBUG_SERVICE | DEBUG_CONTEXT | DEBUG_CALLER,
});
$module->foobar();
This generates an error message such as:
[My::Module] called foobar() at My/Module.pm line 6
module_version()
Returns the version number for a module, as defined by the $VERSION package variable.
AUTHOR
Andy Wardley <abw@wardley.org> <http://wardley.org/>
COPYRIGHT
Copyright (C) 1996-2007 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Template
perl v5.12.1 2009-05-20 Template::Base(3)