473,372 Members | 1,143 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

.pm file

can somebody tell me in which folder do we save .pm files.......can we save the .pm files in the same folder where we save .pl files?
Mar 8 '07 #1
10 3612
For Same Directory:
we can keep .pm and .pl file in same directory
e.g;
Example.pm
Test_Example.pl
these are our .pm and .pl file

we just need to mention following thing in Test_Example.pl file,
use Example;

For Different Directory:
if we want to keep .pl and .pm in different directories,
then if you create Module directory inside your present directory to keep
your .pm files separate,

then you just need to provide the path for Example.pm file in Test_Example.pl by,
use Module::Example

here Module is directory which contains Example.pm module
Mar 8 '07 #2
i was asking about the second option, do we need to save the .pm files inside the bin folder??
thanks for the reply.



For Same Directory:
we can keep .pm and .pl file in same directory
e.g;
Example.pm
Test_Example.pl
these are our .pm and .pl file

we just need to mention following thing in Test_Example.pl file,
use Example;

For Different Directory:
if we want to keep .pl and .pm in different directories,
then if you create Module directory inside your present directory to keep
your .pm files separate,

then you just need to provide the path for Example.pm file in Test_Example.pl by,
use Module::Example

here Module is directory which contains Example.pm module
Mar 8 '07 #3
KevinADC
4,059 Expert 2GB
You can save them almost anywhere you want. It's not necessary to save them in the cgi-bin folder. But you can if you want to.
Mar 8 '07 #4
can somebody tell me in which folder do we save .pm files.......can we save the .pm files in the same folder where we save .pl files?
If the pm file does not reside within the same folder as your script, ensure that the path is contained in @INC.

Greetz, Doc
Mar 8 '07 #5
hi, i created the .pm an .pl in same folder but the program shows some compilation error......

followin is the .pm file
#!/usr/bin/perl;
package calc;
use strict;

sub math{
my $value=0;
$value=$_++;
return $value;
}
1;

following is the .pl file
#!/usr/bin/perl;
use strict;
use calc qw(math);
math(5);
print $value

following error i get
global symbol $value requires package name at value.pl at line 5.


For Same Directory:
we can keep .pm and .pl file in same directory
e.g;
Example.pm
Test_Example.pl
these are our .pm and .pl file

we just need to mention following thing in Test_Example.pl file,
use Example;

For Different Directory:
if we want to keep .pl and .pm in different directories,
then if you create Module directory inside your present directory to keep
your .pm files separate,

then you just need to provide the path for Example.pm file in Test_Example.pl by,
use Module::Example

here Module is directory which contains Example.pm module
Mar 9 '07 #6
hi, i created the .pm an .pl in same folder but the program shows some compilation error......

followin is the .pm file
#!/usr/bin/perl;
package calc;
use strict;

sub math{
my $value=0;
$value=$_++;
return $value;
}
1;

following is the .pl file
#!/usr/bin/perl;
use strict;
use calc qw(math);
math(5);
print $value

following error i get
global symbol $value requires package name at value.pl at line 5.
Mar 9 '07 #7
KevinADC
4,059 Expert 2GB
You didn't need to repost this same question. The reason the code fails is because it is incomplete. There are a few ways to get it to work. Here is one way:

main script:
Expand|Select|Wrap|Line Numbers
  1. #!perl;
  2.  
  3. use strict;
  4. use Calc;
  5. my $value = math(5);
  6. print $value;
Calc.pm:
Expand|Select|Wrap|Line Numbers
  1. package Calc;
  2. use strict;
  3. require Exporter;
  4.  
  5. our @ISA    = qw(Exporter);
  6. our @EXPORT = qw(math);
  7.  
  8. sub math {
  9.    my $value = shift;
  10.    $value++;
  11.    return $value;
  12. }
  13. 1;
Mar 9 '07 #8
it does not works it gives an error saying"undefined subroutine &main::math called at value.pl line 5.


You didn't need to repost this same question. The reason the code fails is because it is incomplete. There are a few ways to get it to work. Here is one way:

main script:
Expand|Select|Wrap|Line Numbers
  1. #!perl;
  2.  
  3. use strict;
  4. use Calc;
  5. my $value = math(5);
  6. print $value;
Calc.pm:
Expand|Select|Wrap|Line Numbers
  1. package Calc;
  2. use strict;
  3. require Exporter;
  4.  
  5. our @ISA    = qw(Exporter);
  6. our @EXPORT = qw(math);
  7.  
  8. sub math {
  9.    my $value = shift;
  10.    $value++;
  11.    return $value;
  12. }
  13. 1;
Mar 9 '07 #9
KevinADC
4,059 Expert 2GB
Works OK for me.
Mar 9 '07 #10
thanks very much,program works fine.

Works OK for me.
Mar 12 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
7
by: Joseph | last post by:
Hi, I'm having bit of questions on recursive pointer. I have following code that supports upto 8K files but when i do a file like 12K i get a segment fault. I Know it is in this line of code. ...
3
by: StGo | last post by:
How can i read/write file's custom attributs(like subject,author...) in C#??? Thanks :))
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
3
by: Shapper | last post by:
Hello, I created a script to upload a file. To determine the file type I am using userPostedFile.ContentType. For example, for a png image I get "image/png". My questions are: 1. Where can...
0
by: troutbum | last post by:
I am experiencing problems when one user has a document open through a share pointing to the web site. I use the dsolefile to read the contents of a particular directory and then display them in a...
0
by: thjwong | last post by:
I'm using WinXP with Microsoft Visual C++ .NET 69462-006-3405781-18776, Microsoft Development Environment 2003 Version 7.1.3088, Microsoft .NET Framework 1.1 Version 1.1.4322 SP1 Most developers...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.