Doubts regarding perl scripting programs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Lastknight
    New Member
    • Jun 2007
    • 55

    Doubts regarding perl scripting programs

    Hi all,
    I have been asked to go through our previous used programs in that they have used several subroutines for the quick and easy way to handle in all the programs in the common directory..

    My problem is simple, i am catching up the user defined subroutines like date functions,diffe rent URL's for font,color,scri pt etc but i am not able to clearly understand "Head,tail,left ,right" these type of units...sometim es they even used 1 and -1 st the end of the modules...

    Can anyone let me know how to develop these sub's for my programming?
  • prn
    Recognized Expert Contributor
    • Apr 2007
    • 254

    #2
    Hello, Lastknight,

    I'm afraid I'm having trouble understanding what it is you are asking. It may be that English is not your native language, and I certainly do not want to disparage you for that. I do understand the difficulties of writing in a second (or third or...) language, but I think we need another try here.

    Are you asking how to code a module? Or are you trying to develop a subroutine library (or libraries) for use in your institution's perl programs? Or are you just trying to understand some particular module or routine? Or is it something else that I have not understood?

    Perhaps a more specific question with an example might be clearer.

    I'll try to help you if I can, but I'm not sure what you are asking here.

    Best Regards,
    Paul

    Comment

    • Lastknight
      New Member
      • Jun 2007
      • 55

      #3
      Hi prn,
      Thanks for ur reply and the way u have given a whack on my back, its really nice that great people trying to correct the novices...

      Actually it was my mistake that i have not properly communicated my problem..

      My problem was in a particular module i am able to understand the user definrd subroutines like date,fonts,urls ,scripts but i am not clear about the head,tail,left, right those type of subroutines used in that module..

      Kindly explain me that part..it will be great if ur quoting some examples for reference...

      With regards,
      Barani..

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        When you say "head,tail,left ,right" it sounds like the sub routines are formatting or displaying sections of a page, probably a web page. 'head' is the header or top of the page, 'tail' is the footer, or bottom of the page, 'left' and 'right' are the left and right sides or margins of the page.

        We can't help explain them to you because they are not some type of a standard subroutine or function. The programmer is free to write those subroutines however they want to and name them whatever they want to. Maybe if you post the code, like prn has asked, we can help you figure out whatever it is that is unclear to you.

        Kevin

        Comment

        • prn
          Recognized Expert Contributor
          • Apr 2007
          • 254

          #5
          Hi Barani,

          It looks to me like Kevin is on target here. It seems likely that the functions head, tail, left and right that you are wondering about are functions/subroutines that are defined by the person who wrote these modules for you. If you were to post the relevant code, we could probably help explain some of the less clear parts for you, but it may be that your code is proprietary to your organization and it is not unlikely that there is a considerable amount of it, so what I'd recommend doing first would be to try finding the definitions of the unclear parts.

          For example, if you have a function called "head" that you don't understand, the first thing I'd recommend doing is trying to find the definition of that function in the code you have there. If you don't know where it is defined (and it looks like you don't), the first thing to look at would be the "use" statements at the beginning of your code. Those should point to perl module files (extension .pm) that may contain definitions for these subroutines.

          If that doesn't take you directly to the definitions you need, then I'd suggest that you cd to the directory/folder where the code is and try something like:
          grep -il "sub head" *
          This will probably find you the files and line numbers within those files where the "head" subroutine is defined. If it doesn't, you might need to try some additional tricks, but exactly how to determine those addtional tricks may depend on what kind of system you're working on.

          As Kevin points out, these don't look like "standard" functions so you probably have the answers in your local code somewhere. Your immediate problem is to find them. Let us know what kind of system you are working on (e.g., Unix/Linux, Windows, something else) and we may have other suggestions for you.

          Best Regards,
          Paul

          Comment

          • Lastknight
            New Member
            • Jun 2007
            • 55

            #6
            Hi paul and kevin,
            Thanks for ur replies regarding my query..
            It was clear enough for me to understand my subroutines..
            Hope to get information from u people if needed..

            best regards,
            barani..

            Comment

            Working...