Win <-> Lin

anio at webgroup-bg.com anio at webgroup-bg.com
Thu Apr 1 03:30:56 CST 2004


sofia-pm-list - An official of Sofia's Perl hackers
anio at webgroup-bg.com
Zdraveite.Imam problem s parsvaneto na edin konfig.Izpolzvama modula
Tie::File zashtoto s nego mi e po-lesno.Konfiga e sas sledniq format:
#################
# SMTP Server Host
SMTPHost = 'mail.somehost.com'

#################
# MAIL Recipient
Recipient = 'recipient at somehost.com'

vzimam parametrite taka:

tie @smtp_settings, 'Tie::File', $smtp_file;
for (@smtp_settings) {
   chomp;
   next if /^#/;
   next if /^$/;
 if (/^(\w+)\s=\s'(\S+)'/) {
   $smtp_host     = $2 if ($1 eq 'SMTPHost');
   $recipient     = $2 if ($1 eq 'Recipient');
   $reverse_path  = $2 if ($1 eq 'Reverse');
 }
}

Vsi4ko raboti i pod Windows i pod Linux, no kogato smenq Config fila ot
Win format na Linux ("\r\n" -> "\n") i vsi4ko se obyrkva.Ne moje da vzeme
nito edna ot nastroikite.Molq pomognete.Kajete kak da go napravq
universalno i formata na SMTP_config na nqma zna4enie za parsera.
Blagodarq vi.



More information about the Sofia-pm mailing list