Sponsored Content
Full Discussion: perl: globals and a package.
Top Forums Shell Programming and Scripting perl: globals and a package. Post 59458 by effigy on Monday 20th of December 2004 06:09:47 PM
Old 12-20-2004
google,

When omitting the "my" I get the following:

Global symbol "$dir" requires explicit package name at mg_perl_routines.pl line 9.

I have tried using the package notation, as well as the "our" keyword. I am looking at a few books which have examples, but I have yet to understand this package stuff with perl Smilie
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

perl package directories - what if the script is diff DIR to the one contain *.pm?

Hi there, say the package is in the ~/ and it's ~/packageFoo.pm I can use usePackage.pl in ~/ (~/usePackage.pl). Now, if I move it to ~/subDIR/usePackage.pl, the script won't work because it's not in the same DIR with packageFoo.pm How can i fix it? Thanks Gusla (1 Reply)
Discussion started by: gusla
1 Replies

2. Shell Programming and Scripting

perl package question

can someone tell me how below package command worked? I understand how global1.pl works.. but i don't see how global3.pl is working.. Is package Fred command having first output look into $main:name??? # cat global3.pl #!/usr/bin/perl -w #use strict; $main::name = "Your name Here";... (1 Reply)
Discussion started by: hankooknara
1 Replies

3. Shell Programming and Scripting

how to access globals in a function

I know any globals can be directly modified in a function without passing/returning parameters- provided the function is written within the same file. However, when I wrote functions in a saparate file (so hopefully they can be re-used by multiple script programs), and then call them from the main,... (11 Replies)
Discussion started by: bluemoon1
11 Replies

4. Shell Programming and Scripting

perl for dbms_stats package

Hi, i am new to perl and i used to manullay gathering statistics since our database servers are 8i, could any body help to get the perl script or any link to automate this work. Thanks Prakash (1 Reply)
Discussion started by: prakash.gr
1 Replies

5. Shell Programming and Scripting

Java package restructuring using shell/sed/perl

Hi we are having more than 10k file source code clutterred across different directories. 1. we want to find duplicate file name 2. all java files and having having below content in various folder under /home/raxit/src --------- /*comment etc for few line */ package hello.a.b.c; ... (0 Replies)
Discussion started by: raxitsheth
0 Replies

6. Shell Programming and Scripting

Using localisation of a Perl package

I have a Perl package, which is widely used and tested, but recently a version in another language was added. The relevant po-files have been reviewed for this and are ready for testing. What are the steps to select the language by the user? From my understanding the language environment variable... (3 Replies)
Discussion started by: figaro
3 Replies

7. UNIX for Advanced & Expert Users

How to find dependancies of .dstream package (Solaris) & .rpm package( linux)

Friends, Please let meknow, How we can find the dependancies of .dstream package & .rpm package before installation ? For AIX, We can use the inutoc . command to create the .toc file for the bff package, What about Solaris & Linux ? (0 Replies)
Discussion started by: yb4779
0 Replies

8. Shell Programming and Scripting

Perl : Global symbol requires explicit package name Error while executing

I have executed the below perl script for copying the file from one server to another server using scp. #!/usr/bin/perl -w use Net::SCP::Expect; use strict; $server= "x.x.x.x"; my $source = "/mypath/mypath"; my $destination = "/home/"; print "Login...Starting scp..."; $user="admin";... (1 Reply)
Discussion started by: scriptscript
1 Replies

9. Shell Programming and Scripting

Php server globals REQUEST_URI or HTTP_SERVER_VARS

Hi all, recently I found that $_SERVER does not deliver the complete url with query anymore on my server. http://www.example.org/search.php?stichwort=wiki echo $_SERVER; /search.phpHowever $GLOBALS works in this case. http://www.example.org/search.php?stichwort=wiki echo $GLOBALS;... (1 Reply)
Discussion started by: lowmaster
1 Replies
Perl::Critic::Policy::Modules::RequireFilenameMatchesPacUser(Contributed Perl DocPerl::Critic::Policy::Modules::RequireFilenameMatchesPackage(3pm)

NAME
Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage - Package declaration must match filename. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
The package declaration should always match the name of the file that contains it. For example, "package Foo::Bar;" should be in a file called "Bar.pm". This makes it easier for developers to figure out which file a symbol comes from when they see it in your code. For instance, when you see "Foo::Bar->new()", you should be able to find the class definition for a "Foo::Bar" in a file called Bar.pm Therefore, this Policy requires the last component of the first package name declared in the file to match the physical filename. Or if "#line" directives are used, then it must match the logical filename defined by the prevailing "#line" directive at the point of the package declaration. Here are some examples: # Any of the following in file "Foo/Bar/Baz.pm": package Foo::Bar::Baz; # ok package Baz; # ok package Nuts; # not ok (doesn't match physical filename) # using #line directives in file "Foo/Bar/Baz.pm": #line 1 Nuts.pm package Nuts; # ok package Baz; # not ok (contradicts #line directive) If the file is not deemed to be a module, then this Policy does not apply. Also, if the first package namespace found in the file is "main" then this Policy does not apply. CONFIGURATION
This Policy is not configurable except for the standard options. AUTHOR
Chris Dolan <cdolan@cpan.org> COPYRIGHT
Copyright (c) 2006-2011 Chris Dolan. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-07 Perl::Critic::Policy::Modules::RequireFilenameMatchesPackage(3pm)
All times are GMT -4. The time now is 06:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy