Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: How do I test a script that doesn't have a .pl extension

by Khen1950fx (Canon)
on Nov 02, 2012 at 03:41 UTC ( #1001911=note: print w/ replies, xml ) Need Help??


in reply to How do I test a script that doesn't have a .pl extension

I used Module::Loaded:

#!/usr/bin/perl BEGIN { $| = 1; $^W = 1; eval { use strict; use warnings; use Module::Loaded; my $script = mark_as_loaded('foo'); my $loc = is_loaded('foo'); }; } use strict; use warnings; use Module::Loaded; use Test::More tests => 1; require foo; require_ok('foo');


Comment on Re: How do I test a script that doesn't have a .pl extension
Download Code
Replies are listed 'Best First'.
Re^2: How do I test a script that doesn't have a .pl extension
by Anonymous Monk on Nov 12, 2012 at 03:43 UTC

    I used Module::Loaded

    You failed. A .pl file is not a module, you shouldn't treat it as a module.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001911]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2015-07-31 17:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls