[sf-perl] Make a hash key's value dependent on the key itself?

boss at gregerhaga.net boss at gregerhaga.net
Thu Jul 6 07:04:32 PDT 2006


Quoting David Alban <extasia at extasia.org>:

> Thanks, Gavin.
>
> I like that idea!
>
> Unfortunately, almost no matter what I use, there's always the danger
> of "cut and paste" error.  The data is going to be in the source (or
> in a config file) somewhere in some form.  And the error will happen
> at "edittime", not runtime.  At least with the token
> ("::SOURCEHOST::") I don't have to worry about that so much.
how about putting the config in an xml file?
It would allow you to use the exact same script for various xml-config  
files. You wuldn't need to change anything in the script itself when  
source and target changes.

See my site for example of how I upload and download contents as I  
develop my site, http://www.gregerhaga.net/scripts.php ( ftp loader )

just an idea,
Greger
<
>
> On 7/3/06, Gavin Jefferies <gavin at fastperl.com> wrote:
>> mkhosts(foo => {
>>          source_tree  => '/some/dir',
>>          rsync_target => "bat:$spool_dir/::SOURCEHOST::/",
>>      });
>>
>> mkhosts(bar => {
>>          source_tree  => '/some/other/dir',
>>          rsync_target => "bat:$spool_dir/::SOURCEHOST::/",
>>      });
>>
>> mkhosts(bat => {
>>          source_tree => '/yet/another/dir',
>>          rsync_target =>
>> "mumble:$raid_root/::SOURCEHOST::/",
>>      });
>
> --
> Live in a world of your own, but always welcome visitors.
> _______________________________________________
> SanFrancisco-pm mailing list
> SanFrancisco-pm at pm.org
> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm
>




More information about the SanFrancisco-pm mailing list