Apache-iNcom
view release on metacpan or search on metacpan
lib/Apache/iNcom/Request.pm view on Meta::CPAN
# Localize the template
my $localizer = $r->pnotes( "INCOM_LOCALIZER" );
$file = $localizer->find_localized_file( $file );
{
no strict 'refs';
my $fh = gensym;
open $fh, $file
or die "can't open file $file\n";
print {"$package\:\:OUT"} <$fh>;
close $fh;
};
}
=pod
=head2 QueryArgs ( [ $fdat ], [ $odat ], [ $idat ] )
This function is similar to the [$ hidden $] directive in
HTML::Embperl but instead of generating hidden input fields, it
returns the form data as a query string.
=over
=item $fdat
The form data to output. Defaults to the %fdat hash.
=item $odat
Override data. Fields present in that hash will override the
one in %fdat.
=item $idat
Ignored data. Fields present in that hash will be ignored and
not output in the resulting query string.
=back
Usage example :
<a href="search.html?[- QueryArgs() -]">Next</a>
=cut
sub QueryArgs {
my ( $fdat,$odat,$idat) = @_;
{
# Needed to access symbolically the page variables
no strict 'refs';
$fdat ||= *{"$package\:\:fdat"};
};
$odat ||= {};
$idat ||= {};
my $uri = join "&", map {
if ( exists $odat->{$_} ) {
Apache::Util::escape_uri( $_ ) . "=" .
Apache::Util::escape_uri( $odat->{$_} );
} elsif ( not exists $idat->{$_} ) {
Apache::Util::escape_uri( $_ ) . "=" .
Apache::Util::escape_uri( $fdat->{$_} );
}
} keys %$fdat;
{
no strict 'refs';
my $old = ${"$package\:\:escmode"};
${"$package\:\:escmode"} = 0;
print {"$package\:\:OUT"} $uri;
${"$package\:\:escmode"} = $old;
};
}
1;
__END__
=pod
=head1 AUTHOR
Copyright (c) 1999 Francis J. Lacoste and iNsu Innovations Inc.
All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
=head1 SEE ALSO
Apache::iNcom(3) Apache::iNcom::OrderManager(3) Apache::iNcom::CartManager(3)
DBIx::SearchProfiles(3) DBIx::UserDB(3) Locale::Maketext(3) HTML::Embperl
=cut
( run in 2.604 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )