Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Aug 2000
Posts: 335
Member
Member
Offline
Joined: Aug 2000
Posts: 335
Thanks smile

I was declaring the variable using "my" within the package, which I suppose hid it from being referenced outside the package. I changed it to "our", and it works now.

I was never fully clear on exactly what "our" does, although I've read the manual's description of it many times.

Here's my application:

I have a package MyDefs.pm that I'm using to define config variables that other packages will reference.

Here's part of it:

Code
package MyDefs;

use strict;
use warnings;
use re 'taint'; # suppress untainting by regexes

# paths
our $home_dir = 'c:';
our $dest_base_dir = "$home_dir/backup";
our $lock_filename = $dest_base_dir/backup_lock";
our $list_filename = 'backup.lst';
Then in other packages, I reference the variables like this:

Code
use MyDefs();
open(my $fh_lock, '>', $MyDefs::lock_filename) or die "open: $!";
Does that seem like reasonable coding practice?

I had forgotten how complicated Perl is, compared to PHP. frown

Sponsored Links
Entire Thread
Subject Posted By Posted
Loading a package from another package Dave_L 10/08/2003 5:21 AM
Re: Loading a package from another package Charles Capps 10/08/2003 5:39 AM
Re: Loading a package from another package Dave_L 10/08/2003 6:11 AM
Re: Loading a package from another package Charles Capps 10/08/2003 6:28 AM
Re: Loading a package from another package Burak 10/08/2003 6:04 PM
Re: Loading a package from another package Dave_L 10/08/2003 6:43 PM
Re: Loading a package from another package Burak 10/08/2003 6:55 PM
Re: Loading a package from another package Charles Capps 10/08/2003 7:24 PM
Re: Loading a package from another package Burak 10/08/2003 7:40 PM
Re: Loading a package from another package Dave_L 10/08/2003 7:56 PM
Re: Loading a package from another package Charles Capps 10/08/2003 8:27 PM
Re: Loading a package from another package Burak 10/08/2003 8:35 PM
Re: Loading a package from another package Dave_L 10/08/2003 8:41 PM
Re: Loading a package from another package Dave_L 10/08/2003 8:52 PM
Re: Loading a package from another package Burak 10/08/2003 8:58 PM
Re: Loading a package from another package Dave_L 10/08/2003 9:09 PM
Re: Loading a package from another package Burak 10/08/2003 9:39 PM
Re: Loading a package from another package Dave_L 10/08/2003 11:31 PM
Re: Loading a package from another package Burak 10/08/2003 11:37 PM
Re: Loading a package from another package Burak 10/08/2003 11:38 PM
Re: Loading a package from another package Dave_L 10/09/2003 7:58 AM
Re: Loading a package from another package Charles Capps 10/09/2003 8:04 AM
Re: Loading a package from another package Dave_L 10/09/2003 8:17 AM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Ruben Rocha
Ruben Rocha
Lutz,FL,USA
Posts: 254
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240506)