twenty four merry days of Perl Feed

Find My Santa

WebService::FindMyiPhone - 2013-12-06

From the look on the young elf's face running towords him, the Wise Old Elf knew something had gone terribly terribly wrong.

"It's our worse nightmare, Sir" Private Jingle McCandySticks reported. "We just found a letter for Santa down the back of the Sofa in the mailroom, Sir!".

This was bad news indeed. Santa had already set off on his annual round the world present giving extravaganza, and if no-one had read that letter yet, someone was going to have an empty stocking come Christmas morning.

"That's okay CandySticks", the wise old elf reassured the Private, taking the letter as he did so. "Santa has his iPhone on him, it's freshly charged, so one phone call and we'll be sure that ... let's see here ... little José Castro will get the ninja costume he always wanted."

"But that's just it, Sir. Ever since Lieutenant Pudding Von Snowflake accidentally dialed Santa's cell phone instead of the Pizza place his phone is on strict Do Not Disturb. It won't even ring for Mrs. Claus, Sir!"

"Ah yes," sighed the Wise Old Elf, "well we can't blame him about that. Not after his Rockin' Around The Christmas Tree ringtone woke up those Rottweilers. Still, don't worry, I think I can solve this with a little Perl script..."


1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
9: 
10: 
11: 
12: 
13: 
14: 
15: 
16: 
17: 
18: 
19: 
20: 
21: 
22: 

 

# access Santa's Where's My iPhone account with his iCloud credentials
# and get access to his iPhone's details
use WebService::FindMyiPhone;
my $icloud = WebService::FindMyiPhone->new(
    username => 'kriskringle@icloud.com',
    password => 'RudyGuideMySleigh2Nite!',
);
my $iphone = $icloud->get_device_by( name => "Santa's iPhone" );

# wait for Santa to fly west out of Portugal towards the Americas, so we know
# that he's in the air and when we make his phone make noise, and it won't
# wake anyone up
while (1) {
  last if $iphone->location->{longitude} < -9.6;
  sleep 60 * 5;
}

# make his phone bleep until he acknowledges the emergency message
$iphone->send_message(
  1, # true = make noise
  "Go back, J.Casto (#F8034672F5DC4E4B965A7F0C1D0FD2AC) needs Ninja Costume",
);

 

See Also

Gravatar Image This article contributed by: Mark Fowler <mark@twoshortplanks.com>