Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > -p, open errors and exit status

Reply
Thread Tools

-p, open errors and exit status

 
 
Andre Majorel
Guest
Posts: n/a
 
      01-20-2004
Could you suggest a succint way to make perl exit with a non
zero-status when the file on the command line can't be opened ?

perl -i -pe 's/foo/bar/' /some/file || echo "it failed"

Ugly is okay as long as it's succint (it's in a makefile and
it's best to keep it concise).

--
André Majorel <URL:http://www.teaser.fr/~amajorel/>
Agree with them now, it will save so much time.
 
Reply With Quote
 
 
 
 
Ben Morrow
Guest
Posts: n/a
 
      01-20-2004

Andre Majorel <(E-Mail Removed)> wrote:
> Could you suggest a succint way to make perl exit with a non
> zero-status when the file on the command line can't be opened ?
>
> perl -i -pe 's/foo/bar/' /some/file || echo "it failed"
>
> Ugly is okay as long as it's succint (it's in a makefile and
> it's best to keep it concise).


The only way I can find is:

perl -i -pe'BEGIN{$SIG{__WARN__}=sub{die shift}}' -e's/foo/bar/'

.. I would have expected -MFatal=open to work, but it seems not to...

Ben

--
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Richard Gration
Guest
Posts: n/a
 
      01-20-2004
In article <bujl0o$5it$(E-Mail Removed)>, "Ben Morrow"
<(E-Mail Removed)> wrote:

> --
> For the last month, a large number of PSNs in the Arpa[Inter-]net have been
> reporting symptoms of congestion ... These reports have been accompanied by an
> increasing number of user complaints ... As of June,... the Arpanet contained
> 47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] *
> (E-Mail Removed)


I just read / skimmed this page. It made my spine tingle. Was that really
the *whole* internet?! Total Perspective Vortex or what Made me think
of the story of the fledgling internet becoming unusable due to DNS
traffic alone!
 
Reply With Quote
 
Chris Mattern
Guest
Posts: n/a
 
      01-20-2004
Richard Gration wrote:
> In article <bujl0o$5it$(E-Mail Removed)>, "Ben Morrow"
> <(E-Mail Removed)> wrote:
>
>
>>--
>>For the last month, a large number of PSNs in the Arpa[Inter-]net have been
>>reporting symptoms of congestion ... These reports have been accompanied by an
>>increasing number of user complaints ... As of June,... the Arpanet contained
>>47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] *
>>(E-Mail Removed)

>
>
> I just read / skimmed this page. It made my spine tingle. Was that really
> the *whole* internet?! Total Perspective Vortex or what Made me think
> of the story of the fledgling internet becoming unusable due to DNS
> traffic alone!


DNS? Who dat? Back then, you just kept hostnames for the entire Arpanet
in your /etc/hosts.

Chris Mattern

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Any exit status without explicitely using return /exit Keith Thompson C Programming 10 03-03-2010 12:41 AM
Re: Any exit status without explicitely using return /exit jacob navia C Programming 3 02-24-2010 02:39 PM
IE doesnt hide status bar on window.open "status=no" Ronen Yacov Javascript 1 11-05-2007 09:53 AM
In a Perl script 'exit 1' returns exit status 0! kaleem Perl Misc 8 12-14-2006 12:52 AM
Code to Exit Web App and Exit Internet Explorer =?Utf-8?B?U2FuZHk=?= ASP .Net 7 08-05-2005 01:55 AM



Advertisments