Hello,

 

Can anybody tell my why the sub routine def_store is not giving me the variable $store back

if it runs as a service but it does when I run it in a regular perl script?

 

Thanks in advance…..Camillo

 

 

package PerlSvc;

 

our %Config;

 

use Time::localtime;

use Date::Calc qw(Today Add_Delta_Days);

my @date = Add_Delta_Days( Today(), -1 );

 

sub Startup {

    # here's where your startup code will go

 

 

while (ContinueRun(20)) {

$year_flg = $date[0];

$mon_flg =  $date[1];

$day_flg =  $date[2];

&mon_flag;

&day_flag;

&day_heute;

$datum = "$year_flg$mon_flg$day_flg";

&def_store;

close(filename);

 

system("echo $datum >> c:\\ser.log");

system("echo $store >> c:\\ser.log");

 

}

sub mon_flag {if ($mon_flg < "10" ) {$mon_flg = "0$mon_flg"};}

sub day_flag {if ($day_flg < "10" ) {$day_flg = "0$day_flg"};}

sub day_heute {if ($day_heute < "10" ) {$day_heute = "00$day_heute"};}

sub def_store {

system("dir l:\\sus > l:\\sus\\text");

$filename = "< l:\\sus\\text ";

open (filename, $filename) or die "kann Datei nicht finden !";

@liste = <filename>;

@zeile = split(/\n/, @liste);

 

foreach $var (@liste)

 

{

 

@felder=split(/ /, $var);

$fo = $felder[19]; chop $fo;

if ($fo < 1000) {next;}

if ($fo > 1000) {$store = $felder[19];}

}

}

 

 

 

 

 

}

 

sub Pause {

    # your service is about to be suspended

}

 

sub Continue {

    # your service will resume execution now

}

 

sub Interactive {

    # this callback is invoked when your service is not running as

    # a service and has been called without any of the --help,

    # --install or --remove options.

}

 

sub Install {

    $Config{ServiceName} = 'VisualReceipt';

    $Config{DisplayName} = 'VisualReceipt';

 

    # add your additional install messages or functions here

    print "\nAdditional install notes\n";

}

 

sub Remove {

    $Config{ServiceName} = 'VisualReceipt';

 

    # add your additional remove messages or functions here

    print "\nAdditional remove notes\n";

}

 

sub Help {

    # add your additional help messages or functions here

    print "\nAdditional help notes\n";

}

 

package main;

 

# any additional support code can go here

 

DISCLAIMER:
This communication is confidential and may be legally privileged. If you are not the intended recipient, (i) please do not read or disclose to others, (ii) please notify the sender by reply mail, and (iii) please delete this communication from your system. Failure to follow this process may be unlawful. Thank you for your cooperation.

Reply via email to