Ok here is why I ask. I can write a shell script to do most things, but perl can do more so I am learning perl. To get file stats in bash is simply combine ls, grep and cut to get whatever I want. But perl has a function to do this called stats()
Rather than use stats() and have to figure out how that works I could get what I want by using bash and simply wrapping that in the system() command in perl, but that would not really be teaching me anything. So instead I figured out how to use stats(). Now as for getting partition info I wanted to know if perl had a way of getting the info. From what I can tell the simply answer is no. There are however several modules on CPAN that have been written to get the info required, but it appears that all of them are simply wrappers for the df command which I can do on my own, and at least bring my perl up another minor notch in the doing. My thanks to Lawrence Statton XE2/N1GAK [EMAIL PROTECTED] for the link to CPAN http://search.cpan.org/search?query=disk+space+DF&mode=all Thank you Tom for the effort By the way, since we are all on the beginners perl list, there is no reason to CC me on the emails. If you send it to the list I will get it. If you CC me I will get the reply twice. Thanks again Tony > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Phoenix > Sent: Monday, February 05, 2007 12:43 PM > To: [EMAIL PROTECTED] > Cc: beginners@perl.org > Subject: Re: stats on partitions > > On 2/5/07, Tony Heal <[EMAIL PROTECTED]> wrote: > > > OK, so bash is the shell I am using and the df utility is a > > standard Xnix command. My question is, is there a perl way > > of getting the stats on partitions without having to shell out > > using system() or exec()? > > Well, this is not unlike asking if there's a way to get a hot meatloaf > out of the oven without having to put on oven gloves. But yes, you > could write Perl code (perhaps with a little XS to handle a system > call or two; I'm not sure) to do what df does. It probably won't be as > fast, secure, portable, or easy to write as using system() to invoke > df, but on the plus side you'll get to debug it all yourself. And > since it has to run with special privileges, you might even break > something important along the way, or open a security hole without > realizing it. > > Is there some reason you can't use oven gloves? I mean df? > > Cheers! > > --Tom Phoenix > Stonehenge Perl Training > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/