Unknown function

Discussion in 'Perl Misc' started by Martin L., Apr 5, 2004.

  1. Martin L.

    Martin L. Guest

    I a trying to debug a free script that allows me to place counters on
    pages throught my domain. It operates using SSI's. There are no fatal
    errors. The results should be a summary of my counter logs for each
    page that has a counter the no log file names or contents appear.


    There is one function #### @files = ('logs/*.log'); ##### I am not
    familiar with and a look through PERLFUNC did not turn up anything.

    Here is the context It is found in

    ####begin snippet


    $opt = "$ENV{ 'QUERY_STRING' }";
    $count_page = "$ENV{ 'QUERY_STRING' }";

    if ( $opt eq "stats" ) {
    @files = ('logs/*.log');
    &get_files;
    &CalculateStats }

    ####end snippet

    At this point the script should be generating a list of counter log
    files so that is what I am assuming this line does. I understand the
    "*.logs" portion is a wild card for all files with the "log" extension
    but the preceeding "logs/" I have not seen before. It is the name of
    the log directory but it has not been assigned to a FILE_HANDLE
    anywhere and the only other reference is as a comparison string in an
    unrelated section of the script.

    The page returned from the script would indicate that the "@files"
    variable contained no data.

    Thanks
    Martin L.
     
    Martin L., Apr 5, 2004
    #1
    1. Advertising

  2. Martin L.

    Sandman Guest

    In article <_Pbcc.15824$>,
    "Martin L." <> wrote:

    > I a trying to debug a free script that allows me to place counters on
    > pages throught my domain. It operates using SSI's. There are no fatal
    > errors. The results should be a summary of my counter logs for each
    > page that has a counter the no log file names or contents appear.
    >
    >
    > There is one function #### @files = ('logs/*.log'); ##### I am not
    > familiar with and a look through PERLFUNC did not turn up anything.
    >
    > Here is the context It is found in
    >
    > ####begin snippet
    >
    >
    > $opt = "$ENV{ 'QUERY_STRING' }";
    > $count_page = "$ENV{ 'QUERY_STRING' }";
    >
    > if ( $opt eq "stats" ) {
    > @files = ('logs/*.log');
    > &get_files;
    > &CalculateStats }
    >
    > ####end snippet
    >
    > At this point the script should be generating a list of counter log
    > files so that is what I am assuming this line does. I understand the
    > "*.logs" portion is a wild card for all files with the "log" extension
    > but the preceeding "logs/" I have not seen before. It is the name of
    > the log directory but it has not been assigned to a FILE_HANDLE
    > anywhere and the only other reference is as a comparison string in an
    > unrelated section of the script.
    >
    > The page returned from the script would indicate that the "@files"
    > variable contained no data.


    In this snippet, @files is an array containing one entry - "logs/*.log", it's
    not a function. Presumably a later function (get_files or CalculateStats
    perhaps) will deal with all the items in @files.

    --
    Sandman[.net]
     
    Sandman, Apr 5, 2004
    #2
    1. Advertising

  3. Martin L. <> wrote:

    > I a trying to debug a free script



    It is very likely worth less than what you paid for it...


    > There is one function #### @files = ('logs/*.log'); ##### I am not
    > familiar with and a look through PERLFUNC did not turn up anything.



    It is a "list assignment".

    A list on the left (stored in an array), and a list on the right
    (a short list, only one element long).

    A list assignment puts the 1st thing on the right into the 1st
    thing on the left, the 2nd on the right into the 2nd on the left, etc.


    > Here is the context It is found in


    > @files = ('logs/*.log');



    It has the same effect as this:

    @files = (); # ensure everything else gets stomped on
    $files[0] = 'logs/*.log';


    > &get_files;
    > &CalculateStats }




    > I understand the
    > "*.logs" portion is a wild card for all files with the "log" extension



    At this point it is nothing more than a string with an asterisk in it.

    The asterisk will only be interpreted as a wildcard if the string
    is eventually used with glob().

    Does get_files() or CalculateStats() access @files and feed it to a glob?

    Communicating via globabl variables, and calling subroutines like that
    are a pretty clear indication that you are working with some
    very poor code...


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Apr 5, 2004
    #3
  4. Martin L. wrote:
    > I a trying to debug a free script that allows me to place counters on
    > pages throught my domain.


    Just on a side note: Your aware of "perldoc -q increment", aren't you?

    jue
     
    Jürgen Exner, Apr 5, 2004
    #4
  5. Martin L.

    Martin L. Guest

    No, I am not aware of it, but if it makes this any easier to
    understand, I sure would like to be!

    :)




    J|rgen Exner wrote:

    > Martin L. wrote:
    > > I a trying to debug a free script that allows me to place counters
    > > on pages throught my domain.

    >
    > Just on a side note: Your aware of "perldoc -q increment", aren't you?
    >
    > jue
     
    Martin L., Apr 5, 2004
    #5
  6. On Mon, 05 Apr 2004 11:56:42 GMT, "Martin L." <>
    wrote:

    >There is one function #### @files = ('logs/*.log'); ##### I am not
    >familiar with and a look through PERLFUNC did not turn up anything.


    I skipped the rest of your post but somehow I strongly suspect that
    the above statement should really be

    @files = <'logs/*.log'>;
    ^ ^

    are you sure you didn't mistook them for parens?


    Michele
    --
    you'll see that it shouldn't be so. AND, the writting as usuall is
    fantastic incompetent. To illustrate, i quote:
    - Xah Lee trolling on clpmisc,
    "perl bug File::Basename and Perl's nature"
     
    Michele Dondi, Apr 5, 2004
    #6
  7. Michele Dondi wrote:
    >
    > On Mon, 05 Apr 2004 11:56:42 GMT, "Martin L." <>
    > wrote:
    >
    > >There is one function #### @files = ('logs/*.log'); ##### I am not
    > >familiar with and a look through PERLFUNC did not turn up anything.

    >
    > I skipped the rest of your post but somehow I strongly suspect that
    > the above statement should really be
    >
    > @files = <'logs/*.log'>;
    > ^ ^
    >
    > are you sure you didn't mistook them for parens?


    You do realize that the single quotes will be included as part of the
    path/file name meaning that you are looking for the directory "'logs"
    with files ending in ".log'"?


    John
    --
    use Perl;
    program
    fulfillment
     
    John W. Krahn, Apr 5, 2004
    #7
  8. On Mon, 05 Apr 2004 21:50:35 GMT, "John W. Krahn" <>
    wrote:

    >> @files = <'logs/*.log'>;
    >> ^ ^
    >>
    >> are you sure you didn't mistook them for parens?

    >
    >You do realize that the single quotes will be included as part of the
    >path/file name meaning that you are looking for the directory "'logs"
    >with files ending in ".log'"?


    D'Oh!


    Michele
    --
    you'll see that it shouldn't be so. AND, the writting as usuall is
    fantastic incompetent. To illustrate, i quote:
    - Xah Lee trolling on clpmisc,
    "perl bug File::Basename and Perl's nature"
     
    Michele Dondi, Apr 6, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kapt. Boogschutter
    Replies:
    7
    Views:
    475
    Kapt. Boogschutter
    Jun 20, 2004
  2. Calum

    Calling a function of unknown type

    Calum, Jan 16, 2004, in forum: C Programming
    Replies:
    4
    Views:
    526
    Calum
    Jan 19, 2004
  3. Christian Christmann

    Unknown function

    Christian Christmann, Mar 5, 2006, in forum: C Programming
    Replies:
    9
    Views:
    363
    Keith Thompson
    Mar 12, 2006
  4. ais523
    Replies:
    6
    Views:
    318
    Richard G. Riley
    Apr 16, 2006
  5. Vincent Arnoux
    Replies:
    1
    Views:
    259
    Arnaud Bergeron
    Aug 11, 2006
Loading...

Share This Page