Perl: Net::Cmd: Callback kind of function for datasend() ??

Is there a way to make a callback function so that while you send data you can send the bytes uploaded to a file?

like

Net::Cmd;

open(R,"$file");
while(R($file,&callback,$byte)
{
         datasend() ?
}
close(R);

sub callback
{
        $count = $count + $byte;
}

Thanks for any help anyone can lend.

Best regards,

Dr34m3r
LVL 1
dr34m3rsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TalmashCommented:
I know how to use callback in our project :

lots of files are compiled, at the end of compilation, some "callback" functions are executed.

1) top level of the project, call all the callback functions
2) each callback "see" all the accumulated data at the end of the compilation.
3) we use this mainly to print and close files

is that match what you are looking for ?
 tal
dr34m3rsAuthor Commented:
hummm it doesn't sound like it - I want to use this to send data to a server and calculate how much data has been sent - I think I found a way...  but I have to write it and experiment
which also means I have to finish the rest of the code =D

I will keep everyone posted.

Thanks!

Any ideas would still be helpful tho
dr34m3rsAuthor Commented:
Just following up. This works if you want to keep track of bytes sent / uploaded.

open(DATA,"$tmp");
while(read(DATA,$send_data,$byte_size))
{
      $connect->datasend($send_data);

      $send_len = length($send_data);

      $byte_count = $byte_count + $send_len;
      $tmp_byte_count = $tmp_byte_count + $send_len;
      
      open(W,">$bytes_read_file");
      print W $byte_count;
      close(W);
}
close(DATA);

You can close this question now =D

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.