Perl Module to get the Screen Size of a mobile device

As mobile devices are created differently, there are a lot of different Screen size available in the market. Due to the small screen size, mobile application developers had always find it hard to optimize the WAP portal for different devices. Keeping a record of the screen size is also difficult as there isn’t a standard way for mobile devices manufacturers to communicate to the mobile application developers.

User Agent Profile (UAProf) specification is the answer to this problem. It is used to capture capability and preference information for mobile devices. This information can be used by content providers to produce content in an appropriate format for the specific device.

In this article, we will discuss the Perl module which use UAProf to get the screen size of the mobile devices. For further information, you can download a copy of UAProf’s specification at:

Specification of UAProf


To install, do the following:

perl Makefile.PL
make install

The following a a perldoc of this module:


 use Mobile::UserAgentProfile;
 my $uaprof= new Mobile::UserAgentProfile();

This module will retrieve the screen size of the device from the UAProf.


new, this method is used to create the UserAgentProfile object. initial call will be slow if the DefaultCacheDir directory is not found. If DefaultCacheDir is not found, this module will retrieve a list of UAProf from the Internet. The current list is available at here .


my $uaprof= new Mobile::UserAgentProfile();

my $uaprof= new Mobile::UserAgentProfile(
     UserAgent=>"UserAgentProfile Grabber",

getSize, this method will retrieve the size of the device based on the UAProf URL. If the UAProf is not found in the DefaultCacheDir directory, this module will retrieve the UAProf from the given url. If the UAProf is found, it will retrieve from DefaultCacheDir directory.


     my $size= $uaprof->getSize(HTTP_X_WAP_PROFILE=>$HTTP_X_WAP_PROFILE);

Example of accepted value for HTTP_X_WAP_PROFILE:
"", "1-bgyyJlyTUYSczJUKDdFYyw=="

You can download the package at Mobile-UserAgentProfile-0.01.tgz