[Pdx-pm] mkdir -p ?

Austin Schutz tex at off.org
Fri Aug 24 12:49:37 PDT 2007


On Fri, Aug 24, 2007 at 08:28:26PM +0200, A. Pagaltzis wrote:
> * Roderick A. Anderson <raanders at acm.org> [2007-08-24 19:20]:
> > 	qx{ /bin/mkdir -p path/that/was/needed }
> 
> That sets up the whole STDOUT-capture machinery and then stuffs
> the (usually empty) output in a temporary scalar…
> 
> … just to throw it all away.
> 
> More direct:
> 
>     system qw( /bin/mkdir -p path/that/was/needed );
> 
> More importantly, `system LIST` has no issues with quoting, which
> `qx` is susceptible to.
> 

	To echo Eric's comment: "and check the return code, right?"

	When you do the work of making sure the directory has been
successfully created and accurately handling errors you've probably reached
the point where it's worth using a module- all that work is done for you.

	..but if it works for you.. *shrug*.

	Austin


More information about the Pdx-pm-list mailing list