Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: (tye)Re: use Fatal;

by Anonymous Monk
on Jan 10, 2002 at 05:31 UTC ( #137647=note: print w/replies, xml ) Need Help??

in reply to (tye)Re: use Fatal;
in thread use Fatal;

Another problem with the current version is that it only overrides the given functions in the current package, so all modules and embedded packages must also use it to get the functionality you might want.

#!/usr/bin/perl -w use strict; use Fatal qw/open close/; package Foo; #use Fatal qw/open close/; sub bar { open(FILE,'dfdsadf'); close FILE; } package main; Foo::bar();

It should at least be a lexically scoped pragma so the above would be fatal without reissuing the use statement. I'm not sure how it could be made to globally overide such functions in all used packages.

Replies are listed 'Best First'.
(tye)Re2: use Fatal;
by tye (Sage) on Jan 10, 2002 at 05:36 UTC

    That is what *CORE::GLOBAL::open= coderef is for. And if it only makes things fatal when in a void context, then this shouldn't be much of a problem for module code that doesn't know whether the user might use this or not.

    You can write code that would break in such cases but I don't consider such code to be reasonable so I don't mind. (:

    open( FILE, "< this.txt" ); warn "Can't read this.txt: $!\n" unless defined fileno FILE;

            - tye (but my friends call me "Tye")

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://137647]
[Lady_Aleena]: marioroy, my @music_times = qx(find ~/Music/Albums/ -type f -iname '*.mp3' -exec mp3info -p "%S\n" {} \;); #unfixed
shmem doesn't have mp3info, but mp3info2 - which is a perl script ;-)
[marioroy]: my @music_times = qx(find \$HOME/Music/ Albums/ -type f -iname '*.mp3' -exec mp3info -p "%S\\\n" {} \\;);
[marioroy]: might need 2 or 3 backslash for \n. Also \\;
[Lady_Aleena]: shmem, there is MP3::Info/
[Discipulus]: too much complex qx when you know perl are better to avoid
[marioroy]: might need to backslash \'*.mp3\'
[marioroy]: It's a quoting issue inside qx. It's File::Find or qx. LA chooses qx. Almost there.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2017-04-23 21:14 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.