![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with ssh or loop (can anyone know the issue) | kittusri9 | Shell Programming and Scripting | 2 | 05-08-2008 04:32 AM |
| issue with if loop in perl | amitrajvarma | Shell Programming and Scripting | 4 | 01-08-2008 08:02 PM |
| perl problem - why isn't 'die' being called? | mjays | Shell Programming and Scripting | 4 | 08-13-2007 10:16 PM |
| perl help with pipes and file handles (simple issue) | the_learner | Shell Programming and Scripting | 1 | 05-06-2007 02:34 AM |
| Perl problem (compiling issue) | 01000101 | Shell Programming and Scripting | 3 | 05-24-2006 07:15 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
perl problem - another 'die' issue.
two things.
Code:
if (! -d "$logdir") {
use File::Path;
mkpath "$logdir" || die ("ERROR: release log directory creation failed - $logdir: $!\n");
print "\nINFO: Directory created - $logdir\n";
}
Code:
the result: mkdir /build/cm_test_sharee: Permission denied at ./crm.prl line 122 |
| Forum Sponsor | ||
|
|
|
|||
|
If you look at the error more carefully, it is generated by mkpath(), not yours.
From the File::Path manpage: Quote:
|
|
|||
|
i've now changed the code and it works fine.
Code:
if (! -d "$logdir") {
use File::Path;
eval { mkpath($logdir) };
if ($@) {
print "\nERROR: release log directory creation failed - $logdir: $!\n";
exit;
}
Code:
[ -d ${LOGDIR} ] || mkdir -p ${LOGDIR} || { echo "\nERROR: release log directory creation failed - ${LOGDIR}"; exit 1; }
|
|
|||
|
Quote:
Don't you think the perl one you wrote looks a bit more descriptive? Using a module, you have to accept that different modules have different behaviour. That is normal. This is just like the '-c' switch of one command and that of another command means totally different things, and you must accept that. Learning a new thing, you cannot always expect your knowledge of another environment can translate well to it. Perl is a full-blown programming language, and programs naturally need some structure so that no matter you are writing a 30-line or 30000-line program it will still be a manageable piece. |
|
|||
|
Quote:
Quote:
|
|||
| Google The UNIX and Linux Forums |