HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Error redirect + Perl
Operating System - HP-UX
1833997
Members
4943
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2007 11:01 PM
04-26-2007 11:01 PM
Error redirect + Perl
Hi,
I facing one issue, i want to redirect the output of one query to log file.
Let say
i am executing one database query in perl and by any reason query get failed so i want that what ever error message comes it will redirect to one file.
for example:
$bth->execute(); if this failed its throwing error on screen but i want to redirect error in one file so that latter i came to know what happened.
I facing one issue, i want to redirect the output of one query to log file.
Let say
i am executing one database query in perl and by any reason query get failed so i want that what ever error message comes it will redirect to one file.
for example:
$bth->execute(); if this failed its throwing error on screen but i want to redirect error in one file so that latter i came to know what happened.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2007 11:06 PM
04-26-2007 11:06 PM
Re: Error redirect + Perl
Hey
CHeck this page:
http://www.perl.com/pub/a/1999/10/DBI.html
$sth->execute($lastname) # Execute the query
or die "Couldn't execute statement: " . $sth->errstr;
Regards
CHeck this page:
http://www.perl.com/pub/a/1999/10/DBI.html
$sth->execute($lastname) # Execute the query
or die "Couldn't execute statement: " . $sth->errstr;
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2007 11:22 PM
04-26-2007 11:22 PM
Re: Error redirect + Perl
but still it will throw some error lines on screen and that i dont want as while script is running it should not come
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2007 12:57 AM
04-27-2007 12:57 AM
Re: Error redirect + Perl
Nothign much to do with perl.
You just have to manage STDERR.
For example with normal command line redirection:
$ perl -le 'print "Hello"; print STDERR "Boom"; print "World"'
Hello
Boom
World
$ perl -le 'print "Hello"; print STDERR "Boom"; print "World"' 2> error.log
Hello
World
Or from within the program
$ perl -le 'open STDERR,">error.log"; print "Hello"; print STDERR "Boom"; print "World"; die "Done"'
Hello
World
$ cat error.log
Boom
Done at -e line 1.
hth,
Hein.
You just have to manage STDERR.
For example with normal command line redirection:
$ perl -le 'print "Hello"; print STDERR "Boom"; print "World"'
Hello
Boom
World
$ perl -le 'print "Hello"; print STDERR "Boom"; print "World"' 2> error.log
Hello
World
Or from within the program
$ perl -le 'open STDERR,">error.log"; print "Hello"; print STDERR "Boom"; print "World"; die "Done"'
Hello
World
$ cat error.log
Boom
Done at -e line 1.
hth,
Hein.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP