Click here to get back home

How do I stop warnings from external packages?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
How do I stop warnings from external packages? Justin C 03-11-2008
Posted by Justin C on March 11, 2008, 5:47 am
Please log in for more thread options
I have a program with a 'require' line. The required item is another
program which puts a whole bunch of stock codes from an SQL database
into a hash, the has is what is used in the main program. I'm not
familiar with working this way (I have no idea how I wrote that in the
first place!).

The require is something like this:

package ProductCodes;
%codes {
.
.
.
}

within the main program I have a line which generates a warning, the
line:

print $ProductCodes::codes;

The warning is:

Name "ProductCodes::codes" used only once: possible typo at

How can I stop this without turning off warnings?

Thank you for your suggestions.

        Justin.

--
Justin C, by the sea.

Posted by Frank Seitz on March 11, 2008, 6:54 am
Please log in for more thread options
Justin C wrote:
>
> The warning is:
>
> Name "ProductCodes::codes" used only once: possible typo at
>
> How can I stop this without turning off warnings?

Replace require by use or

{ no warnings 'once'; print $ProductCodes::codes; }

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Posted by Justin C on March 13, 2008, 11:05 am
Please log in for more thread options
> Justin C wrote:
>>
>> The warning is:
>>
>> Name "ProductCodes::codes" used only once: possible typo at
>>
>> How can I stop this without turning off warnings?
>
> Replace require by use or
>
> { no warnings 'once'; print $ProductCodes::codes; }

That's got it, thanks Frank.

        Justin.

--
Justin C, by the sea.

Similar ThreadsPosted
Advice on converting hashed packages to pseudo-hashed packages February 11, 2005, 7:57 am
use warnings; and use Warnings; give different results August 30, 2004, 2:09 pm
packages August 24, 2005, 1:56 pm
What packages are installed? August 12, 2004, 8:50 pm
Installing packages September 9, 2005, 4:55 pm
Creating Packages May 13, 2007, 6:34 pm
inheritance and order of packages January 2, 2005, 8:32 am
List all packages in a file.pm September 27, 2005, 11:13 am
remote installation of packages April 11, 2006, 2:15 am
Code does work in different packages only June 25, 2006, 3:35 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap