Re: paging page trouble





samwyse wrote:
> Alexandre Jaquet > wrote:
> > local our $nb_page = arrondi ($total / 4, 1);
> > local our $min_index = $query->param("min_index") || '0';
> > local our $max_index = $query->param("max_index") || '4';
> > local our $page_nbr = $query->param("pagenbr") ;
> > local our $page_start = $query->param("page_start") || '0';;
> > local our $page_end = $query->param("page_end") || '4';;

> my $nb_page = arrondi ($total / ITEMSPERPAGE, 1);
> my $page_nbr = $query->param('pagenbr');
> my $page_start = max(0, $page_nbr - PAGESPAN )
> my $page_end = min(nb_page, $page_nbr + PAGESPAN )
> my $min_index = ITEMSPERPAGE * $page_nbr;
> my $max_index = $min_index + ITEMSPERPAGE - 1;
>
> BTW, why the 'local our' in your code? Is that your own convention, or
> just something I've not seen before?

Lexicals that are declared at file scope and then used within
subroutines in CGI scripts that are to (potentially) be be run under
mod_perl "will not remained shared".

For this reason such variables should be made into local()ized package
variable.

Note: from a programming purist point of view (as in "global variables
are bad") file-scoped lexicals are already global variables, and making
them package-scoped does not make them any more ugly.

It is probably a good idea to try to write code without so many global
vaiables.

.



Relevant Pages

  • Re: [SPARK] Code safety and information hiding
    ... the documentation:). ... This can be achieved by the environment task executing the initialization code for the package during elaboration, or by an initialization task in the package body. ... design was better than the global variable it replaces. ... The customers of the SW designed around large numbers of undocumented global variables seemed satisfied with it. ...
    (comp.lang.ada)
  • Re: Execute Package Task and setting its inner Package Global Vaiables
    ... Ok So you want to retrieve the values of child package Global Variables and use them in you Parent as well as setting child global ...
    (microsoft.public.sqlserver.dts)
  • Re: Execute Package Task and setting its inner Package Global Vaiables
    ... If you are using the ExecutePackage task then you can pass through a Parent package Global Variable to the child. ... Global variables values from the child package back in the parent. ...
    (microsoft.public.sqlserver.dts)
  • Re: script for ftp
    ... At run time you can re-specify Global Variables values in dtsrun command ... Packages Global variables can be set in Package> Properties> Global ... you can then use a dynamic property task object to dynamically affect ...
    (microsoft.public.sqlserver.dts)
  • RE: VBScripts or JScripts
    ... Global variables that do not exist when first ... Prior to package execution, you can create global ... how to use ActiveX scripts in DTS ... Using Global Variables with DTS Packages ...
    (microsoft.public.sqlserver.dts)