New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] 0693f64 Describe how to store a HV into another HV by using hv_store #14634
Comments
From yoanlin93@gmail.comThis is a bug report for perl from yoanlin93@gmail.com, From 0693f6420be846ce8d1b10d4c931b7a6aa7f3134 Mon Sep 17 00:00:00 2001 This is a multi-part message in MIME format. pod/perlguts.pod | 11 ++++++++++- --------------2.1.2 Inline Patchdiff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 2c04a33..0fe61a8 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -470,7 +470,16 @@ C<SV*>. To access the scalar value, you must first dereference the return
value. However, you should check to make sure that the return value is
not NULL before dereferencing it.
-The first of these two functions checks if a hash table entry exists, and the
+To store a HV, you have to create a RV and cast it to SV* to C<hv_store>,
+for example:
+
+ HV * some_hash = newHV();
+ hv_store(stash, "key", 3, newRV_noinc((SV *) some_hash), 0);
+
+Here we use C<newRV_noinc> instead of C<newRV_inc> because C<newHV> already set
+the reference count to 1.
+
+The first of these two functions below checks if a hash table entry exists, and the
second deletes it.
bool hv_exists(HV*, const char* key, U32 klen);
--------------2.1.2--
---
Site configuration information for perl 5.21.10: Configured by c9s at Fri Feb 27 12:59:15 CST 2015. Summary of my perl5 (revision 5 version 21 subversion 10) configuration: @INC for perl 5.21.10: Environment for perl 5.21.10: |
From @jkeenanOn Fri Apr 03 10:59:44 2015, yoanlin93@gmail.com wrote:
Since we're past the point in the release cycle where we would be making changes in the Perl 5 core code, my feeling is that we shouldn't be making unnecessary changes in the documentation of the core code. So I've marked this patch for consideration for 5.23.1. Nonetheless, it would be good to get feedback from contributors familiar with perlguts and XS on the merits of this documentation change. Thank you very much. -- |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Fri Apr 03 10:59:44 2015, yoanlin93@gmail.com wrote:
Perhaps we need a more general note that HVs and AVs need an RV to be stored Some might read this to imply that HV in HV is the only case that needs the RV. Tony |
From @jkeenanOn Mon, 20 Apr 2015 00:44:33 GMT, tonyc wrote:
Tony, any further thoughts about this ticket? -- |
Migrated from rt.perl.org#124238 (status was 'open')
Searchable as RT124238$
The text was updated successfully, but these errors were encountered: