Advertisement
dyeske

script or module

Sep 4th, 2020 (edited)
1,667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.48 KB | None | 0 0
  1. #!/usr/bin/env perl
  2. package Some::Name;
  3.  
  4. sub shit {
  5.     my $hs = qx("hostname");
  6.     chomp($hs);
  7.     return $hs;
  8. }
  9.  
  10. unless(caller) {
  11.   print "it is " . shit() . "\n";
  12.   exit(0);
  13. }
  14.  
  15. 1;
  16.  
  17. #!/usr/bin/env perl
  18. use Cwd 'abs_path';
  19. use File::Basename 'dirname';
  20. use constant THISDIR => dirname abs_path __FILE__;
  21. my $THISDIR;
  22. BEGIN { $THISDIR = dirname abs_path __FILE__ }
  23.  
  24. require "$THISDIR/mystuff.pl";
  25. my $str = Some::Name::shit();
  26. print "str from other file is $str\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement